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

  1 martin 1.89 //%LICENSE////////////////////////////////////////////////////////////////
  2 martin 1.90 //
  3 martin 1.89 // Licensed to The Open Group (TOG) under one or more contributor license
  4             // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
  5             // this work for additional information regarding copyright ownership.
  6             // Each contributor licenses this file to you under the OpenPegasus Open
  7             // Source License; you may not use this file except in compliance with the
  8             // License.
  9 martin 1.90 //
 10 martin 1.89 // Permission is hereby granted, free of charge, to any person obtaining a
 11             // copy of this software and associated documentation files (the "Software"),
 12             // to deal in the Software without restriction, including without limitation
 13             // the rights to use, copy, modify, merge, publish, distribute, sublicense,
 14             // and/or sell copies of the Software, and to permit persons to whom the
 15             // Software is furnished to do so, subject to the following conditions:
 16 martin 1.90 //
 17 martin 1.89 // The above copyright notice and this permission notice shall be included
 18             // in all copies or substantial portions of the Software.
 19 martin 1.90 //
 20 martin 1.89 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
 21 martin 1.90 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 22 martin 1.89 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 23             // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
 24             // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
 25             // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 26             // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27 martin 1.90 //
 28 martin 1.89 //////////////////////////////////////////////////////////////////////////
 29 mike   1.21 //
 30             //%/////////////////////////////////////////////////////////////////////////////
 31             
 32             #ifndef Pegasus_XmlWriter_h
 33             #define Pegasus_XmlWriter_h
 34             
 35             #include <iostream>
 36             #include <Pegasus/Common/Config.h>
 37 kumpf  1.53 #include <Pegasus/Common/InternalException.h>
 38 kumpf  1.55 #include <Pegasus/Common/ArrayInternal.h>
 39 mike   1.21 #include <Pegasus/Common/String.h>
 40 kumpf  1.41 #include <Pegasus/Common/CIMObject.h>
 41             #include <Pegasus/Common/CIMClass.h>
 42             #include <Pegasus/Common/CIMInstance.h>
 43             #include <Pegasus/Common/CIMProperty.h>
 44             #include <Pegasus/Common/CIMMethod.h>
 45             #include <Pegasus/Common/CIMParameter.h>
 46             #include <Pegasus/Common/CIMQualifier.h>
 47             #include <Pegasus/Common/CIMQualifierDecl.h>
 48             #include <Pegasus/Common/CIMValue.h>
 49 kumpf  1.44 #include <Pegasus/Common/CIMObjectPath.h>
 50 mike   1.22 #include <Pegasus/Common/CIMPropertyList.h>
 51 kumpf  1.29 #include <Pegasus/Common/CIMParamValue.h>
 52 thilo.boehm 1.92 #include <Pegasus/Common/CommonUTF.h>
 53 kumpf       1.59 #include <Pegasus/Common/Message.h>
 54 kumpf       1.49 #include <Pegasus/Common/Linkage.h>
 55 kumpf       1.78 #include <Pegasus/Common/ContentLanguageList.h>
 56                  #include <Pegasus/Common/AcceptLanguageList.h>
 57 mike        1.75 #include <Pegasus/Common/Buffer.h>
 58 mike        1.76 #include <Pegasus/Common/StrLit.h>
 59 kumpf       1.86 #include <Pegasus/Common/XmlGenerator.h>
 60 mike        1.21 
 61                  PEGASUS_NAMESPACE_BEGIN
 62                  
 63 kumpf       1.86 class PEGASUS_COMMON_LINKAGE XmlWriter : public XmlGenerator
 64 mike        1.21 {
 65                  public:
 66                  
 67 kumpf       1.28     static void appendLocalNameSpacePathElement(
 68 david.dillard 1.77         Buffer& out,
 69                            const CIMNamespaceName& nameSpace);
 70 mike          1.21 
 71 kumpf         1.28     static void appendNameSpacePathElement(
 72 david.dillard 1.77         Buffer& out,
 73                            const String& host,
 74                            const CIMNamespaceName& nameSpace);
 75 mike          1.21 
 76 kumpf         1.28     static void appendClassNameElement(
 77 david.dillard 1.77         Buffer& out,
 78                            const CIMName& className);
 79 mike          1.21 
 80 kumpf         1.28     static void appendInstanceNameElement(
 81 david.dillard 1.77         Buffer& out,
 82                            const CIMObjectPath& instanceName);
 83 kumpf         1.26 
 84 kumpf         1.28     static void appendClassPathElement(
 85 david.dillard 1.77         Buffer& out,
 86                            const CIMObjectPath& classPath);
 87 mike          1.21 
 88 kumpf         1.28     static void appendInstancePathElement(
 89 david.dillard 1.77         Buffer& out,
 90                            const CIMObjectPath& instancePath);
 91 mike          1.21 
 92 kumpf         1.28     static void appendLocalClassPathElement(
 93 david.dillard 1.77         Buffer& out,
 94                            const CIMObjectPath& classPath);
 95 mike          1.21 
 96 kumpf         1.28     static void appendLocalInstancePathElement(
 97 david.dillard 1.77         Buffer& out,
 98                            const CIMObjectPath& instancePath);
 99 mike          1.21 
100 kumpf         1.29     static void appendLocalObjectPathElement(
101 david.dillard 1.77         Buffer& out,
102                            const CIMObjectPath& objectPath);
103 kumpf         1.39 
104                        static void appendValueElement(
105 mike          1.75         Buffer& out,
106 kumpf         1.39         const CIMValue& value);
107                    
108                        static void printValueElement(
109                            const CIMValue& value,
110                            PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
111 kumpf         1.29 
112 kumpf         1.41     static void appendValueObjectWithPathElement(
113 mike          1.75         Buffer& out,
114 anusha.kandepu 1.93         const CIMObject& objectWithPath,
115                             Boolean includeQualifiers = true,
116                             Boolean includeClassOrigin = true,
117                             const CIMPropertyList& propertyList = CIMPropertyList());
118 kumpf          1.41 
119                         static void appendValueReferenceElement(
120 mike           1.75         Buffer& out,
121 kumpf          1.44         const CIMObjectPath& reference,
122 kumpf          1.41         Boolean putValueWrapper);
123                     
124                         static void printValueReferenceElement(
125 kumpf          1.44         const CIMObjectPath& reference,
126 kumpf          1.41         PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
127                     
128                         static void appendValueNamedInstanceElement(
129 mike           1.75         Buffer& out,
130 anusha.kandepu 1.93         const CIMInstance& namedInstance,
131                             Boolean includeQualifiers = true,
132                             Boolean includeClassOrigin = true,
133                             const CIMPropertyList& propertyList = CIMPropertyList());
134 kumpf          1.41 
135 kumpf          1.40     static void appendClassElement(
136 mike           1.75         Buffer& out,
137 kumpf          1.40         const CIMConstClass& cimclass);
138                     
139                         static void printClassElement(
140                             const CIMConstClass& cimclass,
141                             PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
142                     
143                         static void appendInstanceElement(
144 mike           1.75         Buffer& out,
145 anusha.kandepu 1.93         const CIMConstInstance& instance,
146                             Boolean includeQualifiers = true,
147                             Boolean includeClassOrigin = true,
148                             const CIMPropertyList& propertyList = CIMPropertyList());
149                     
150 kumpf          1.40 
151                         static void printInstanceElement(
152                             const CIMConstInstance& instance,
153 kumpf          1.41         PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
154                     
155                         static void appendObjectElement(
156 mike           1.75         Buffer& out,
157 anusha.kandepu 1.93         const CIMConstObject& object,
158                             Boolean includeQualifiers = true,
159                             Boolean includeClassOrigin = true,
160                             const CIMPropertyList& propertyList = CIMPropertyList());
161 kumpf          1.41 
162                         static void appendPropertyElement(
163 mike           1.75         Buffer& out,
164 anusha.kandepu 1.93         const CIMConstProperty& property,
165                             Boolean includeQualifiers = true,
166                             Boolean includeClassOrigin = true);
167 kumpf          1.41 
168                         static void printPropertyElement(
169                             const CIMConstProperty& property,
170                             PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
171                     
172                         static void appendMethodElement(
173 mike           1.75         Buffer& out,
174 kumpf          1.41         const CIMConstMethod& method);
175                     
176                         static void printMethodElement(
177                             const CIMConstMethod& method,
178                             PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
179                     
180                         static void appendParameterElement(
181 mike           1.75         Buffer& out,
182 kumpf          1.41         const CIMConstParameter& parameter);
183                     
184                         static void printParameterElement(
185                             const CIMConstParameter& parameter,
186                             PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
187                     
188                         static void appendParamValueElement(
189 mike           1.75         Buffer& out,
190 kumpf          1.41         const CIMParamValue& paramValue);
191                     
192                         static void printParamValueElement(
193                             const CIMParamValue& paramValue,
194                             PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
195                     
196                         static void appendQualifierElement(
197 mike           1.75         Buffer& out,
198 kumpf          1.41         const CIMConstQualifier& qualifier);
199                     
200                         static void printQualifierElement(
201                             const CIMConstQualifier& qualifier,
202                             PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
203                     
204                         static void appendQualifierDeclElement(
205 mike           1.75         Buffer& out,
206 kumpf          1.41         const CIMConstQualifierDecl& qualifierDecl);
207                     
208                         static void printQualifierDeclElement(
209                             const CIMConstQualifierDecl& qualifierDecl,
210 kumpf          1.40         PEGASUS_STD(ostream)& os=PEGASUS_STD(cout));
211                     
212 kumpf          1.42     static void appendQualifierFlavorEntity(
213 mike           1.75         Buffer& out,
214 kumpf          1.52         const CIMFlavor & flavor);
215 kumpf          1.42 
216 kumpf          1.43     static void appendScopeElement(
217 mike           1.75         Buffer& out,
218 kumpf          1.51         const CIMScope & scope);
219 kumpf          1.43 
220 kumpf          1.28     static void appendMethodCallHeader(
221 david.dillard  1.77         Buffer& out,
222                             const char* host,
223                             const CIMName& cimMethod,
224                             const String& cimObject,
225                             const String& authenticationHeader,
226                             HttpMethod httpMethod,
227 kumpf          1.78         const AcceptLanguageList& acceptLanguages,
228                             const ContentLanguageList& contentLanguages,
229 mike           1.88         Uint32 contentLength,
230                             bool binaryRequest = false,
231                             bool binaryResponse = false);
232 mike           1.21 
233 w.white        1.68     static void appendMethodResponseHeader(
234 mike           1.75         Buffer& out,
235 w.white        1.68         HttpMethod httpMethod,
236 kumpf          1.78         const ContentLanguageList& contentLanguages,
237 w.white        1.68         Uint32 contentLength,
238 mike           1.88         Uint64 serverResponseTime = 0,
239                             bool binaryResponse = false);
240 w.white        1.68 
241 kumpf          1.34     static void appendHttpErrorResponseHeader(
242 david.dillard  1.77         Buffer& out,
243                             const String& status,
244                             const String& cimError = String::EMPTY,
245                             const String& errorDetail = String::EMPTY);
246 kumpf          1.34 
247 kumpf          1.28     static void appendUnauthorizedResponseHeader(
248 david.dillard  1.77         Buffer& out,
249 kumpf          1.28         const String& content);
250 mike           1.21 
251 gerarda        1.63 #ifdef PEGASUS_KERBEROS_AUTHENTICATION
252                         static void appendOKResponseHeader(
253 david.dillard  1.77         Buffer& out,
254 gerarda        1.63         const String& content);
255                     #endif
256 kumpf          1.86 
257 karl           1.83     static void appendParamTypeAndEmbeddedObjAttrib(
258                             Buffer& out,
259                             const CIMType& type);
260 gerarda        1.63 
261 kumpf          1.26     static void appendReturnValueElement(
262 david.dillard  1.77         Buffer& out,
263                             const CIMValue& value);
264 kumpf          1.26 
265                         static void appendBooleanIParameter(
266 david.dillard  1.77         Buffer& out,
267                             const char* name,
268                             Boolean flag);
269 mike           1.21 
270 kumpf          1.26     static void appendStringIParameter(
271 david.dillard  1.77         Buffer& out,
272                             const char* name,
273                             const String& str);
274 mike           1.21 
275 kumpf          1.26     static void appendClassNameIParameter(
276 david.dillard  1.77         Buffer& out,
277                             const char* name,
278                             const CIMName& className);
279 mike           1.21 
280 kumpf          1.26     static void appendInstanceNameIParameter(
281 david.dillard  1.77         Buffer& out,
282                             const char* name,
283                             const CIMObjectPath& instanceName);
284 mike           1.21 
285 kumpf          1.26     static void appendObjectNameIParameter(
286 david.dillard  1.77         Buffer& out,
287                             const char* name,
288                             const CIMObjectPath& objectName);
289 mike           1.21 
290 kumpf          1.26     static void appendClassIParameter(
291 david.dillard  1.77         Buffer& out,
292                             const char* name,
293                             const CIMConstClass& cimClass);
294 mike           1.21 
295 kumpf          1.26     static void appendInstanceIParameter(
296 david.dillard  1.77         Buffer& out,
297                             const char* name,
298                             const CIMConstInstance& instance);
299 mike           1.21 
300 kumpf          1.26     static void appendNamedInstanceIParameter(
301 david.dillard  1.77         Buffer& out,
302                             const char* name,
303                             const CIMInstance& namedInstance) ;
304 mike           1.22 
305 kumpf          1.26     static void appendPropertyNameIParameter(
306 david.dillard  1.77         Buffer& out,
307                             const CIMName& propertyName);
308 mike           1.21 
309 kumpf          1.26     static void appendPropertyValueIParameter(
310 david.dillard  1.77         Buffer& out,
311                             const char* name,
312                             const CIMValue& value);
313 mike           1.21 
314 kumpf          1.26     static void appendPropertyListIParameter(
315 david.dillard  1.77         Buffer& out,
316                             const CIMPropertyList& propertyList);
317 mike           1.21 
318 kumpf          1.26     static void appendQualifierDeclarationIParameter(
319 david.dillard  1.77         Buffer& out,
320                             const char* name,
321                             const CIMConstQualifierDecl& qualifierDecl);
322 kumpf          1.34 
323 mike           1.75     static Buffer formatHttpErrorRspMessage(
324 david.dillard  1.77         const String& status,
325                             const String& cimError = String::EMPTY,
326                             const String& errorDetail = String::EMPTY);
327 mike           1.21 
328 mike           1.75     static Buffer formatSimpleMethodReqMessage(
329 david.dillard  1.77         const char* host,
330                             const CIMNamespaceName& nameSpace,
331                             const CIMObjectPath& path,
332                             const CIMName& methodName,
333                             const Array<CIMParamValue>& parameters,
334                             const String& messageId,
335 kumpf          1.59         HttpMethod httpMethod,
336 chuck          1.62         const String& authenticationHeader,
337 kumpf          1.78         const AcceptLanguageList& httpAcceptLanguages,
338 mike           1.88         const ContentLanguageList& httpContentLanguages,
339                             bool binaryResponse);
340 mike           1.21 
341 david.dillard  1.77     static Buffer formatSimpleMethodRspMessage(
342                             const CIMName& methodName,
343 w.white        1.68         const String& messageId,
344                             HttpMethod httpMethod,
345 kumpf          1.78         const ContentLanguageList& httpContentLanguages,
346 david.dillard  1.77         const Buffer& body,
347                             Uint64 serverResponseTime,
348                             Boolean isFirst = true,
349                             Boolean isLast = true);
350 mike           1.21 
351 mike           1.75     static Buffer formatSimpleMethodErrorRspMessage(
352 david.dillard  1.77         const CIMName& methodName,
353                             const String& messageId,
354 kumpf          1.59         HttpMethod httpMethod,
355 david.dillard  1.77         const CIMException& cimException);
356 kumpf          1.27 
357 mike           1.75     static Buffer formatSimpleIMethodReqMessage(
358 david.dillard  1.77         const char* host,
359                             const CIMNamespaceName& nameSpace,
360                             const CIMName& iMethodName,
361                             const String& messageId,
362 kumpf          1.59         HttpMethod httpMethod,
363 mike           1.22         const String& authenticationHeader,
364 kumpf          1.78         const AcceptLanguageList& httpAcceptLanguages,
365                             const ContentLanguageList& httpContentLanguages,
366 mike           1.88         const Buffer& body,
367                             bool binaryResponse);
368 mike           1.21 
369 david.dillard  1.77     static Buffer formatSimpleIMethodRspMessage(
370                             const CIMName& iMethodName,
371 mike           1.21         const String& messageId,
372 kumpf          1.59         HttpMethod httpMethod,
373 kumpf          1.78         const ContentLanguageList& httpContentLanguages,
374 david.dillard  1.77         const Buffer& body,
375                             Uint64 serverResponseTime,
376                             Boolean isFirst = true,
377                             Boolean isLast = true);
378 mike           1.21 
379 mike           1.88 
380 mike           1.75     static Buffer formatSimpleIMethodErrorRspMessage(
381 david.dillard  1.77         const CIMName& iMethodName,
382                             const String& messageId,
383 kumpf          1.59         HttpMethod httpMethod,
384 david.dillard  1.77         const CIMException& cimException);
385 mike           1.22 
386 kumpf          1.61     static void appendInstanceEParameter(
387 david.dillard  1.77         Buffer& out,
388                             const char* name,
389                             const CIMInstance& instance);
390 kumpf          1.61 
391 kumpf          1.26     static void appendEMethodRequestHeader(
392 david.dillard  1.77         Buffer& out,
393 kumpf          1.38         const char* requestUri,
394 david.dillard  1.77         const char* host,
395                             const CIMName& cimMethod,
396 kumpf          1.59         HttpMethod httpMethod,
397 mike           1.22         const String& authenticationHeader,
398 kumpf          1.78         const AcceptLanguageList& acceptLanguages,
399                             const ContentLanguageList& contentLanguages,
400 david.dillard  1.77         Uint32 contentLength);
401 mike           1.22 
402 kumpf          1.26     static void appendEMethodResponseHeader(
403 david.dillard  1.77         Buffer& out,
404 kumpf          1.59         HttpMethod httpMethod,
405 kumpf          1.78         const ContentLanguageList& contentLanguages,
406 david.dillard  1.77         Uint32 contentLength);
407 mike           1.22 
408 mike           1.75     static Buffer formatSimpleEMethodReqMessage(
409 kumpf          1.38         const char* requestUri,
410 david.dillard  1.77         const char* host,
411                             const CIMName& eMethodName,
412                             const String& messageId,
413                             HttpMethod httpMethod,
414                             const String& authenticationHeader,
415 kumpf          1.78         const AcceptLanguageList& httpAcceptLanguages,
416                             const ContentLanguageList& httpContentLanguages,
417 david.dillard  1.77         const Buffer& body);
418 mike           1.22 
419 mike           1.75     static Buffer formatSimpleEMethodRspMessage(
420 david.dillard  1.77         const CIMName& eMethodName,
421 mike           1.22         const String& messageId,
422 kumpf          1.59         HttpMethod httpMethod,
423 kumpf          1.78         const ContentLanguageList& httpContentLanguages,
424 david.dillard  1.77         const Buffer& body);
425 kumpf          1.27 
426 mike           1.75     static Buffer formatSimpleEMethodErrorRspMessage(
427 david.dillard  1.77         const CIMName& eMethodName,
428                             const String& messageId,
429 kumpf          1.59         HttpMethod httpMethod,
430 david.dillard  1.77         const CIMException& cimException);
431 mike           1.22 
432 kumpf          1.26     static String getNextMessageId();
433 mike           1.21 
434 kumpf          1.57     /** Converts the given CIMKeyBinding type to one of the following:
435 kumpf          1.50         "boolean", "string", or "numeric"
436                         */
437 thilo.boehm    1.87     static const StrLit keyBindingTypeToString (CIMKeyBinding::Type type);
438 kumpf          1.91 
439 mike           1.21 private:
440 kumpf          1.28 
441                         static void _appendMessageElementBegin(
442 david.dillard  1.77         Buffer& out,
443                             const String& messageId);
444                             static void _appendMessageElementEnd(
445                             Buffer& out);
446 kumpf          1.28 
447 mike           1.75     static void _appendSimpleReqElementBegin(Buffer& out);
448                         static void _appendSimpleReqElementEnd(Buffer& out);
449 kumpf          1.28 
450                         static void _appendMethodCallElementBegin(
451 david.dillard  1.77         Buffer& out,
452                             const CIMName& name);
453                     
454 kumpf          1.28     static void _appendMethodCallElementEnd(
455 david.dillard  1.77         Buffer& out);
456 kumpf          1.28 
457                         static void _appendIMethodCallElementBegin(
458 david.dillard  1.77         Buffer& out,
459                             const CIMName& name);
460                             static void _appendIMethodCallElementEnd(
461                             Buffer& out);
462 kumpf          1.28 
463                         static void _appendIParamValueElementBegin(
464 david.dillard  1.77         Buffer& out,
465                             const char* name);
466                             static void _appendIParamValueElementEnd(
467                             Buffer& out);
468 kumpf          1.28 
469 mike           1.75     static void _appendSimpleRspElementBegin(Buffer& out);
470                         static void _appendSimpleRspElementEnd(Buffer& out);
471 kumpf          1.28 
472                         static void _appendMethodResponseElementBegin(
473 david.dillard  1.77         Buffer& out,
474                             const CIMName& name);
475                             static void _appendMethodResponseElementEnd(
476                             Buffer& out);
477 kumpf          1.28 
478                         static void _appendIMethodResponseElementBegin(
479 david.dillard  1.77         Buffer& out,
480                             const CIMName& name);
481                             static void _appendIMethodResponseElementEnd(
482                             Buffer& out);
483 kumpf          1.28 
484                         static void _appendErrorElement(
485 david.dillard  1.77         Buffer& out,
486                             const CIMException& cimException);
487 kumpf          1.28 
488 mike           1.75     static void _appendIReturnValueElementBegin(Buffer& out);
489                         static void _appendIReturnValueElementEnd(Buffer& out);
490 kumpf          1.28 
491 mike           1.75     static void _appendSimpleExportReqElementBegin(Buffer& out);
492                         static void _appendSimpleExportReqElementEnd(Buffer& out);
493 kumpf          1.28 
494                         static void _appendEMethodCallElementBegin(
495 david.dillard  1.77         Buffer& out,
496                             const CIMName& name);
497                     
498 kumpf          1.28     static void _appendEMethodCallElementEnd(
499 david.dillard  1.77         Buffer& out);
500 kumpf          1.61 
501                         static void _appendEParamValueElementBegin(
502 david.dillard  1.77         Buffer& out,
503                             const char* name);
504                             static void _appendEParamValueElementEnd(
505                             Buffer& out);
506 kumpf          1.28 
507 mike           1.75     static void _appendSimpleExportRspElementBegin(Buffer& out);
508                         static void _appendSimpleExportRspElementEnd(Buffer& out);
509 kumpf          1.28 
510                         static void _appendEMethodResponseElementBegin(
511 david.dillard  1.77         Buffer& out,
512                             const CIMName& name);
513                     
514 kumpf          1.28     static void _appendEMethodResponseElementEnd(
515 david.dillard  1.77         Buffer& out);
516 mike           1.21 
517 kumpf          1.85     XmlWriter();
518 mike           1.21 };
519                     
520 thilo.boehm    1.92 //==============================================================================
521                     //
522                     // _toString() routines:
523                     //
524                     //==============================================================================
525                     
526                     inline void _toString(Buffer& out, Boolean x)
527                     {
528                         XmlWriter::append(out, x);
529                     }
530                     
531                     inline void _toString(Buffer& out, Uint8 x)
532                     {
533                         XmlWriter::append(out, Uint32(x));
534                     }
535                     
536                     inline void _toString(Buffer& out, Sint8 x)
537                     {
538                         XmlWriter::append(out, Sint32(x));
539                     }
540                     
541 thilo.boehm    1.92 inline void _toString(Buffer& out, Uint16 x)
542                     {
543                         XmlWriter::append(out, Uint32(x));
544                     }
545                     
546                     inline void _toString(Buffer& out, Sint16 x)
547                     {
548                         XmlWriter::append(out, Sint32(x));
549                     }
550                     
551                     inline void _toString(Buffer& out, Uint32 x)
552                     {
553                         XmlWriter::append(out, x);
554                     }
555                     
556                     inline void _toString(Buffer& out, Sint32 x)
557                     {
558                         XmlWriter::append(out, x);
559                     }
560                     
561                     inline void _toString(Buffer& out, Uint64 x)
562 thilo.boehm    1.92 {
563                         XmlWriter::append(out, x);
564                     }
565                     
566                     inline void _toString(Buffer& out, Sint64 x)
567                     {
568                         XmlWriter::append(out, x);
569                     }
570                     
571                     inline void _toString(Buffer& out, Real32 x)
572                     {
573                         XmlWriter::append(out, Real64(x));
574                     }
575                     
576                     inline void _toString(Buffer& out, Real64 x)
577                     {
578                         XmlWriter::append(out, x);
579                     }
580                     
581                     inline void _toString(Buffer& out, Char16 x)
582                     {
583 thilo.boehm    1.92     // We need to convert the Char16 to UTF8 then append the UTF8
584                         // character into the array.
585                         // NOTE: The UTF8 character could be several bytes long.
586                         // WARNING: This function will put in replacement character for
587                         // all characters that have surogate pairs.
588                     
589                         char str[6];
590                         memset(str,0x00,sizeof(str));
591                         char* charIN = (char *)&x;
592                     
593                         const Uint16 *strsrc = (Uint16 *)charIN;
594                         Uint16 *endsrc = (Uint16 *)&charIN[1];
595                     
596                         Uint8 *strtgt = (Uint8 *)str;
597                         Uint8 *endtgt = (Uint8 *)&str[5];
598                     
599                         UTF16toUTF8(&strsrc, endsrc, &strtgt, endtgt);
600                         out.append(str, UTF_8_COUNT_TRAIL_BYTES(str[0]) +1);
601                     }
602                     
603                     inline void _toString(Buffer& out, const String& x)
604 thilo.boehm    1.92 {
605                         out << x;
606                     }
607                     
608                     inline void _toString(Buffer& out, const CIMDateTime& x)
609                     {
610                         out << x.toString();
611                     }
612                     
613                     inline void _toString(Buffer& out, const CIMObjectPath& x)
614                     {
615                         out << x.toString();
616                     }
617                     
618                     inline void _toString(Buffer& out, const CIMObject& x)
619                     {
620                         out << x.toString();
621                     }
622                     inline void _toString(Buffer& out, const CIMInstance& x)
623                     {
624                         out << CIMObject(x).toString();
625 thilo.boehm    1.92 }
626                     
627                     template<class T>
628                     void _toString(Buffer& out, const T* p, Uint32 size)
629                     {
630                         while (size--)
631                         {
632                             _toString(out, *p++);
633                             out.append(' ');
634                         }
635                     }
636 kumpf          1.54 
637 mike           1.21 PEGASUS_NAMESPACE_END
638                     
639                     #endif /* Pegasus_XmlWriter_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2