version 1.147, 2007/01/11 16:21:54
|
version 1.150, 2007/03/27 17:31:32
|
|
|
struct SpecialChar | struct SpecialChar |
{ | { |
const char* str; | const char* str; |
size_t size; |
Uint32 size; |
}; | }; |
| |
// Defines encodings of special characters. Just use a 7-bit ASCII character | // Defines encodings of special characters. Just use a 7-bit ASCII character |
|
|
_xmlWritter_appendSpecialChar(os, *str++); | _xmlWritter_appendSpecialChar(os, *str++); |
} | } |
| |
|
// On windows sprintf outputs 3 digit precision exponent prepending |
|
// zeros. Make it 2 digit precision if first digit is zero in the exponent. |
|
#ifdef PEGASUS_OS_TYPE_WINDOWS |
|
inline void _xmlWriter_normalizeRealValueString(char *str) |
|
{ |
|
// skip initial sign value... |
|
if (*str == '-' || *str == '+') |
|
{ |
|
++str; |
|
} |
|
while (*str && *str != '+' && *str != '-') |
|
{ |
|
++str; |
|
} |
|
if (*str && * ++str == '0') |
|
{ |
|
*str = *(str+1); |
|
*(str+1) = *(str+2); |
|
*(str+2) = 0; |
|
} |
|
} |
|
#endif |
|
|
void XmlWriter::append(Buffer& out, const Char16& x) | void XmlWriter::append(Buffer& out, const Char16& x) |
{ | { |
_xmlWritter_appendChar(out, x); | _xmlWritter_appendChar(out, x); |
|
|
// given in the CIM/XML spec, and the precision required by the CIM 2.2 spec | // given in the CIM/XML spec, and the precision required by the CIM 2.2 spec |
// (4 byte IEEE floating point) | // (4 byte IEEE floating point) |
sprintf(buffer, "%.7e", x); | sprintf(buffer, "%.7e", x); |
|
#ifdef PEGASUS_OS_TYPE_WINDOWS |
|
_xmlWriter_normalizeRealValueString(buffer); |
|
#endif |
append(out, buffer); | append(out, buffer); |
} | } |
| |
|
|
// with the format given in the CIM/XML spec, and the precision required | // with the format given in the CIM/XML spec, and the precision required |
// by the CIM 2.2 spec (8 byte IEEE floating point) | // by the CIM 2.2 spec (8 byte IEEE floating point) |
sprintf(buffer, "%.16e", x); | sprintf(buffer, "%.16e", x); |
|
#ifdef PEGASUS_OS_TYPE_WINDOWS |
|
_xmlWriter_normalizeRealValueString(buffer); |
|
#endif |
append(out, buffer); | append(out, buffer); |
} | } |
| |
|
|
{ | { |
Buffer tmp; | Buffer tmp; |
appendValueElement(tmp, value); | appendValueElement(tmp, value); |
tmp.append('\0'); |
|
os << tmp.getData() << PEGASUS_STD(endl); | os << tmp.getData() << PEGASUS_STD(endl); |
} | } |
| |
|
|
{ | { |
Buffer tmp; | Buffer tmp; |
appendValueReferenceElement(tmp, reference, true); | appendValueReferenceElement(tmp, reference, true); |
tmp.append('\0'); |
|
indentedPrint(os, tmp.getData()); | indentedPrint(os, tmp.getData()); |
} | } |
| |
|
|
{ | { |
Buffer tmp; | Buffer tmp; |
appendClassElement(tmp, cimclass); | appendClassElement(tmp, cimclass); |
tmp.append('\0'); |
|
indentedPrint(os, tmp.getData(), 4); | indentedPrint(os, tmp.getData(), 4); |
} | } |
| |
|
|
{ | { |
Buffer tmp; | Buffer tmp; |
appendInstanceElement(tmp, instance); | appendInstanceElement(tmp, instance); |
tmp.append('\0'); |
|
os << tmp.getData() << PEGASUS_STD(endl); | os << tmp.getData() << PEGASUS_STD(endl); |
} | } |
| |
|
|
{ | { |
Buffer tmp; | Buffer tmp; |
appendPropertyElement(tmp, property); | appendPropertyElement(tmp, property); |
tmp.append('\0'); |
|
os << tmp.getData() << PEGASUS_STD(endl); | os << tmp.getData() << PEGASUS_STD(endl); |
} | } |
| |
|
|
{ | { |
Buffer tmp; | Buffer tmp; |
appendMethodElement(tmp, method); | appendMethodElement(tmp, method); |
tmp.append('\0'); |
|
os << tmp.getData() << PEGASUS_STD(endl); | os << tmp.getData() << PEGASUS_STD(endl); |
} | } |
| |
|
|
{ | { |
Buffer tmp; | Buffer tmp; |
appendParameterElement(tmp, parameter); | appendParameterElement(tmp, parameter); |
tmp.append('\0'); |
|
os << tmp.getData() << PEGASUS_STD(endl); | os << tmp.getData() << PEGASUS_STD(endl); |
} | } |
| |
|
|
{ | { |
Buffer tmp; | Buffer tmp; |
appendParamValueElement(tmp, paramValue); | appendParamValueElement(tmp, paramValue); |
tmp.append('\0'); |
|
os << tmp.getData() << PEGASUS_STD(endl); | os << tmp.getData() << PEGASUS_STD(endl); |
} | } |
| |
|
|
{ | { |
Buffer tmp; | Buffer tmp; |
appendQualifierElement(tmp, qualifier); | appendQualifierElement(tmp, qualifier); |
tmp.append('\0'); |
|
os << tmp.getData() << PEGASUS_STD(endl); | os << tmp.getData() << PEGASUS_STD(endl); |
} | } |
| |
|
|
{ | { |
Buffer tmp; | Buffer tmp; |
appendQualifierDeclElement(tmp, qualifierDecl); | appendQualifierDeclElement(tmp, qualifierDecl); |
tmp.append('\0'); |
|
os << tmp.getData() << PEGASUS_STD(endl); | os << tmp.getData() << PEGASUS_STD(endl); |
} | } |
| |
|
|
httpMethod, | httpMethod, |
httpAcceptLanguages, | httpAcceptLanguages, |
httpContentLanguages, | httpContentLanguages, |
(Uint32)out.size()); |
out.size()); |
tmp << out; | tmp << out; |
| |
return tmp; | return tmp; |
|
|
tmp, | tmp, |
httpMethod, | httpMethod, |
cimException.getContentLanguages(), | cimException.getContentLanguages(), |
(Uint32)out.size()); |
out.size()); |
tmp << out; | tmp << out; |
| |
return tmp; | return tmp; |
|
|
httpMethod, | httpMethod, |
httpAcceptLanguages, | httpAcceptLanguages, |
httpContentLanguages, | httpContentLanguages, |
(Uint32)out.size()); |
out.size()); |
tmp << out; | tmp << out; |
| |
return tmp; | return tmp; |
|
|
appendMethodResponseHeader(tmp, | appendMethodResponseHeader(tmp, |
httpMethod, | httpMethod, |
cimException.getContentLanguages(), | cimException.getContentLanguages(), |
(Uint32)out.size()); |
out.size()); |
tmp << out; | tmp << out; |
| |
return tmp; | return tmp; |
|
|
authenticationHeader, | authenticationHeader, |
httpAcceptLanguages, | httpAcceptLanguages, |
httpContentLanguages, | httpContentLanguages, |
(Uint32)out.size()); |
out.size()); |
tmp << out; | tmp << out; |
| |
return tmp; | return tmp; |
|
|
appendEMethodResponseHeader(tmp, | appendEMethodResponseHeader(tmp, |
httpMethod, | httpMethod, |
httpContentLanguages, | httpContentLanguages, |
(Uint32)out.size()); |
out.size()); |
tmp << out; | tmp << out; |
| |
return tmp; | return tmp; |
|
|
tmp, | tmp, |
httpMethod, | httpMethod, |
cimException.getContentLanguages(), | cimException.getContentLanguages(), |
(Uint32)out.size()); |
out.size()); |
tmp << out; | tmp << out; |
| |
return tmp; | return tmp; |