00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00036 #ifndef OW_CIMXMLPARSER_HPP_INCLUDE_GUARD_
00037 #define OW_CIMXMLPARSER_HPP_INCLUDE_GUARD_
00038 #include "OW_config.h"
00039 #include "OW_XMLPullParser.hpp"
00040
00041 namespace OW_NAMESPACE
00042 {
00043
00044 class OW_XML_API CIMXMLParser : public XMLPullParser
00045 {
00046 public:
00047
00048 enum tokenId
00049 {
00050 E_CIM ,
00051 E_CLASS ,
00052 E_CLASSNAME ,
00053 E_CLASSPATH ,
00054 E_DECLARATION ,
00055 E_DECLGROUP ,
00056 E_DECLGROUP_WITHNAME ,
00057 E_DECLGROUP_WITHPATH ,
00058 E_ERROR ,
00059 E_EXPMETHODCALL ,
00060 E_EXPMETHODRESPONSE ,
00061 E_EXPPARAMVALUE ,
00062 E_HOST ,
00063 E_IMETHODCALL ,
00064 E_IMETHODRESPONSE ,
00065 E_IMPLICITKEY ,
00066 E_INSTANCE ,
00067 E_INSTANCENAME ,
00068 E_INSTANCEPATH ,
00069 E_IPARAMVALUE ,
00070 E_IRETURNVALUE ,
00071 E_KEYBINDING ,
00072 E_KEYVALUE ,
00073 E_LOCALCLASSPATH ,
00074 E_LOCALINSTANCEPATH ,
00075 E_LOCALNAMESPACEPATH ,
00076 E_MESSAGE ,
00077 E_METHOD ,
00078 E_METHODCALL ,
00079 E_METHODRESPONSE ,
00080 E_MULTIEXPREQ ,
00081 E_MULTIEXPRSP ,
00082 E_MULTIREQ ,
00083 E_MULTIRSP ,
00084 E_NAMESPACE ,
00085 E_NAMESPACEPATH ,
00086 E_OBJECTPATH ,
00087 E_PARAMETER ,
00088 E_PARAMETER_ARRAY ,
00089 E_PARAMETER_REFARRAY ,
00090 E_PARAMETER_REFERENCE ,
00091 E_PARAMVALUE ,
00092 E_PROPERTY ,
00093 E_PROPERTY_ARRAY ,
00094 E_PROPERTY_REFERENCE ,
00095 E_QUALIFIER ,
00096 E_QUALIFIER_DECLARATION ,
00097 E_RETURNVALUE ,
00098 E_SCOPE ,
00099 E_SIMPLEEXPREQ ,
00100 E_SIMPLEEXPRSP ,
00101 E_SIMPLEREQ ,
00102 E_SIMPLERSP ,
00103 E_VALUE ,
00104 E_VALUE_ARRAY ,
00105 E_VALUE_NAMEDINSTANCE ,
00106 E_VALUE_NAMEDOBJECT ,
00107 E_VALUE_OBJECT ,
00108 E_VALUE_OBJECTWITHLOCALPATH ,
00109 E_VALUE_OBJECTWITHPATH ,
00110 E_VALUE_REFARRAY ,
00111 E_VALUE_REFERENCE ,
00112 E_UNKNOWN
00113 };
00114 CIMXMLParser(const String& str);
00115 CIMXMLParser(std::istream& sb);
00116 CIMXMLParser();
00117 void mustGetChildId(tokenId tId);
00118 void getNextId(tokenId beginTok, bool throwIfError = false);
00119 void mustGetNextId(tokenId beginTok)
00120 {
00121 getNextId(beginTok, true);
00122 }
00123 bool tokenIsId(tokenId tId) const
00124 {
00125 return XMLPullParser::tokenIs(g_elems[tId].name);
00126 }
00127 void mustTokenIsId(tokenId tId) const;
00128 tokenId getToken() const
00129 {
00130 return getTokenFromName(m_curTok.text.c_str());
00131 }
00132
00133 typedef bool CIMXMLParser::*safe_bool;
00134 operator safe_bool () const
00135 { return m_good ? &CIMXMLParser::m_good : 0; }
00136 bool operator!() const
00137 { return !m_good; }
00138
00139
00140
00141
00142
00143 static const char* const A_ASSOCCLASS;
00144 static const char* const A_CLASSNAME;
00145 static const char* const A_CLASSORIGIN;
00146 static const char* const A_DEEPINHERITANCE;
00147 static const char* const A_INCLUDECLASSORIGIN;
00148 static const char* const A_INCLUDEQUALIFIERS;
00149 static const char* const A_INSTANCENAME;
00150 static const char* const A_XML_LANG;
00151 static const char* const A_LOCALONLY;
00152 static const char* const A_MODIFIEDCLASS;
00153 static const char* const A_NAME;
00154 static const char* const A_NEWVALUE;
00155 static const char* const A_OBJECTNAME;
00156 static const char* const A_OVERRIDABLE;
00157 static const char* const A_PARAMTYPE;
00158 static const char* const A_PROPAGATED;
00159 static const char* const A_PROPERTYLIST;
00160 static const char* const A_PROPERTYNAME;
00161 static const char* const A_REFERENCECLASS;
00162 static const char* const A_RESULTCLASS;
00163 static const char* const A_RESULTROLE;
00164 static const char* const A_ROLE;
00165 static const char* const A_SUPERCLASS;
00166 static const char* const A_TOINSTANCE;
00167 static const char* const A_TOSUBCLASS;
00168 static const char* const A_TRANSLATABLE;
00169 static const char* const A_TYPE;
00170 static const char* const A_VALUETYPE;
00171 static const char* const A_CIMVERSION;
00172 static const char* const A_DTDVERSION;
00173 static const char* const A_ID;
00174 static const char* const A_PROTOCOLVERSION;
00175 static const char* const A_CODE;
00176 static const char* const A_DESCRIPTION;
00177 static const char* const A_ARRAYSIZE;
00178 static const char* const A_ISARRAY;
00179 static const char* const A_EMBEDDEDOBJECT;
00180 static const char* const AV_CIMVERSION20_VALUE;
00181 static const char* const AV_CIMVERSION21_VALUE;
00182 static const char* const AV_CIMVERSION22_VALUE;
00183 static const char* const AV_DTDVERSION20_VALUE;
00184 static const char* const AV_DTDVERSION21_VALUE;
00185 static const char* const AV_PROTOCOLVERSION10_VALUE;
00186 static const char* const AV_PROTOCOLVERSION11_VALUE;
00187 static const char* const AV_EMBEDDEDOBJECT_OBJECT_VALUE;
00188 static const char* const AV_EMBEDDEDOBJECT_INSTANCE_VALUE;
00189 static const char* const P_ClassName;
00190 static const char* const P_PropertyList;
00191 static const char* const P_DeepInheritance;
00192 static const char* const P_LocalOnly;
00193 static const char* const P_IncludeQualifiers;
00194 static const char* const P_IncludeClassOrigin;
00195 static const char* const P_ModifiedClass;
00196 static const char* const P_ModifiedInstance;
00197 static const char* const P_InstanceName;
00198 static const char* const P_PropertyName;
00199 static const char* const P_NewValue;
00200 static const char* const P_Role;
00201 static const char* const P_ResultRole;
00202 static const char* const P_ObjectName;
00203 static const char* const P_AssocClass;
00204 static const char* const P_ResultClass;
00205 static const char* const P_QueryLanguage;
00206 static const char* const P_Query;
00207 static const char* const P_QualifierName;
00208 static const char* const P_QualifierDeclaration;
00209
00210 private:
00211 static tokenId getTokenFromName(const char* name);
00212 struct ElemEntry
00213 {
00214 const char* name;
00215 tokenId id;
00216 };
00217
00218 static ElemEntry g_elems[];
00219 static bool elemEntryCompare(const ElemEntry& f1, const ElemEntry& f2);
00220 static ElemEntry* g_elemsEnd;
00221
00222 CIMXMLParser(const CIMXMLParser& x);
00223 CIMXMLParser& operator=(const CIMXMLParser& x);
00224
00225 };
00226
00227 }
00228
00229 #endif