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

  1 mike  1.21 //%/////////////////////////////////////////////////////////////////////////////
  2            //
  3 mike  1.22 // Copyright (c) 2000, 2001 BMC Software, Hewlett-Packard Company, IBM, 
  4            // The Open Group, Tivoli Systems
  5 mike  1.21 //
  6            // Permission is hereby granted, free of charge, to any person obtaining a copy
  7            // of this software and associated documentation files (the "Software"), to 
  8            // deal in the Software without restriction, including without limitation the 
  9            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 
 10            // sell copies of the Software, and to permit persons to whom the Software is
 11            // furnished to do so, subject to the following conditions:
 12            // 
 13            // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN 
 14            // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 15            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 16            // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 
 17            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
 18            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 
 19            // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 20            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 21            //
 22            //==============================================================================
 23            //
 24            // Author: Mike Brasher (mbrasher@bmc.com)
 25            //
 26 mike  1.22 // Modified By: 
 27            //         Nitin Upasani, Hewlett-Packard Company (Nitin_Upasani@hp.com)
 28            //         Nag Boranna, Hewlett-Packard Company (nagaraja_boranna@hp.com)
 29            //         Roger Kumpf, Hewlett-Packard Company (roger_kumpf@hp.com)
 30 mike  1.21 //
 31            //%/////////////////////////////////////////////////////////////////////////////
 32            
 33            #ifndef Pegasus_XmlWriter_h
 34            #define Pegasus_XmlWriter_h
 35            
 36            #include <iostream>
 37            #include <Pegasus/Common/Config.h>
 38            #include <Pegasus/Common/Exception.h>
 39            #include <Pegasus/Common/Array.h>
 40            #include <Pegasus/Common/String.h>
 41            #include <Pegasus/Common/Indentor.h>
 42            #include <Pegasus/Common/CIMReference.h>
 43 mike  1.22 #include <Pegasus/Common/CIMPropertyList.h>
 44            #include <Pegasus/Common/CIMNamedInstance.h>
 45 mike  1.21 
 46            PEGASUS_NAMESPACE_BEGIN
 47            
 48            class CIMConstQualifierDecl;
 49            class CIMConstClass;
 50            class CIMConstInstance;
 51            
 52            class PEGASUS_COMMON_LINKAGE XmlWriter
 53            {
 54            public:
 55            
 56                static void append(Array<Sint8>& out, Char16 x);
 57            
 58                static void append(Array<Sint8>& out, char x)
 59                {
 60            	append(out, Char16(x));
 61                }
 62            
 63 kumpf 1.26     static void append(Array<Sint8>& out, Uint32 x);
 64            
 65                static void append(Array<Sint8>& out, const char* str);
 66 mike  1.21 
 67 kumpf 1.26     static void append(Array<Sint8>& out, const String& str);
 68 mike  1.21 
 69 kumpf 1.26     static void append(Array<Sint8>& out, const Indentor& x);
 70 mike  1.21 
 71                static void appendSpecial(Array<Sint8>& out, Char16 x);
 72            
 73                static void appendSpecial(Array<Sint8>& out, char x);
 74            
 75 kumpf 1.26     static void appendSpecial(Array<Sint8>& out, const char* str);
 76 mike  1.21 
 77 kumpf 1.26     static void appendSpecial(Array<Sint8>& out, const String& str);
 78 mike  1.21 
 79                static void appendLocalNameSpaceElement(
 80            	Array<Sint8>& out, 
 81            	const String& nameSpace);
 82            
 83 kumpf 1.26     static void appendMethodCallHeader(
 84            	Array<Sint8>& out,
 85 mike  1.21 	const char* host,
 86            	const char* cimMethod,
 87            	const String& cimObject,
 88 mike  1.22         const String& authenticationHeader,
 89 kumpf 1.26 	Uint32 contentLength);
 90 mike  1.21 
 91 kumpf 1.26     static void appendMethodResponseHeader(
 92            	Array<Sint8>& out,
 93            	Uint32 contentLength);
 94 mike  1.21 
 95 kumpf 1.26     static void appendUnauthorizedResponseHeader(
 96            	Array<Sint8>& out,
 97                    const String& content);
 98            
 99                static void appendMessageElementBegin(
100            	Array<Sint8>& out,
101            	const String& messageId);
102                static void appendMessageElementEnd(
103            	Array<Sint8>& out);
104            
105                static void appendSimpleReqElementBegin(Array<Sint8>& out);
106                static void appendSimpleReqElementEnd(Array<Sint8>& out);
107 mike  1.21 
108 kumpf 1.26     static void appendMethodCallElementBegin(
109            	Array<Sint8>& out,
110            	const char* name);
111                static void appendMethodCallElementEnd(
112            	Array<Sint8>& out);
113 mike  1.21 
114 kumpf 1.26     static void appendIMethodCallElementBegin(
115            	Array<Sint8>& out,
116            	const char* name);
117                static void appendIMethodCallElementEnd(
118            	Array<Sint8>& out);
119 mike  1.21 
120 kumpf 1.26     static void appendIParamValueElementBegin(
121            	Array<Sint8>& out,
122            	const char* name);
123                static void appendIParamValueElementEnd(
124            	Array<Sint8>& out);
125 mike  1.21 
126 kumpf 1.26     static void appendSimpleRspElementBegin(Array<Sint8>& out);
127                static void appendSimpleRspElementEnd(Array<Sint8>& out);
128 mike  1.21 
129 kumpf 1.26     static void appendMethodResponseElementBegin(
130            	Array<Sint8>& out,
131            	const char* name);
132                static void appendMethodResponseElementEnd(
133            	Array<Sint8>& out);
134 mike  1.21 
135 kumpf 1.26     static void appendIMethodResponseElementBegin(
136 mike  1.21 	Array<Sint8>& out,
137 kumpf 1.26 	const char* name);
138                static void appendIMethodResponseElementEnd(
139            	Array<Sint8>& out);
140 mike  1.21 
141 kumpf 1.26     static void appendErrorElement(
142            	Array<Sint8>& out,
143 mike  1.21 	CIMStatusCode code,
144            	const char* description);
145            
146 kumpf 1.26     static void appendReturnValueElement(
147            	Array<Sint8>& out,
148            	const CIMValue& value);
149            
150                static void appendIReturnValueElementBegin(Array<Sint8>& out);
151                static void appendIReturnValueElementEnd(Array<Sint8>& out);
152            
153                static void appendBooleanIParameter(
154 mike  1.21 	Array<Sint8>& out,
155 kumpf 1.26 	const char* name,
156 mike  1.21 	Boolean flag);
157            
158 kumpf 1.26     static void appendStringIParameter(
159 mike  1.21 	Array<Sint8>& out,
160 kumpf 1.26 	const char* name,
161 mike  1.21 	const String& str);
162            
163 kumpf 1.26     static void appendQualifierNameIParameter(
164            	Array<Sint8>& out,
165            	const char* name,
166            	const String& qualifierName);
167            
168                static void appendClassNameIParameter(
169 mike  1.21 	Array<Sint8>& out,
170 kumpf 1.26 	const char* name,
171 mike  1.21 	const String& className);
172            
173 kumpf 1.26     static void appendInstanceNameIParameter(
174 mike  1.21 	Array<Sint8>& out,
175 kumpf 1.26 	const char* name,
176            	const CIMReference& instanceName);
177 mike  1.21 
178 kumpf 1.26     static void appendObjectNameIParameter(
179 mike  1.21 	Array<Sint8>& out,
180 kumpf 1.26 	const char* name,
181            	const CIMReference& objectName);
182 mike  1.21 
183 kumpf 1.26     static void appendClassIParameter(
184 mike  1.21 	Array<Sint8>& out,
185 kumpf 1.26 	const char* name,
186            	const CIMConstClass& cimClass);
187 mike  1.21 
188 kumpf 1.26     static void appendInstanceIParameter(
189 mike  1.21 	Array<Sint8>& out,
190 kumpf 1.26 	const char* name,
191 mike  1.21 	const CIMConstInstance& instance);
192            
193 kumpf 1.26     static void appendNamedInstanceIParameter(
194 mike  1.22 	Array<Sint8>& out,
195 kumpf 1.26 	const char* name,
196 mike  1.22 	const CIMNamedInstance& namedInstance);
197            
198 kumpf 1.26     static void appendPropertyNameIParameter(
199 mike  1.21 	Array<Sint8>& out,
200 kumpf 1.26 	const String& propertyName);
201 mike  1.21 
202 kumpf 1.26     static void appendPropertyValueIParameter(
203 mike  1.21 	Array<Sint8>& out,
204 kumpf 1.26 	const char* name,
205            	const CIMValue& value);
206 mike  1.21 
207 kumpf 1.26     static void appendPropertyListIParameter(
208 mike  1.21 	Array<Sint8>& out,
209 kumpf 1.26 	const CIMPropertyList& propertyList);
210 mike  1.21 
211 kumpf 1.26     static void appendQualifierDeclarationIParameter(
212 mike  1.21 	Array<Sint8>& out,
213 kumpf 1.26 	const char* name,
214            	const CIMConstQualifierDecl& qualifierDecl);
215 mike  1.21 
216 kumpf 1.26     static void appendClassNameElement(
217 mike  1.22 	Array<Sint8>& out,
218 kumpf 1.26 	const String& className);
219 mike  1.22 
220 kumpf 1.26     static void appendInstanceNameElement(
221 mike  1.22 	Array<Sint8>& out,
222 kumpf 1.26 	const CIMReference& instanceName);
223 mike  1.22 
224 kumpf 1.26     static Array<Sint8> formatSimpleMethodReqMessage(
225            	const char* host,
226            	const String& nameSpace,
227            	const char* methodName,
228            	const String& messageId,
229                    const String& authenticationHeader,
230            	const Array<Sint8>& body);
231 mike  1.21 
232 kumpf 1.26     static Array<Sint8> formatSimpleMethodRspMessage(
233            	const char* methodName,
234                    const String& messageId,
235            	const Array<Sint8>& body);
236 mike  1.21 
237 mike  1.22     static Array<Sint8> formatSimpleIMethodReqMessage(
238 mike  1.21 	const char* host,
239            	const String& nameSpace,
240            	const char* iMethodName,
241 mike  1.22 	const String& messageId,
242                    const String& authenticationHeader,
243 mike  1.21 	const Array<Sint8>& body);
244            
245 kumpf 1.26     static Array<Sint8> formatSimpleIMethodRspMessage(
246 mike  1.21 	const char* iMethodName,
247                    const String& messageId,
248            	const Array<Sint8>& body);
249            
250 mike  1.22     static Array<Sint8> formatSimpleIndicationReqMessage(
251            	const char* host,
252                	const char* iMethodName,
253            	const String& messageId,
254                    const String& authenticationHeader,
255                	const Array<Sint8>& body);
256            
257 kumpf 1.26     static void appendEMethodRequestHeader(
258                	Array<Sint8>& out,
259 mike  1.22     	const char* host,
260                	const char* cimMethod,
261                    const String& authenticationHeader,
262 kumpf 1.26 	Uint32 contentLength);
263 mike  1.22 
264 kumpf 1.26     static void appendEMethodResponseHeader(
265            	Array<Sint8>& out,
266            	Uint32 contentLength);
267 mike  1.22 
268 kumpf 1.26     static void appendSimpleExportReqElementBegin(Array<Sint8>& out);
269                static void appendSimpleExportReqElementEnd(Array<Sint8>& out);
270 mike  1.22 
271 kumpf 1.26     static void appendEMethodCallElementBegin(
272                	Array<Sint8>& out,
273                	const char* name);
274                static void appendEMethodCallElementEnd(
275                	Array<Sint8>& out);
276 mike  1.22 
277 kumpf 1.26     static void appendSimpleExportRspElementBegin(Array<Sint8>& out);
278                static void appendSimpleExportRspElementEnd(Array<Sint8>& out);
279 mike  1.22 
280 kumpf 1.26     static void appendEMethodResponseElementBegin(
281                	Array<Sint8>& out,
282                	const char* name);
283                static void appendEMethodResponseElementEnd(
284                	Array<Sint8>& out);
285 mike  1.22 
286 kumpf 1.26     static Array<Sint8> formatSimpleEMethodReqMessage(
287 mike  1.22 	const char* host,
288 kumpf 1.26 	const char* eMethodName,
289 mike  1.22 	const String& messageId,
290 kumpf 1.26 	const String& authenticationHeader,
291 mike  1.22 	const Array<Sint8>& body);
292            
293 kumpf 1.26     static Array<Sint8> formatSimpleEMethodRspMessage(
294            	const char* eMethodName,
295 mike  1.22         const String& messageId,
296            	const Array<Sint8>& body);
297            
298 kumpf 1.26     static void indentedPrint(
299            	PEGASUS_STD(ostream)& os,
300            	const char* text, 
301            	Uint32 indentChars = 2);
302 mike  1.22 
303 kumpf 1.26     static String getNextMessageId();
304 mike  1.21 
305            private:
306            
307                XmlWriter() { }
308            };
309            
310            PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(
311                Array<Sint8>& out, 
312                const char* x);
313            
314            PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(Array<Sint8>& out, char x);
315            
316            PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(Array<Sint8>& out, Char16 x);
317            
318            PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(
319                Array<Sint8>& out, 
320                const String& x);
321            
322            PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(
323                Array<Sint8>& out, 
324                const Indentor& x);
325 mike  1.21 
326            PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(
327                Array<Sint8>& out, 
328                const Array<Sint8>& x);
329            
330            PEGASUS_COMMON_LINKAGE Array<Sint8>& operator<<(
331                Array<Sint8>& out, 
332                Uint32 x);
333            
334            PEGASUS_NAMESPACE_END
335            
336            #endif /* Pegasus_XmlWriter_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2