(file) Return to XmlReader.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 mike  1.1 //BEGIN_LICENSE
  2           //
  3           // Copyright (c) 2000 The Open Group, BMC Software, Tivoli Systems, IBM
  4           //
  5           // Permission is hereby granted, free of charge, to any person obtaining a
  6           // copy of this software and associated documentation files (the "Software"),
  7           // to deal in the Software without restriction, including without limitation
  8           // the rights to use, copy, modify, merge, publish, distribute, sublicense,
  9           // and/or sell copies of the Software, and to permit persons to whom the
 10           // Software is furnished to do so, subject to the following conditions:
 11           //
 12           // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 13           // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 14           // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
 15           // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 16           // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 17           // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 18           // DEALINGS IN THE SOFTWARE.
 19           //
 20           //END_LICENSE
 21           //BEGIN_HISTORY
 22 mike  1.1 //
 23           // Author:
 24           //
 25 mike  1.2 // $Log: XmlReader.h,v $
 26 mike  1.5 // Revision 1.4  2001/02/20 07:25:57  mike
 27           // Added basic create-instance in repository and in client.
 28           //
 29 mike  1.4 // Revision 1.3  2001/02/19 01:47:16  mike
 30           // Renamed names of the form CIMConst to ConstCIM.
 31           //
 32 mike  1.3 // Revision 1.2  2001/02/16 02:06:07  mike
 33           // Renamed many classes and headers.
 34           //
 35 mike  1.2 // Revision 1.1.1.1  2001/01/14 19:53:33  mike
 36           // Pegasus import
 37           //
 38 mike  1.1 //
 39           //END_HISTORY
 40           
 41           ////////////////////////////////////////////////////////////////////////////////
 42           //
 43           // XmlReader.h
 44           //
 45           ////////////////////////////////////////////////////////////////////////////////
 46           
 47           #ifndef Pegasus_XmlReader_h
 48           #define Pegasus_XmlReader_h
 49           
 50           #include <Pegasus/Common/Config.h>
 51           #include <Pegasus/Common/XmlParser.h>
 52 mike  1.2 #include <Pegasus/Common/CIMFlavor.h>
 53           #include <Pegasus/Common/CIMScope.h>
 54           #include <Pegasus/Common/CIMReference.h>
 55 mike  1.1 
 56           PEGASUS_NAMESPACE_BEGIN
 57           
 58 mike  1.2 class CIMQualifier;
 59           class CIMQualifierDecl;
 60           class CIMClass;
 61           class CIMInstance;
 62           class CIMProperty;
 63           class CIMParameter;
 64           class CIMMethod;
 65 mike  1.1 
 66           class PEGASUS_COMMON_LINKAGE XmlReader
 67           {
 68           public:
 69           
 70               static void expectXmlDeclaration(
 71           	XmlParser& parser, 
 72           	XmlEntry& entry);
 73           
 74               static void expectStartTag(
 75           	XmlParser& parser, 
 76           	XmlEntry& entry,
 77           	const char* tagName);
 78           
 79               static void expectEndTag(
 80           	XmlParser& parser, 
 81           	const char* tagName);
 82           
 83               static void expectStartTagOrEmptyTag(
 84           	XmlParser& parser, 
 85           	XmlEntry& entry,
 86 mike  1.1 	const char* tagName);
 87           
 88               static Boolean expectContentOrCData(
 89           	XmlParser& parser, 
 90           	XmlEntry& entry);
 91           
 92               static Boolean testStartTag(
 93           	XmlParser& parser, 
 94           	XmlEntry& entry,
 95           	const char* tagName);
 96           
 97               static Boolean testEndTag(
 98           	XmlParser& parser, 
 99           	const char* tagName);
100           
101               static Boolean testStartTagOrEmptyTag(
102           	XmlParser& parser, 
103           	XmlEntry& entry,
104           	const char* tagName);
105           
106               static Boolean testContentOrCData(
107 mike  1.1 	XmlParser& parser, 
108           	XmlEntry& entry);
109           
110               static void testCimStartTag(XmlParser& parser);
111           
112               static Boolean getIsArrayAttribute(
113           	Uint32 lineNumber,
114           	const XmlEntry& entry,
115           	const char* tagName,
116           	Boolean& value);
117           
118               static String getCimNameAttribute(
119           	Uint32 lineNumber, 
120           	const XmlEntry& entry,
121           	const char* elementName,
122           	Boolean acceptNull = false);
123           
124               static String getClassNameAttribute(
125           	Uint32 lineNumber, 
126           	const XmlEntry& entry,
127           	const char* elementName);
128 mike  1.1 
129               static String getClassOriginAttribute(
130           	Uint32 lineNumber, 
131           	const XmlEntry& entry,
132           	const char* tagName);
133           
134               static String getReferenceClassAttribute(
135           	Uint32 lineNumber, 
136           	const XmlEntry& entry,
137           	const char* elementName);
138           
139               static String getSuperClassAttribute(
140           	Uint32 lineNumber, 
141           	const XmlEntry& entry,
142           	const char* tagName);
143           
144 mike  1.2     static CIMType getCimTypeAttribute(
145 mike  1.1 	Uint32 lineNumber, 
146           	const XmlEntry& entry, 
147           	const char* tagName);
148           
149               static Boolean getCimBooleanAttribute(
150           	Uint32 lineNumber,
151           	const XmlEntry& entry,
152           	const char* tagName,
153           	const char* attributeName,
154           	Boolean defaultValue,
155           	Boolean required);
156           
157               static Boolean stringToReal(
158           	const char* stringValue, 
159           	Real64& x);
160           
161               static Boolean stringToSignedInteger(
162           	const char* stringValue, 
163           	Sint64& x);
164           
165               static Boolean stringToUnsignedInteger(
166 mike  1.1 	const char* stringValue, 
167           	Uint64& x);
168           
169 mike  1.2     static CIMValue stringToValue(
170 mike  1.1 	Uint32 lineNumber, 
171           	const char* valueString, 
172 mike  1.2 	CIMType type);
173 mike  1.1 
174               static Boolean getValueElement(
175           	XmlParser& parser, 
176 mike  1.2 	CIMType type, 
177           	CIMValue& value);
178 mike  1.1 
179 mike  1.2     static CIMValue stringArrayToValue(
180 mike  1.1 	Uint32 lineNumber, 
181           	const Array<const char*>& array, 
182 mike  1.2 	CIMType type);
183 mike  1.1 
184               static Boolean getValueArrayElement(
185           	XmlParser& parser, 
186 mike  1.2 	CIMType type, 
187           	CIMValue& value);
188 mike  1.1 
189               static Uint32 getFlavor(
190           	XmlEntry& entry, 
191           	Uint32 lineNumber, 
192           	const char* tagName);
193           
194               static Uint32 getOptionalScope(
195           	XmlParser& parser);
196           
197               static Boolean getQualifierElement(
198           	XmlParser& parser, 
199 mike  1.2 	CIMQualifier& qualifier);
200 mike  1.1 
201               static Boolean getPropertyElement(
202           	XmlParser& parser, 
203 mike  1.2 	CIMProperty& property);
204 mike  1.1 
205               static Boolean getArraySizeAttribute(
206           	Uint32 lineNumber,
207           	const XmlEntry& entry,
208           	const char* tagName,
209           	Uint32& value);
210           
211               static Boolean getPropertyArrayElement(
212           	XmlParser& parser, 
213 mike  1.2 	CIMProperty& property);
214 mike  1.1 
215               static Boolean getHostElement(
216           	XmlParser& parser,
217           	String& host);
218           
219               static Boolean getNameSpaceElement(
220           	XmlParser& parser,
221           	String& nameSpaceComponent);
222           
223               static Boolean getLocalNameSpacePathElement(
224           	XmlParser& parser,
225           	String& nameSpace);
226           
227               static Boolean getNameSpacePathElement(
228           	XmlParser& parser,
229           	String& host,
230           	String& nameSpace);
231           
232               static Boolean getClassNameElement(
233           	XmlParser& parser,
234           	String& className,
235 mike  1.1 	Boolean required = false);
236           
237 mike  1.2     static KeyBinding::CIMType getValueTypeAttribute(
238 mike  1.1 	Uint32 lineNumber, 
239           	const XmlEntry& entry,
240           	const char* elementName);
241           
242               static Boolean getKeyValueElement(
243           	XmlParser& parser,
244 mike  1.2 	KeyBinding::CIMType& type,
245 mike  1.1 	String& value);
246           
247               static Boolean getKeyBindingElement(
248           	XmlParser& parser,
249           	String& name,
250           	String& value,
251 mike  1.2 	KeyBinding::CIMType& type);
252 mike  1.1 
253               static Boolean getInstanceNameElement(
254           	XmlParser& parser,
255           	String& className,
256           	Array<KeyBinding>& keyBindings);
257           
258               static Boolean getInstancePathElement(
259           	XmlParser& parser,
260 mike  1.2 	CIMReference& reference);
261 mike  1.1 
262               static Boolean getLocalInstancePathElement(
263           	XmlParser& parser,
264 mike  1.2 	CIMReference& reference);
265 mike  1.1 
266               static Boolean getClassPathElement(
267           	XmlParser& parser,
268 mike  1.2 	CIMReference& reference);
269 mike  1.1 
270               static Boolean getLocalClassPathElement(
271           	XmlParser& parser,
272 mike  1.2 	CIMReference& reference);
273 mike  1.1 
274               static Boolean getValueReferenceElement(
275           	XmlParser& parser,
276 mike  1.2 	CIMReference& reference);
277 mike  1.1 
278               static Boolean getPropertyReferenceElement(
279           	XmlParser& parser, 
280 mike  1.2 	CIMProperty& property);
281 mike  1.1 
282               static Boolean getParameterElement(
283           	XmlParser& parser, 
284 mike  1.2 	CIMParameter& parameter);
285 mike  1.1 
286               static Boolean getParameterArrayElement(
287           	XmlParser& parser, 
288 mike  1.2 	CIMParameter& parameter);
289 mike  1.1 
290               static Boolean getParameterReferenceElement(
291           	XmlParser& parser, 
292 mike  1.2 	CIMParameter& parameter);
293 mike  1.1 
294               static Boolean getQualifierDeclElement(
295           	XmlParser& parser, 
296 mike  1.2 	CIMQualifierDecl& qualifierDecl);
297 mike  1.1 
298               static Boolean getMethodElement(
299           	XmlParser& parser, 
300 mike  1.2 	CIMMethod& method);
301 mike  1.1 
302               static Boolean getClassElement(
303           	XmlParser& parser, 
304 mike  1.3 	CIMClass& cimClass);
305 mike  1.1 
306               static Boolean getInstanceElement(
307           	XmlParser& parser, 
308 mike  1.3 	CIMInstance& cimInstance);
309 mike  1.1 
310 mike  1.2     static void getObject(XmlParser& parser, CIMClass& x)
311 mike  1.1     {
312           	if (!getClassElement(parser, x))
313           	{
314           	    throw XmlValidationError(parser.getLine(),
315           		"expected CLASS element");
316 mike  1.4 	}
317               }
318           
319               static void getObject(XmlParser& parser, CIMInstance& x)
320               {
321           	if (!getInstanceElement(parser, x))
322           	{
323           	    throw XmlValidationError(parser.getLine(),
324           		"expected INSTANCE element");
325 mike  1.1 	}
326               }
327           
328 mike  1.2     static void getObject(XmlParser& parser, CIMQualifierDecl& x)
329 mike  1.1     {
330           	if (!getQualifierDeclElement(parser, x))
331           	{
332           	    throw XmlValidationError(parser.getLine(),
333           		"expected QUALIFIER.DECLARATION element");
334           	}
335               }
336           
337               static Boolean getMessageStartTag(
338           	XmlParser& parser, 
339           	Uint32& id,
340           	const char*& protocolVersion);
341           
342               static Boolean getIMethodCallStartTag(
343           	XmlParser& parser, 
344           	const char*& name);
345           
346               static Boolean getIMethodResponseStartTag(
347           	XmlParser& parser, 
348           	const char*& name);
349           
350 mike  1.1     static Boolean getIParamValueTag(
351           	XmlParser& parser, 
352           	const char*& name);
353           
354               static Boolean getBooleanValueElement(
355           	XmlParser& parser, 
356           	Boolean& result,
357           	Boolean required = false);
358           
359               static Boolean getErrorElement(
360           	XmlParser& parser, 
361 mike  1.5 	CIMException::Code& code,
362 mike  1.1 	const char*& description,
363           	Boolean required = false);
364           
365           private:
366           
367               XmlReader() 
368               { 
369           
370               }
371           };
372           
373           PEGASUS_NAMESPACE_END
374           
375           #endif /* Pegasus_XmlReader_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2