(file) Return to XmlWriter.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: XmlWriter.h,v $
 26 mike  1.8 // Revision 1.7  2001/02/20 07:25:57  mike
 27           // Added basic create-instance in repository and in client.
 28           //
 29 mike  1.7 // Revision 1.6  2001/02/19 01:47:17  mike
 30           // Renamed names of the form CIMConst to ConstCIM.
 31           //
 32 mike  1.6 // Revision 1.5  2001/02/18 03:56:01  mike
 33           // Changed more class names (e.g., ConstClassDecl -> ConstCIMClass)
 34           //
 35 mike  1.5 // Revision 1.4  2001/02/16 02:06:07  mike
 36           // Renamed many classes and headers.
 37           //
 38 mike  1.4 // Revision 1.3  2001/01/31 08:20:51  mike
 39           // Added dispatcher framework.
 40           // Added enumerateInstanceNames.
 41           //
 42 mike  1.3 // Revision 1.2  2001/01/29 02:23:44  mike
 43           // Added support for GetInstance operation
 44           //
 45 mike  1.2 // Revision 1.1.1.1  2001/01/14 19:53:36  mike
 46           // Pegasus import
 47           //
 48 mike  1.1 //
 49           //END_HISTORY
 50           
 51           ////////////////////////////////////////////////////////////////////////////////
 52           //
 53           // XmlWriter.h
 54           //
 55           ////////////////////////////////////////////////////////////////////////////////
 56           
 57           #ifndef Pegasus_XmlWriter_h
 58           #define Pegasus_XmlWriter_h
 59           
 60           #include <iostream>
 61           #include <Pegasus/Common/Config.h>
 62           #include <Pegasus/Common/Exception.h>
 63           #include <Pegasus/Common/Array.h>
 64           #include <Pegasus/Common/String.h>
 65           #include <Pegasus/Common/Indentor.h>
 66 mike  1.4 #include <Pegasus/Common/CIMReference.h>
 67 mike  1.1 
 68           PEGASUS_NAMESPACE_BEGIN
 69           
 70 mike  1.5 class CIMConstQualifierDecl;
 71 mike  1.6 class ConstCIMClass;
 72 mike  1.7 class ConstCIMInstance;
 73 mike  1.1 
 74           class PEGASUS_COMMON_LINKAGE XmlWriter
 75           {
 76           public:
 77           
 78               static void append(Array<Sint8>& out, Char16 x);
 79           
 80               static void append(Array<Sint8>& out, char x)
 81               {
 82           	append(out, Char16(x));
 83               }
 84           
 85               static void append(Array<Sint8>& out, const char* x);
 86           
 87               static void append(Array<Sint8>& out, const String& x);
 88           
 89               static void append(Array<Sint8>& out, Uint32 x);
 90           
 91               static void appendSpecial(Array<Sint8>& out, Char16 x);
 92           
 93               static void appendSpecial(Array<Sint8>& out, char x);
 94 mike  1.1 
 95               static void appendSpecial(Array<Sint8>& out, const char* x);
 96           
 97               static void appendSpecial(Array<Sint8>& out, const String& x);
 98           
 99               static void append(Array<Sint8>& out, const Indentor& x);
100           
101               static void appendLocalNameSpaceElement(
102           	Array<Sint8>& out, 
103           	const String& nameSpace);
104           
105               static void appendNameSpaceElement(
106           	Array<Sint8>& out, 
107           	const String& nameSpace);
108           
109               static Array<Sint8> formatGetHeader(
110           	const char* documentPath);
111           
112               static Array<Sint8> formatMPostHeader(
113           	const char* host,
114           	const char* cimOperation,
115 mike  1.1 	const char* cimMethod,
116           	const String& cimObject,
117           	const Array<Sint8>& content);
118           
119               static Array<Sint8> formatMethodResponseHeader(
120           	const Array<Sint8>& content);
121           
122               static Array<Sint8> formatMessageElement(
123           	Uint32 messageId,
124           	const Array<Sint8>& body);
125           
126               static Array<Sint8> formatSimpleReqElement(
127           	const Array<Sint8>& body);
128           
129               static Array<Sint8> formatSimpleRspElement(
130           	const Array<Sint8>& body);
131           
132               static Array<Sint8> formatIMethodCallElement(
133           	const char* name,
134           	const String& nameSpace,
135           	const Array<Sint8>& iParamValues);
136 mike  1.1 
137               static Array<Sint8> formatIReturnValueElement(
138           	const Array<Sint8>& body);
139           
140               static Array<Sint8> formatIMethodResponseElement(
141           	const char* name,
142           	const Array<Sint8>& iParamValues);
143           
144               static Array<Sint8>& formatIParamValueElement(
145           	Array<Sint8>& out,
146           	const char* name,
147           	const Array<Sint8>& body);
148           
149               static Array<Sint8> formatErrorElement(
150 mike  1.8 	CIMException::Code code,
151 mike  1.1 	const char* description);
152           
153               static Array<Sint8>& appendBooleanParameter(
154           	Array<Sint8>& out,
155           	const char* parameterName,
156           	Boolean flag);
157           
158               static Array<Sint8>& appendClassNameParameter(
159           	Array<Sint8>& out,
160           	const char* parameterName,
161           	const String& className);
162           
163               static Array<Sint8>& appendQualifierNameParameter(
164           	Array<Sint8>& out,
165           	const char* parameterName,
166           	const String& qualifierName);
167           
168               static Array<Sint8>& appendClassParameter(
169           	Array<Sint8>& out,
170           	const char* parameterName,
171 mike  1.6 	const ConstCIMClass& cimClass);
172 mike  1.2 
173               static Array<Sint8>& appendInstanceNameParameter(
174           	Array<Sint8>& out,
175           	const char* parameterName,
176 mike  1.4 	const CIMReference& instanceName);
177 mike  1.7 
178               static Array<Sint8>& appendInstanceParameter(
179           	Array<Sint8>& out,
180           	const char* parameterName,
181           	const ConstCIMInstance& instance);
182 mike  1.1 
183               static Array<Sint8>& appendQualifierDeclarationParameter(
184           	Array<Sint8>& out,
185           	const char* parameterName,
186 mike  1.5 	const CIMConstQualifierDecl& qualifierDecl);
187 mike  1.1 
188               static Array<Sint8>& appendClassNameElement(
189           	Array<Sint8>& out,
190           	const String& className);
191 mike  1.3 
192               static Array<Sint8>& appendInstanceNameElement(
193           	Array<Sint8>& out,
194 mike  1.4 	const CIMReference& instanceName);
195 mike  1.1 
196               static void indentedPrint(
197           	std::ostream& os,
198           	const char* text, 
199           	Uint32 indentChars = 2);
200           
201               static Array<Sint8> formatSimpleReqMessage(
202           	const char* host,
203           	const String& nameSpace,
204           	const char* iMethodName,
205           	const Array<Sint8>& body);
206           
207               static Array<Sint8> formatSimpleRspMessage(
208           	const char* iMethodName,
209           	const Array<Sint8>& body);
210           
211               static Uint32 getNextMessageId();
212           
213           private:
214           
215               XmlWriter() { }
216 mike  1.1 };
217           
218           inline Array<Sint8>& operator<<(Array<Sint8>& out, const char* x)
219           {
220               XmlWriter::append(out, x);
221               return out;
222           }
223           
224           inline Array<Sint8>& operator<<(Array<Sint8>& out, char x)
225           {
226               XmlWriter::append(out, x);
227               return out;
228           }
229           
230           inline Array<Sint8>& operator<<(Array<Sint8>& out, Char16 x)
231           {
232               XmlWriter::append(out, x);
233               return out;
234           }
235           
236           inline Array<Sint8>& operator<<(Array<Sint8>& out, const String& x)
237 mike  1.1 {
238               XmlWriter::append(out, x);
239               return out;
240           }
241           
242           inline Array<Sint8>& operator<<(Array<Sint8>& out, const Indentor& x)
243           {
244               XmlWriter::append(out, x);
245               return out;
246           }
247           
248           inline Array<Sint8>& operator<<(Array<Sint8>& out, const Array<Sint8>& x)
249           {
250               out.appendArray(x);
251               return out;
252           }
253           
254           inline Array<Sint8>& operator<<(Array<Sint8>& out, Uint32 x)
255           {
256               XmlWriter::append(out, x);
257               return out;
258 mike  1.1 }
259           
260           PEGASUS_NAMESPACE_END
261           
262           #endif /* Pegasus_XmlWriter_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2