version 1.45, 2008/02/29 18:55:06
|
version 1.46, 2008/03/05 21:31:45
|
|
|
#include "CIMParameterRep.h" | #include "CIMParameterRep.h" |
#include "CIMName.h" | #include "CIMName.h" |
#include "CIMScope.h" | #include "CIMScope.h" |
#include "XmlWriter.h" |
|
#include "StrLit.h" | #include "StrLit.h" |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
|
|
true); | true); |
} | } |
| |
void CIMParameterRep::toXml(Buffer& out) const |
|
{ |
|
if (_isArray) |
|
{ |
|
if (_type == CIMTYPE_REFERENCE) |
|
{ |
|
out << STRLIT("<PARAMETER.REFARRAY NAME=\"") << _name; |
|
out.append('"'); |
|
|
|
if (!_referenceClassName.isNull()) |
|
{ |
|
out << STRLIT(" REFERENCECLASS=\""); |
|
out << _referenceClassName.getString(); |
|
out.append('"'); |
|
} |
|
|
|
if (_arraySize) |
|
{ |
|
char buffer[32]; |
|
int n = sprintf(buffer, "%d", _arraySize); |
|
out << STRLIT(" ARRAYSIZE=\""); |
|
out.append(buffer, n); |
|
out.append('"'); |
|
} |
|
|
|
out << STRLIT(">\n"); |
|
|
|
_qualifiers.toXml(out); |
|
|
|
out << STRLIT("</PARAMETER.REFARRAY>\n"); |
|
} |
|
else |
|
{ |
|
out << STRLIT("<PARAMETER.ARRAY"); |
|
out << STRLIT(" NAME=\"") << _name; |
|
out << STRLIT("\" "); |
|
out << STRLIT(" TYPE=\"") << cimTypeToString(_type); |
|
out.append('"'); |
|
|
|
if (_arraySize) |
|
{ |
|
char buffer[32]; |
|
sprintf(buffer, "%d", _arraySize); |
|
out << STRLIT(" ARRAYSIZE=\"") << buffer; |
|
out.append('"'); |
|
} |
|
|
|
out << STRLIT(">\n"); |
|
|
|
_qualifiers.toXml(out); |
|
|
|
out << STRLIT("</PARAMETER.ARRAY>\n"); |
|
} |
|
} |
|
else if (_type == CIMTYPE_REFERENCE) |
|
{ |
|
out << STRLIT("<PARAMETER.REFERENCE"); |
|
out << STRLIT(" NAME=\"") << _name; |
|
out.append('"'); |
|
|
|
if (!_referenceClassName.isNull()) |
|
{ |
|
out << STRLIT(" REFERENCECLASS=\""); |
|
out << _referenceClassName.getString(); |
|
out.append('"'); |
|
} |
|
out << STRLIT(">\n"); |
|
|
|
_qualifiers.toXml(out); |
|
|
|
out << STRLIT("</PARAMETER.REFERENCE>\n"); |
|
} |
|
else |
|
{ |
|
out << STRLIT("<PARAMETER"); |
|
out << STRLIT(" NAME=\"") << _name; |
|
out << STRLIT("\" "); |
|
out << STRLIT(" TYPE=\"") << cimTypeToString(_type); |
|
out << STRLIT("\">\n"); |
|
|
|
_qualifiers.toXml(out); |
|
|
|
out << STRLIT("</PARAMETER>\n"); |
|
} |
|
} |
|
|
|
/** toMof - puts the Mof representation of teh Parameter object to |
|
the output parameter array |
|
The BNF for this conversion is: |
|
parameterList = parameter *( "," parameter ) |
|
|
|
parameter = [ qualifierList ] (dataType|objectRef) parameterName |
|
[ array ] |
|
|
|
parameterName= IDENTIFIER |
|
|
|
array = "[" [positiveDecimalValue] "]" |
|
|
|
Format on a single line. |
|
*/ |
|
void CIMParameterRep::toMof(Buffer& out) const |
|
{ |
|
// Output the qualifiers for the parameter |
|
_qualifiers.toMof(out); |
|
|
|
if (_qualifiers.getCount()) |
|
out.append(' '); |
|
|
|
// Output the data type and name |
|
out << cimTypeToString(_type); |
|
out.append(' '); |
|
out << _name; |
|
|
|
if (_isArray) |
|
{ |
|
//Output the array indicator "[ [arraysize] ]" |
|
if (_arraySize) |
|
{ |
|
char buffer[32]; |
|
int n = sprintf(buffer, "[%d]", _arraySize); |
|
out.append(buffer, n); |
|
} |
|
else |
|
out << STRLIT("[]"); |
|
} |
|
} |
|
|
|
|
|
Boolean CIMParameterRep::identical(const CIMParameterRep* x) const | Boolean CIMParameterRep::identical(const CIMParameterRep* x) const |
{ | { |
// If the pointers are the same, the objects must be identical | // If the pointers are the same, the objects must be identical |