version 1.64, 2008/02/29 18:55:06
|
version 1.67, 2008/10/01 04:46:17
|
|
|
#include "CIMQualifierDecl.h" | #include "CIMQualifierDecl.h" |
#include "CIMName.h" | #include "CIMName.h" |
#include "XmlWriter.h" | #include "XmlWriter.h" |
#include "MofWriter.h" |
|
#include <Pegasus/Common/Tracer.h> | #include <Pegasus/Common/Tracer.h> |
#include <Pegasus/Common/MessageLoader.h> | #include <Pegasus/Common/MessageLoader.h> |
#include "StrLit.h" | #include "StrLit.h" |
|
|
throw BadQualifierType(q.getName().getString ()); | throw BadQualifierType(q.getName().getString ()); |
} | } |
| |
#ifdef PEGASUS_EMBEDDED_INSTANCE_SUPPORT |
|
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
// 3. If the qualifier is the EmbeddedInstance qualifier, then check | // 3. If the qualifier is the EmbeddedInstance qualifier, then check |
// that the class specified by the qualifier exists in the namespace. | // that the class specified by the qualifier exists in the namespace. |
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
if (q.getName().equal(CIMName("EmbeddedInstance"))) |
if (q.getName().equal(PEGASUS_QUALIFIERNAME_EMBEDDEDINSTANCE)) |
{ | { |
String className; | String className; |
q.getValue().get(className); | q.getValue().get(className); |
|
|
throw BadQualifierType(embeddedInstType); | throw BadQualifierType(embeddedInstType); |
} | } |
} | } |
#endif // PEGASUS_EMBEDDED_INSTANCE_SUPPORT |
|
| |
//---------------------------------------------------------------------- | //---------------------------------------------------------------------- |
// 4. Check the scope: Must be legal for this qualifier | // 4. Check the scope: Must be legal for this qualifier |
|
|
PEG_METHOD_EXIT(); | PEG_METHOD_EXIT(); |
} | } |
| |
void CIMQualifierList::toXml(Buffer& out) const |
|
{ |
|
for (Uint32 i = 0, n = _qualifiers.size(); i < n; i++) |
|
XmlWriter::appendQualifierElement(out, _qualifiers[i]); |
|
} |
|
|
|
/** toMof - Generates MOF output for a list of CIM Qualifiers. |
|
The qualifiers may be class, property, parameter, etc. |
|
The BNF for this is: |
|
<pre> |
|
qualifierList = "[" qualifier *( "," qualifier ) "]" |
|
</pre> |
|
Produces qualifiers as a string on without nl. |
|
*/ |
|
void CIMQualifierList::toMof(Buffer& out) const |
|
{ |
|
// if no qualifiers, return |
|
if (_qualifiers.size() == 0) |
|
return; |
|
|
|
// Qualifier leading bracket. |
|
out.append('['); |
|
|
|
// Loop to list qualifiers |
|
for (Uint32 i = 0, n = _qualifiers.size(); i < n; i++) |
|
{ |
|
// if second or greater, add comma separator |
|
if (i > 0) |
|
out << STRLIT(", \n"); |
|
MofWriter::appendQualifierElement(out, _qualifiers[i]); |
|
} |
|
|
|
// Terminating bracket |
|
out.append(']'); |
|
} |
|
|
|
|
|
void CIMQualifierList::print(PEGASUS_STD(ostream) &os) const | void CIMQualifierList::print(PEGASUS_STD(ostream) &os) const |
{ | { |
Buffer tmp; | Buffer tmp; |
toXml(tmp); |
for (Uint32 i = 0, n = getCount(); i < n; i++) |
|
XmlWriter::appendQualifierElement(tmp, _qualifiers[i]); |
os << tmp.getData() << PEGASUS_STD(endl); | os << tmp.getData() << PEGASUS_STD(endl); |
} | } |
| |