version 1.67, 2002/07/30 16:14:53
|
version 1.73, 2002/08/20 17:39:37
|
|
|
return out; | return out; |
} | } |
| |
|
PEGASUS_STD(ostream)& operator<<(PEGASUS_STD(ostream)& os, const CIMDateTime& x) |
|
{ |
|
return os << x.toString(); |
|
} |
|
|
inline void _appendChar(Array<Sint8>& out, Char16 c) | inline void _appendChar(Array<Sint8>& out, Char16 c) |
{ | { |
out.append(Sint8(c)); | out.append(Sint8(c)); |
|
|
} | } |
else { | else { |
out << "<KEYVALUE VALUETYPE=\""; | out << "<KEYVALUE VALUETYPE=\""; |
out << KeyBinding::typeToString(keyBindings[i].getType()); |
out << keyBindingTypeToString(keyBindings[i].getType()); |
out << "\">"; | out << "\">"; |
| |
// fixed the special character problem - Markus | // fixed the special character problem - Markus |
|
|
Array<Sint8>& out, | Array<Sint8>& out, |
const CIMObjectPath& objectPath) | const CIMObjectPath& objectPath) |
{ | { |
if (objectPath.isInstanceName()) |
// |
|
// ATTN-CAKG-P2-20020726: The following condition does not correctly |
|
// distinguish instanceNames from classNames in every case |
|
// The instanceName of a singleton instance of a keyless class has no |
|
// key bindings |
|
// |
|
if (objectPath.getKeyBindings ().size () != 0) |
{ | { |
appendLocalInstancePathElement(out, objectPath); | appendLocalInstancePathElement(out, objectPath); |
} | } |
|
|
| |
inline void _appendValue(Array<Sint8>& out, const CIMDateTime& x) | inline void _appendValue(Array<Sint8>& out, const CIMDateTime& x) |
{ | { |
out << x.getString(); //ATTN: append() method? |
out << x.toString(); //ATTN: append() method? |
} | } |
| |
inline void _appendValue(Array<Sint8>& out, const CIMObjectPath& x) | inline void _appendValue(Array<Sint8>& out, const CIMObjectPath& x) |
|
|
} | } |
| |
default: | default: |
throw CIMValueInvalidType(); |
throw CIMValueInvalidTypeException(); |
} | } |
} | } |
else if (value.getType() == CIMTYPE_REFERENCE) | else if (value.getType() == CIMTYPE_REFERENCE) |
|
|
} | } |
| |
default: | default: |
throw CIMValueInvalidType(); |
throw CIMValueInvalidTypeException(); |
} | } |
| |
out << "</VALUE>\n"; | out << "</VALUE>\n"; |
|
|
| |
// See if it is a class or instance reference (instance references have | // See if it is a class or instance reference (instance references have |
// key-bindings; class references do not). | // key-bindings; class references do not). |
|
// |
|
// ATTN-CAKG-P2-20020726: The following condition does not correctly |
|
// distinguish instanceNames from classNames in every case |
|
// The instanceName of a singleton instance of a keyless class has no |
|
// key bindings |
|
// |
| |
//KeyBindingArray kbs = reference.getKeyBindingArray(); |
|
KeyBindingArray kbs = reference.getKeyBindings(); | KeyBindingArray kbs = reference.getKeyBindings(); |
| |
if (kbs.size()) | if (kbs.size()) |
|
|
Array<Sint8>& out, | Array<Sint8>& out, |
const CIMConstObject& object) | const CIMConstObject& object) |
{ | { |
// ATTN-RK-P3-20020515: This could use some work |
if (object.isClass()) |
try |
|
{ | { |
CIMConstClass c(object); | CIMConstClass c(object); |
appendClassElement(out, c); | appendClassElement(out, c); |
} | } |
catch (DynamicCastFailed) |
else if (object.isInstance()) |
{ |
|
try |
|
{ | { |
CIMConstInstance i(object); | CIMConstInstance i(object); |
appendInstanceElement(out, i); | appendInstanceElement(out, i); |
} | } |
catch (DynamicCastFailed) |
// else PEGASUS_ASSERT(0); |
{ |
|
PEGASUS_ASSERT(0); |
|
} |
|
} |
|
} | } |
| |
//------------------------------------------------------------------------------ | //------------------------------------------------------------------------------ |
|
|
| |
void XmlWriter::appendQualifierFlavorEntity( | void XmlWriter::appendQualifierFlavorEntity( |
Array<Sint8>& out, | Array<Sint8>& out, |
Uint32 flavor) |
const CIMFlavor & flavor) |
{ | { |
if (!(flavor & CIMFlavor::OVERRIDABLE)) |
if (!(flavor.hasFlavor (CIMFlavor::OVERRIDABLE))) |
out << " OVERRIDABLE=\"false\""; | out << " OVERRIDABLE=\"false\""; |
| |
if (!(flavor & CIMFlavor::TOSUBCLASS)) |
if (!(flavor.hasFlavor (CIMFlavor::TOSUBCLASS))) |
out << " TOSUBCLASS=\"false\""; | out << " TOSUBCLASS=\"false\""; |
| |
if (flavor & CIMFlavor::TOINSTANCE) |
if (flavor.hasFlavor (CIMFlavor::TOINSTANCE)) |
out << " TOINSTANCE=\"true\""; | out << " TOINSTANCE=\"true\""; |
| |
if (flavor & CIMFlavor::TRANSLATABLE) |
if (flavor.hasFlavor (CIMFlavor::TRANSLATABLE)) |
out << " TRANSLATABLE=\"true\""; | out << " TRANSLATABLE=\"true\""; |
} | } |
| |
|
|
| |
void XmlWriter::appendScopeElement( | void XmlWriter::appendScopeElement( |
Array<Sint8>& out, | Array<Sint8>& out, |
Uint32 scope) |
const CIMScope & scope) |
{ | { |
if (scope) |
if (!(scope.equal (CIMScope ()))) |
{ | { |
out << "<SCOPE"; | out << "<SCOPE"; |
| |
if (scope & CIMScope::CLASS) |
if (scope.hasScope (CIMScope::CLASS)) |
out << " CLASS=\"true\""; | out << " CLASS=\"true\""; |
| |
if (scope & CIMScope::ASSOCIATION) |
if (scope.hasScope (CIMScope::ASSOCIATION)) |
out << " ASSOCIATION=\"true\""; | out << " ASSOCIATION=\"true\""; |
| |
if (scope & CIMScope::REFERENCE) |
if (scope.hasScope (CIMScope::REFERENCE)) |
out << " REFERENCE=\"true\""; | out << " REFERENCE=\"true\""; |
| |
if (scope & CIMScope::PROPERTY) |
if (scope.hasScope (CIMScope::PROPERTY)) |
out << " PROPERTY=\"true\""; | out << " PROPERTY=\"true\""; |
| |
if (scope & CIMScope::METHOD) |
if (scope.hasScope (CIMScope::METHOD)) |
out << " METHOD=\"true\""; | out << " METHOD=\"true\""; |
| |
if (scope & CIMScope::PARAMETER) |
if (scope.hasScope (CIMScope::PARAMETER)) |
out << " PARAMETER=\"true\""; | out << " PARAMETER=\"true\""; |
| |
if (scope & CIMScope::INDICATION) |
if (scope.hasScope (CIMScope::INDICATION)) |
out << " INDICATION=\"true\""; | out << " INDICATION=\"true\""; |
| |
out << "/>"; | out << "/>"; |
|
|
Array<Sint8>& out, | Array<Sint8>& out, |
const CIMException& cimException) | const CIMException& cimException) |
{ | { |
PEG_TRACE_STRING(TRC_XML_WRITER, Tracer::LEVEL2, |
Tracer::traceCIMException(TRC_XML_WRITER, Tracer::LEVEL2, cimException); |
cimException.getTraceDescription()); |
|
| |
out << "<ERROR"; | out << "<ERROR"; |
out << " CODE=\"" << Uint32(cimException.getCode()) << "\""; | out << " CODE=\"" << Uint32(cimException.getCode()) << "\""; |
String description = cimException.getDescription(); |
String description = TraceableCIMException(cimException).getDescription(); |
if (description != String::EMPTY) | if (description != String::EMPTY) |
{ | { |
out << " DESCRIPTION=\""; | out << " DESCRIPTION=\""; |
|
|
const char* name, | const char* name, |
const CIMObjectPath& objectName) | const CIMObjectPath& objectName) |
{ | { |
if (objectName.isClassName()) |
// |
|
// ATTN-CAKG-P2-20020726: The following condition does not correctly |
|
// distinguish instanceNames from classNames in every case |
|
// The instanceName of a singleton instance of a keyless class also |
|
// has no key bindings |
|
// |
|
if (objectName.getKeyBindings ().size () == 0) |
{ | { |
XmlWriter::appendClassNameIParameter( | XmlWriter::appendClassNameIParameter( |
out, name, objectName.getClassName()); | out, name, objectName.getClassName()); |
|
|
return buffer; | return buffer; |
} | } |
| |
|
//------------------------------------------------------------------------------ |
|
// |
|
// XmlWriter::keyBindingTypeToString |
|
// |
|
//------------------------------------------------------------------------------ |
|
const char* XmlWriter::keyBindingTypeToString (KeyBinding::Type type) |
|
{ |
|
switch (type) |
|
{ |
|
case KeyBinding::BOOLEAN: |
|
return "boolean"; |
|
|
|
case KeyBinding::STRING: |
|
return "string"; |
|
|
|
case KeyBinding::NUMERIC: |
|
return "numeric"; |
|
|
|
case KeyBinding::REFERENCE: |
|
default: |
|
PEGASUS_ASSERT(false); |
|
} |
|
|
|
return "unknown"; |
|
} |
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |