version 1.9, 2001/07/10 06:43:24
|
version 1.16, 2002/03/25 16:27:51
|
|
|
#include "XmlWriter.h" | #include "XmlWriter.h" |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
|
PEGASUS_USING_STD; |
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
// | // |
// CIMQualifierRep | // CIMQualifierRep |
|
|
| |
out << ">\n"; | out << ">\n"; |
| |
_value.toXml(out); |
/* While property Null XML is to be printed without the value tag |
|
the specification requires that Qualifer NULL values include the |
|
value tag |
|
KSTESTNULL |
|
*/ |
|
_value.toXml(out, true); |
| |
out << "</QUALIFIER>\n"; | out << "</QUALIFIER>\n"; |
} | } |
|
|
os << tmp.getData() << PEGASUS_STD(endl); | os << tmp.getData() << PEGASUS_STD(endl); |
} | } |
| |
|
/** toMof Generates MOF output for a qualifier. |
|
The BNF for this is: |
|
<pre> |
|
qualifier = qualifierName [ qualifierParameter ] [ ":" 1*flavor] |
|
|
|
qualifierParameter = "(" constantValue ")" | arrayInitializer |
|
|
|
arrayInitializer = "{" constantValue*( "," constantValue)"}" |
|
</pre> |
|
*/ |
|
void CIMQualifierRep::toMof(Array<Sint8>& out) const |
|
{ |
|
// Output Qualifier name |
|
out << _name; |
|
|
|
/* If the qualifier is Boolean, we do not put out a value. This is |
|
the way MOF is shown. Note that we should really be checking |
|
the qualifierdecl to compare with the default but the defaults |
|
on the current ones are all false so the existence of the qualifier |
|
implies true. |
|
Also if the value is Null, we do not put out a value because |
|
no value has been set. Assumes that qualifiers are built |
|
with NULL set if no value has been placed in the qualifier. |
|
*/ |
|
Boolean hasValueField = false; |
|
if (!_value.isNull() || !(_value.getType() == CIMType::BOOLEAN) ) |
|
{ |
|
out << " ("; |
|
hasValueField = true; |
|
_value.toMof(out); |
|
} |
|
|
|
// output the flavors |
|
// ATTN: KS P3 This is a poor test to see if flavor output exists |
|
String flavorString; |
|
flavorString = FlavorToMof(_flavor); |
|
if (flavorString.size()) |
|
{ |
|
if (hasValueField == false) |
|
out << " ("; |
|
out << " : "; |
|
out << flavorString; |
|
hasValueField = true; |
|
//FlavorToMof(out, _flavor); |
|
} |
|
|
|
if (hasValueField) |
|
out << ")"; |
|
} |
|
|
|
void CIMQualifierRep::printMof(PEGASUS_STD(ostream) &os) const |
|
{ |
|
Array<Sint8> tmp; |
|
toMof(tmp); |
|
tmp.append('\0'); |
|
os << tmp.getData() << PEGASUS_STD(endl); |
|
} |
|
|
|
|
CIMQualifierRep::CIMQualifierRep() | CIMQualifierRep::CIMQualifierRep() |
{ | { |
| |