version 1.11, 2002/03/04 15:08:21
|
version 1.12, 2002/03/07 00:44:14
|
|
|
#include "CIMFlavor.h" | #include "CIMFlavor.h" |
#include "Exception.h" | #include "Exception.h" |
#include "XmlWriter.h" | #include "XmlWriter.h" |
|
//#include <iostream> |
| |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
|
PEGASUS_USING_STD; |
| |
const Uint32 CIMFlavor::NONE = 0; | const Uint32 CIMFlavor::NONE = 0; |
const Uint32 CIMFlavor::OVERRIDABLE = 1; | const Uint32 CIMFlavor::OVERRIDABLE = 1; |
const Uint32 CIMFlavor::TOSUBCLASS = 2; | const Uint32 CIMFlavor::TOSUBCLASS = 2; |
const Uint32 CIMFlavor::TOINSTANCE = 4; | const Uint32 CIMFlavor::TOINSTANCE = 4; |
const Uint32 CIMFlavor::TRANSLATABLE = 8; | const Uint32 CIMFlavor::TRANSLATABLE = 8; |
|
const Uint32 CIMFlavor::TOSUBELEMENTS = TOSUBCLASS | TOINSTANCE; |
const Uint32 CIMFlavor::DEFAULTS = OVERRIDABLE | TOSUBCLASS; | const Uint32 CIMFlavor::DEFAULTS = OVERRIDABLE | TOSUBCLASS; |
| |
static const char* _toString(Boolean x) | static const char* _toString(Boolean x) |
|
|
| |
TRANSLATABLE = "translatable" | TRANSLATABLE = "translatable" |
</pre> | </pre> |
The keyword toinstance is not in the CIMspecification and so is not |
The keyword toinstance is not in the CIMspecification. For the moment we are |
included in out output.. |
assuming that it is the same as the TOSubclass. We had a choice of using |
|
one entity for both or separating them and letting the compiler set both. |
|
|
*/ | */ |
String FlavorToMof(Uint32 flavor) | String FlavorToMof(Uint32 flavor) |
{ | { |
|
|
| |
tmp = ""; | tmp = ""; |
| |
if (overridable) |
//cout << "KSTEST MOF " << flavor << " overridable = " << overridable << endl; |
tmp += "EnableOverride, "; |
|
else |
if (!overridable) |
tmp += "DisableOverride, "; | tmp += "DisableOverride, "; |
| |
if (!toSubClass) | if (!toSubClass) |
tmp += "Restricted, "; | tmp += "Restricted, "; |
| |
|
|
/* this is not a legal MOF flavor |
|
if (toInstance) |
|
tmp += "TOINSTANCE "; |
|
*/ |
|
|
|
if (translatable) | if (translatable) |
tmp += "Translatable, "; | tmp += "Translatable, "; |
| |
|
|
return tmp; | return tmp; |
} | } |
| |
|
/* |
|
The XML Definition is, from XML Specification |
|
<!ENTITY % QualifierFlavor "OVERRIDABLE (true|false) 'true' |
|
TOSUBCLASS (true|false) 'true' |
|
TOINSTANCE (true|false) 'false' |
|
TRANSLATABLE (true|false) 'false'"> |
|
*/ |
void FlavorToXml(Array<Sint8>& out, Uint32 flavor) | void FlavorToXml(Array<Sint8>& out, Uint32 flavor) |
{ | { |
Boolean overridable = (flavor & CIMFlavor::OVERRIDABLE) != 0; | Boolean overridable = (flavor & CIMFlavor::OVERRIDABLE) != 0; |
|
|
if (!overridable) | if (!overridable) |
out << " OVERRIDABLE=\"" << _toString(overridable) << "\""; | out << " OVERRIDABLE=\"" << _toString(overridable) << "\""; |
| |
|
/*cout << "KSTEST XML " << flavor << " overridable = " |
|
<< overridable |
|
<< " " << FlavorToMof(flavor) |
|
<< endl;*/ |
|
|
if (!toSubClass) | if (!toSubClass) |
out << " TOSUBCLASS=\"" << _toString(toSubClass) << "\""; | out << " TOSUBCLASS=\"" << _toString(toSubClass) << "\""; |
| |