version 1.48, 2005/05/17 14:52:26
|
version 1.48.2.2, 2005/09/30 20:35:55
|
|
|
return x ? "true" : "false"; | return x ? "true" : "false"; |
} | } |
| |
void CIMPropertyRep::toXml(Array<char>& out) const |
void CIMPropertyRep::toXml(Buffer& out) const |
{ | { |
if (_value.isArray()) | if (_value.isArray()) |
{ | { |
out << "<PROPERTY.ARRAY"; |
out << LIT("<PROPERTY.ARRAY"); |
|
out << LIT(" NAME=\"") << _name << LIT("\" "); |
out << " NAME=\"" << _name << "\" "; |
|
| |
// If the property array type is CIMObject, then | // If the property array type is CIMObject, then |
// encode the property in CIM-XML as a string array with the EMBEDDEDOBJECT attribute | // encode the property in CIM-XML as a string array with the EMBEDDEDOBJECT attribute |
|
|
{ | { |
Array<CIMObject> a; | Array<CIMObject> a; |
_value.get(a); | _value.get(a); |
out << " TYPE=\"string\""; |
out << LIT(" TYPE=\"string\""); |
// If the Embedded Object is an instance, always add the EMBEDDEDOBJECT attribute. | // If the Embedded Object is an instance, always add the EMBEDDEDOBJECT attribute. |
if (a.size() > 0 && a[0].isInstance()) | if (a.size() > 0 && a[0].isInstance()) |
out << " EMBEDDEDOBJECT=\"object\""; |
out << LIT(" EMBEDDEDOBJECT=\"object\""); |
// Else the Embedded Object is a class, always add the EmbeddedObject qualifier. | // Else the Embedded Object is a class, always add the EmbeddedObject qualifier. |
// Note that if the macro PEGASUS_SNIA_INTEROP_COMPATIBILITY is defined, then | // Note that if the macro PEGASUS_SNIA_INTEROP_COMPATIBILITY is defined, then |
// the EmbeddedObject qualifier will always be added, whether it's a class or | // the EmbeddedObject qualifier will always be added, whether it's a class or |
|
|
} | } |
else | else |
{ | { |
out << " TYPE=\"" << cimTypeToString (_value.getType ()) << "\""; |
out << LIT(" TYPE=\"") << cimTypeToString (_value.getType ()); |
|
out.append('"'); |
} | } |
| |
if (_arraySize) | if (_arraySize) |
{ | { |
char buffer[32]; | char buffer[32]; |
sprintf(buffer, "%d", _arraySize); | sprintf(buffer, "%d", _arraySize); |
out << " ARRAYSIZE=\"" << buffer << "\""; |
out << LIT(" ARRAYSIZE=\"") << buffer; |
|
out.append('"'); |
} | } |
| |
if (!_classOrigin.isNull()) | if (!_classOrigin.isNull()) |
out << " CLASSORIGIN=\"" << _classOrigin << "\""; |
{ |
|
out << LIT(" CLASSORIGIN=\"") << _classOrigin; |
|
out.append('"'); |
|
} |
| |
if (_propagated != false) | if (_propagated != false) |
out << " PROPAGATED=\"" << _toString(_propagated) << "\""; |
{ |
|
out << LIT(" PROPAGATED=\"") << _toString(_propagated); |
|
out.append('"'); |
|
} |
| |
out << ">\n"; |
out << LIT(">\n"); |
| |
_qualifiers.toXml(out); | _qualifiers.toXml(out); |
| |
XmlWriter::appendValueElement(out, _value); | XmlWriter::appendValueElement(out, _value); |
| |
out << "</PROPERTY.ARRAY>\n"; |
out << LIT("</PROPERTY.ARRAY>\n"); |
} | } |
else if (_value.getType() == CIMTYPE_REFERENCE) | else if (_value.getType() == CIMTYPE_REFERENCE) |
{ | { |
out << "<PROPERTY.REFERENCE"; |
out << LIT("<PROPERTY.REFERENCE"); |
|
out << LIT(" NAME=\"") << _name << LIT("\" "); |
out << " NAME=\"" << _name << "\" "; |
|
| |
if (!_referenceClassName.isNull()) | if (!_referenceClassName.isNull()) |
{ | { |
out << " REFERENCECLASS=\"" << _referenceClassName << "\""; |
out << LIT(" REFERENCECLASS=\"") << _referenceClassName; |
|
out.append('"'); |
} | } |
| |
if (!_classOrigin.isNull()) | if (!_classOrigin.isNull()) |
out << " CLASSORIGIN=\"" << _classOrigin << "\""; |
{ |
|
out << LIT(" CLASSORIGIN=\"") << _classOrigin; |
|
out.append('"'); |
|
} |
| |
if (_propagated != false) | if (_propagated != false) |
out << " PROPAGATED=\"" << _toString(_propagated) << "\""; |
{ |
|
out << LIT(" PROPAGATED=\"") << _toString(_propagated); |
|
out.append('"'); |
|
} |
| |
out << ">\n"; |
out << LIT(">\n"); |
| |
_qualifiers.toXml(out); | _qualifiers.toXml(out); |
| |
XmlWriter::appendValueElement(out, _value); | XmlWriter::appendValueElement(out, _value); |
| |
out << "</PROPERTY.REFERENCE>\n"; |
out << LIT("</PROPERTY.REFERENCE>\n"); |
} | } |
else | else |
{ | { |
out << "<PROPERTY"; |
out << LIT("<PROPERTY"); |
out << " NAME=\"" << _name << "\" "; |
out << LIT(" NAME=\"") << _name << LIT("\" "); |
| |
if (!_classOrigin.isNull()) | if (!_classOrigin.isNull()) |
out << " CLASSORIGIN=\"" << _classOrigin << "\""; |
{ |
|
out << LIT(" CLASSORIGIN=\"") << _classOrigin; |
|
out.append('"'); |
|
} |
| |
if (_propagated != false) | if (_propagated != false) |
out << " PROPAGATED=\"" << _toString(_propagated) << "\""; |
{ |
|
out << LIT(" PROPAGATED=\"") << _toString(_propagated); |
|
out.append('"'); |
|
} |
| |
// If the property type is CIMObject, then | // If the property type is CIMObject, then |
// encode the property in CIM-XML as a string with the EMBEDDEDOBJECT attribute | // encode the property in CIM-XML as a string with the EMBEDDEDOBJECT attribute |
|
|
{ | { |
CIMObject a; | CIMObject a; |
_value.get(a); | _value.get(a); |
out << " TYPE=\"string\""; |
out << LIT(" TYPE=\"string\""); |
// If the Embedded Object is an instance, always add the EMBEDDEDOBJECT attribute. | // If the Embedded Object is an instance, always add the EMBEDDEDOBJECT attribute. |
if (a.isInstance()) | if (a.isInstance()) |
out << " EMBEDDEDOBJECT=\"object\""; |
out << LIT(" EMBEDDEDOBJECT=\"object\""); |
// Else the Embedded Object is a class, always add the EmbeddedObject qualifier. | // Else the Embedded Object is a class, always add the EmbeddedObject qualifier. |
// Note that if the macro PEGASUS_SNIA_INTEROP_COMPATIBILITY is defined, then | // Note that if the macro PEGASUS_SNIA_INTEROP_COMPATIBILITY is defined, then |
// the EmbeddedObject qualifier will always be added, whether it's a class or | // the EmbeddedObject qualifier will always be added, whether it's a class or |
|
|
} | } |
else | else |
{ | { |
out << " TYPE=\"" << cimTypeToString (_value.getType ()) << "\""; |
out << LIT(" TYPE=\"") << cimTypeToString(_value.getType ()); |
|
out.append('"'); |
} | } |
| |
out << ">\n"; |
out << LIT(">\n"); |
| |
_qualifiers.toXml(out); | _qualifiers.toXml(out); |
| |
XmlWriter::appendValueElement(out, _value); | XmlWriter::appendValueElement(out, _value); |
| |
out << "</PROPERTY>\n"; |
out << LIT("</PROPERTY>\n"); |
} | } |
} | } |
| |
|
|
Format with qualifiers on one line and declaration on another. Start | Format with qualifiers on one line and declaration on another. Start |
with newline but none at the end. | with newline but none at the end. |
*/ | */ |
void CIMPropertyRep::toMof(Array<char>& out) const //ATTNKS: |
void CIMPropertyRep::toMof(Buffer& out) const //ATTNKS: |
{ | { |
//Output the qualifier list | //Output the qualifier list |
if (_qualifiers.getCount()) | if (_qualifiers.getCount()) |
out << "\n"; |
out.append('\n'); |
_qualifiers.toMof(out); | _qualifiers.toMof(out); |
| |
// Output the Type and name on a new line | // Output the Type and name on a new line |
out << "\n" << cimTypeToString (_value.getType ()) << " " << _name; |
out.append('\n'); |
|
out << cimTypeToString (_value.getType ()); |
|
out.append(' '); |
|
out << _name; |
| |
// If array put the Array indicator "[]" and possible size after name. | // If array put the Array indicator "[]" and possible size after name. |
if (_value.isArray()) | if (_value.isArray()) |
|
|
out << buffer; | out << buffer; |
} | } |
else | else |
out << "[]"; |
out << LIT("[]"); |
} | } |
| |
// If the property value is not Null, add value after "=" | // If the property value is not Null, add value after "=" |
if (!_value.isNull()) | if (!_value.isNull()) |
{ | { |
out << " = "; |
out << LIT(" = "); |
if (_value.isArray()) | if (_value.isArray()) |
{ | { |
// Insert any property values | // Insert any property values |
|
|
MofWriter::appendValueElement(out, _value); | MofWriter::appendValueElement(out, _value); |
} | } |
} | } |
// Close the property MOF |
|
out << ";"; |
|
| |
|
// Close the property MOF |
|
out.append(';'); |
} | } |
| |
Boolean CIMPropertyRep::identical(const CIMPropertyRep* x) const | Boolean CIMPropertyRep::identical(const CIMPropertyRep* x) const |