version 1.77.2.1, 2006/02/10 16:09:39
|
version 1.87, 2008/10/17 07:16:35
|
|
|
// | // |
//============================================================================== | //============================================================================== |
// | // |
// Author: Mike Brasher (mbrasher@bmc.com) |
|
// |
|
// Modified By: |
|
// Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com) |
|
// Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com) |
|
// Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com) |
|
// Carol Ann Krug Graves, Hewlett-Packard Company |
|
// (carolann_graves@hp.com) |
|
// Brian G. Campbell, EMC (campbell_brian@emc.com) - PEP140/phase1 |
|
// Willis White (whiwill@us.ibm.com) PEP 127 and 128 |
|
// Brian G. Campbell, EMC (campbell_brian@emc.com) - PEP140/phase2 |
|
// David Dillard, Symantec Corp. (david_dillard@symantec.com) |
|
// Vijay Eli, vijayeli@in.ibm.com, fix for #2571 |
|
// |
|
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#ifndef Pegasus_XmlWriter_h | #ifndef Pegasus_XmlWriter_h |
|
|
#include <Pegasus/Common/InternalException.h> | #include <Pegasus/Common/InternalException.h> |
#include <Pegasus/Common/ArrayInternal.h> | #include <Pegasus/Common/ArrayInternal.h> |
#include <Pegasus/Common/String.h> | #include <Pegasus/Common/String.h> |
#include <Pegasus/Common/Indentor.h> |
|
#include <Pegasus/Common/CIMObject.h> | #include <Pegasus/Common/CIMObject.h> |
#include <Pegasus/Common/CIMClass.h> | #include <Pegasus/Common/CIMClass.h> |
#include <Pegasus/Common/CIMInstance.h> | #include <Pegasus/Common/CIMInstance.h> |
|
|
#include <Pegasus/Common/AcceptLanguageList.h> | #include <Pegasus/Common/AcceptLanguageList.h> |
#include <Pegasus/Common/Buffer.h> | #include <Pegasus/Common/Buffer.h> |
#include <Pegasus/Common/StrLit.h> | #include <Pegasus/Common/StrLit.h> |
|
#include <Pegasus/Common/XmlGenerator.h> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
// l10n - added accept language and content language support below |
class PEGASUS_COMMON_LINKAGE XmlWriter : public XmlGenerator |
|
|
class PEGASUS_COMMON_LINKAGE XmlWriter |
|
{ | { |
public: | public: |
| |
static void append(Buffer& out, const Char16& x); |
|
|
|
static void append(Buffer& out, char x) |
|
{ |
|
out.append(x); |
|
} |
|
|
|
static void append(Buffer& out, Boolean x); |
|
|
|
static void append(Buffer& out, Uint32 x); |
|
|
|
static void append(Buffer& out, Sint32 x); |
|
|
|
static void append(Buffer& out, Uint64 x); |
|
|
|
static void append(Buffer& out, Sint64 x); |
|
|
|
static void append(Buffer& out, Real32 x); |
|
|
|
static void append(Buffer& out, Real64 x); |
|
|
|
static void append(Buffer& out, const char* str); |
|
|
|
static void append(Buffer& out, const String& str); |
|
|
|
static void append(Buffer& out, const Indentor& x); |
|
|
|
static void appendSpecial(Buffer& out, const Char16& x); |
|
|
|
static void appendSpecial(Buffer& out, char x); |
|
|
|
static void appendSpecial(Buffer& out, const char* str); |
|
|
|
static void appendSpecial(Buffer& out, const String& str); |
|
|
|
static String encodeURICharacters(const Buffer& uriString); |
|
static String encodeURICharacters(const String& uriString); |
|
|
|
static void appendLocalNameSpacePathElement( | static void appendLocalNameSpacePathElement( |
Buffer& out, | Buffer& out, |
const CIMNamespaceName& nameSpace); | const CIMNamespaceName& nameSpace); |
|
|
const ContentLanguageList& contentLanguages, | const ContentLanguageList& contentLanguages, |
Uint32 contentLength); | Uint32 contentLength); |
| |
// added to accommodate sending WBEMServerResponseTime PEP #128 |
|
static void appendMethodResponseHeader( | static void appendMethodResponseHeader( |
Buffer& out, | Buffer& out, |
HttpMethod httpMethod, | HttpMethod httpMethod, |
|
|
const String& content); | const String& content); |
#endif | #endif |
| |
|
static void appendParamTypeAndEmbeddedObjAttrib( |
|
Buffer& out, |
|
const CIMType& type); |
|
|
static void appendReturnValueElement( | static void appendReturnValueElement( |
Buffer& out, | Buffer& out, |
const CIMValue& value); | const CIMValue& value); |
|
|
const char* name, | const char* name, |
const String& str); | const String& str); |
| |
static void appendQualifierNameIParameter( |
|
Buffer& out, |
|
const char* name, |
|
const String& qualifierName); |
|
|
|
static void appendClassNameIParameter( | static void appendClassNameIParameter( |
Buffer& out, | Buffer& out, |
const char* name, | const char* name, |
|
|
const AcceptLanguageList& httpAcceptLanguages, | const AcceptLanguageList& httpAcceptLanguages, |
const ContentLanguageList& httpContentLanguages); | const ContentLanguageList& httpContentLanguages); |
| |
//PEP 128 - sending serverResponseTime (WBEMServerResponseTime) in respons header |
|
static Buffer formatSimpleMethodRspMessage( | static Buffer formatSimpleMethodRspMessage( |
const CIMName& methodName, | const CIMName& methodName, |
const String& messageId, | const String& messageId, |
|
|
const ContentLanguageList& httpContentLanguages, | const ContentLanguageList& httpContentLanguages, |
const Buffer& body); | const Buffer& body); |
| |
//PEP 128 - sending serverResponseTime (WBEMServerResponseTime) in respons header |
|
static Buffer formatSimpleIMethodRspMessage( | static Buffer formatSimpleIMethodRspMessage( |
const CIMName& iMethodName, | const CIMName& iMethodName, |
const String& messageId, | const String& messageId, |
|
|
HttpMethod httpMethod, | HttpMethod httpMethod, |
const CIMException& cimException); | const CIMException& cimException); |
| |
static void indentedPrint( |
|
PEGASUS_STD(ostream)& os, |
|
const char* text, |
|
Uint32 indentChars = 2); |
|
|
|
static String getNextMessageId(); | static String getNextMessageId(); |
| |
/** Converts the given CIMKeyBinding type to one of the following: | /** Converts the given CIMKeyBinding type to one of the following: |
"boolean", "string", or "numeric" | "boolean", "string", or "numeric" |
*/ | */ |
static const char* keyBindingTypeToString (CIMKeyBinding::Type type); |
static const StrLit keyBindingTypeToString (CIMKeyBinding::Type type); |
| |
private: | private: |
| |
|
|
static void _appendEMethodResponseElementEnd( | static void _appendEMethodResponseElementEnd( |
Buffer& out); | Buffer& out); |
| |
XmlWriter() { } |
XmlWriter(); |
}; | }; |
| |
PEGASUS_COMMON_LINKAGE Buffer& operator<<( |
|
Buffer& out, |
|
const char* x); |
|
|
|
inline Buffer& operator<<(Buffer& out, char x) |
|
{ |
|
out.append(x); |
|
return out; |
|
} |
|
|
|
inline Buffer& operator<<(Buffer& out, const char* s) |
|
{ |
|
out.append(s, strlen(s)); |
|
return out; |
|
} |
|
|
|
PEGASUS_COMMON_LINKAGE Buffer& operator<<(Buffer& out, const Char16& x); |
|
|
|
PEGASUS_COMMON_LINKAGE Buffer& operator<<( |
|
Buffer& out, |
|
const String& x); |
|
|
|
PEGASUS_COMMON_LINKAGE Buffer& operator<<( |
|
Buffer& out, |
|
const Indentor& x); |
|
|
|
PEGASUS_COMMON_LINKAGE Buffer& operator<<( |
|
Buffer& out, |
|
const Buffer& x); |
|
|
|
PEGASUS_COMMON_LINKAGE Buffer& operator<<( |
|
Buffer& out, |
|
Uint32 x); |
|
|
|
PEGASUS_COMMON_LINKAGE Buffer& operator<<( |
|
Buffer& out, |
|
const CIMName& name); |
|
|
|
PEGASUS_COMMON_LINKAGE PEGASUS_STD(ostream)& operator<<( |
|
PEGASUS_STD(ostream)& os, |
|
const CIMDateTime& x); |
|
|
|
PEGASUS_COMMON_LINKAGE PEGASUS_STD(ostream)& operator<<( |
|
PEGASUS_STD(ostream)& os, |
|
const CIMName& name); |
|
|
|
PEGASUS_COMMON_LINKAGE PEGASUS_STD(ostream)& operator<<( |
|
PEGASUS_STD(ostream)& os, |
|
const CIMNamespaceName& name); |
|
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
| |