1 martin 1.41 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.42 //
|
3 martin 1.41 // 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.42 //
|
10 martin 1.41 // 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.42 //
|
17 martin 1.41 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.42 //
|
20 martin 1.41 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.42 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.41 // 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.42 //
|
28 martin 1.41 //////////////////////////////////////////////////////////////////////////
|
29 mike 1.11 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef Pegasus_Name_h
33 #define Pegasus_Name_h
34
35 #include <Pegasus/Common/Config.h>
|
36 kumpf 1.17 #include <Pegasus/Common/Linkage.h>
|
37 mike 1.11 #include <Pegasus/Common/String.h>
|
38 kumpf 1.17 #include <Pegasus/Common/Array.h>
39 #include <Pegasus/Common/Exception.h>
|
40 mike 1.11
41 PEGASUS_NAMESPACE_BEGIN
42
|
43 kumpf 1.17 ////////////////////////////////////////////////////////////////////////////////
44 //
45 // CIMName
46 //
47 ////////////////////////////////////////////////////////////////////////////////
48
|
49 mike 1.11 /**
|
50 kumpf 1.38 The CIMName class represents the DMTF standard CIM name definition.
51 The names of CIM classes, properties, qualifiers, and methods are all
52 CIM names.
53
54 <p>A CIM name must contain characters only from this set:
|
55 karl 1.23 <ul>
|
56 kumpf 1.38 <li>alphabetic (a-z and A-Z)
57 <li>numeric (0-9)
58 <li>underscore (_)
59 <li>UCS-2 characters in the range 0x0080 to 0xFFEF
|
60 karl 1.23 </ul>
|
61 kumpf 1.38 The first character of a CIM name may not be numeric.
62 A CIMName may be null, meaning that it has no value.
|
63 mike 1.11 */
64 class PEGASUS_COMMON_LINKAGE CIMName
65 {
66 public:
67
|
68 david.dillard 1.32 /**
|
69 kumpf 1.38 Constructs a null CIMName.
|
70 karl 1.23 */
|
71 kumpf 1.17 CIMName();
|
72 karl 1.23
|
73 david.dillard 1.32 /**
|
74 kumpf 1.38 Constructs a non-null CIMName with the specified name.
75 @param name A String containing the CIM name.
76 @exception InvalidNameException If the String does not contain a
77 valid CIM name.
|
78 karl 1.23 */
|
79 kumpf 1.17 CIMName(const String& name);
|
80 david.dillard 1.32
|
81 karl 1.23 /**
|
82 kumpf 1.38 Constructs a non-null CIMName with the specified name.
83 @param name A character string containing the CIM name.
84 @exception InvalidNameException If the character string does not
85 contain a valid CIM name.
|
86 thilo.boehm 1.39 @exception All exceptions thrown by String(const char* str) can be
87 thrown here
|
88 david.dillard 1.32 */
|
89 kumpf 1.17 CIMName(const char* name);
90
|
91 david.dillard 1.32 /**
|
92 kumpf 1.38 Assigns the value of the specified CIMName object to this object.
93 @param name The CIMName object from which to assign this
94 CIMName object.
|
95 david.dillard 1.32 */
|
96 kumpf 1.17 CIMName& operator=(const CIMName& name);
|
97 david.dillard 1.32
98 /**
|
99 kumpf 1.38 Sets the CIMName with a String name. The resulting CIMName object
100 is non-null.
101 <p><b>Example:</b>
|
102 david.dillard 1.32 <pre>
103 CIMName n;
104 String type = "type";
105 n = type;
106 </pre>
|
107 kumpf 1.38 @param name A String containing the CIM name to set.
108 @return A reference to this CIMName object.
109 @exception InvalidNameException If the String does not contain a
110 valid CIM name.
|
111 david.dillard 1.32 */
|
112 kumpf 1.17 CIMName& operator=(const String& name);
|
113 kumpf 1.20
|
114 david.dillard 1.32 /**
|
115 kumpf 1.38 Gets a String form of the CIM name.
116 <p><b>Example:</b>
|
117 david.dillard 1.32 <pre>
118 CIMName n("name");
119 String s = n.getString();
120 </pre>
|
121 kumpf 1.38 @return A reference to a String containing the CIM name.
|
122 david.dillard 1.32 */
|
123 kumpf 1.20 const String& getString() const;
|
124 kumpf 1.17
|
125 david.dillard 1.32 /**
|
126 kumpf 1.38 Determines whether the CIM name is null.
127 <p><b>Example:</b>
|
128 david.dillard 1.32 <pre>
129 CIMName n;
|
130 jim.wunderlich 1.36 assert(n.isNull());
|
131 david.dillard 1.32 n = "name";
|
132 jim.wunderlich 1.36 assert(!n.isNull());
|
133 david.dillard 1.32 </pre>
|
134 kumpf 1.38 @return True if the CIM name is null, false otherwise.
|
135 david.dillard 1.32 */
|
136 kumpf 1.17 Boolean isNull() const;
137
|
138 david.dillard 1.32 /**
|
139 kumpf 1.38 Sets the CIM name to a null value.
140 <p><b>Example:</b>
|
141 david.dillard 1.32 <pre>
|
142 r.kieninger 1.34 CIMName n("name");
|
143 david.dillard 1.32 n.clear();
|
144 jim.wunderlich 1.36 assert(n.isNull());
|
145 david.dillard 1.32 </pre>
146 */
|
147 kumpf 1.17 void clear();
148
|
149 david.dillard 1.32 /**
|
150 kumpf 1.38 Compares the CIMName with a specified CIMName. Comparisons of
151 CIM names are case-insensitive.
152 <p><b>Example:</b>
153 <pre>
154 CIMName n1("name");
155 CIMName n2("Name");
156 assert(n1.equal(n2));
|
157 david.dillard 1.32 </pre>
|
158 kumpf 1.38 @param name The CIMName to be compared.
159 @return True if this name is equivalent to the specified name,
160 false otherwise.
|
161 kumpf 1.17 */
162 Boolean equal(const CIMName& name) const;
163
|
164 david.dillard 1.32 /**
|
165 kumpf 1.38 Determines whether a name is a valid CIM name.
166 <p><b>Example:</b>
|
167 david.dillard 1.32 <pre>
|
168 jim.wunderlich 1.36 assert(CIMName::legal("name"));
169 assert(!CIMName::legal("3types"));
|
170 david.dillard 1.32 </pre>
|
171 kumpf 1.38 @param name A String containing the name to test.
172 @return True if the specified name is a valid CIM name,
173 false otherwise.
|
174 mike 1.11 */
|
175 kumpf 1.21 static Boolean legal(const String& name);
|
176 mike 1.11
|
177 r.kieninger 1.34 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
178
|
179 kumpf 1.38 /**
180 Compares the CIMName with a specified character string. Comparisons of
181 CIM names are case-insensitive.
182 @param name The name to be compared.
183 @return True if this name is equivalent to the specified name,
184 false otherwise.
185 */
|
186 r.kieninger 1.34 Boolean equal(const char* name) const;
187
|
188 kumpf 1.38 /**
189 Sets the CIMName with a character string name. The resulting CIMName
190 object is non-null.
191 @param name A character string containing the CIM name to set.
192 @return A reference to this CIMName object.
193 @exception InvalidNameException If the character string does not
194 contain a valid CIM name.
|
195 thilo.boehm 1.39 @exception All exceptions thrown by String(const char* str) can be
196 thrown here
|
197 kumpf 1.38 */
|
198 r.kieninger 1.34 CIMName& operator=(const char* name);
199
200 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
201
|
202 mike 1.11 private:
|
203 kumpf 1.17 String cimName;
204 };
205
|
206 david.dillard 1.32 /**
|
207 kumpf 1.38 Compares two CIM names for equality.
208 <p><b>Example:</b>
209 <pre>
210 CIMName lowerCaseName("this_is_a_name");
211 CIMName upperCaseName("THIS_IS_A_NAME");
212 assert(lowerCaseName == upperCaseName);
213 </pre>
214 @param x The first CIMName to be compared.
215 @param y The second CIMName to be compared.
216 @return True if the CIM names are equivalent, false otherwise.
217 */
|
218 kumpf 1.18 PEGASUS_COMMON_LINKAGE Boolean operator==(
219 const CIMName& name1,
220 const CIMName& name2);
|
221 kumpf 1.17
|
222 david.dillard 1.32 /**
|
223 kumpf 1.38 Compares two CIM names for inequality.
224 @param x The first CIMName to be compared.
225 @param y The second CIMName to be compared.
226 @return False if the CIM names are equivalent, true otherwise.
227 */
|
228 david.dillard 1.31 PEGASUS_COMMON_LINKAGE Boolean operator!=(
229 const CIMName& name1,
230 const CIMName& name2);
231
|
232 kumpf 1.17 #define PEGASUS_ARRAY_T CIMName
233 # include "ArrayInter.h"
234 #undef PEGASUS_ARRAY_T
235
236
237 ////////////////////////////////////////////////////////////////////////////////
238 //
239 // CIMNamespaceName
240 //
241 ////////////////////////////////////////////////////////////////////////////////
242
243 /**
|
244 kumpf 1.38 The CIMNamespaceName class represents the DMTF standard CIM namespace
245 name definition.
246
247 <p>A CIM namespace name must match the following expression:
248 <pre>
|
249 karl 1.24 <CIMName>[ / <CIMName> ]*
|
250 kumpf 1.38 </pre>
251 A namespace name with a leading '/' character is accepted, but the
252 leading character is removed.
253 A CIMNamespaceName may be null, meaning that it has no value.
|
254 kumpf 1.17 */
255 class PEGASUS_COMMON_LINKAGE CIMNamespaceName
256 {
257 public:
258
|
259 kumpf 1.38 /**
260 Constructs a null CIMName.
261 */
|
262 kumpf 1.17 CIMNamespaceName();
|
263 karl 1.23
|
264 kumpf 1.38 /**
265 Constructs a non-null CIMNamespaceName with the specified name.
266 @param name A String containing the CIM namespace name.
267 @exception InvalidNameException If the String does not contain a
268 valid CIM namespace name.
269 */
|
270 kumpf 1.17 CIMNamespaceName(const String& name);
|
271 karl 1.23
|
272 kumpf 1.38 /**
273 Constructs a non-null CIMNamespaceName with the specified name.
274 @param name A character string containing the CIM namespace name.
275 @exception InvalidNameException If the character string does not
276 contain a valid CIM namespace name.
|
277 thilo.boehm 1.39 @exception All exceptions thrown by String(const char* str) can be
278 thrown here
|
279 kumpf 1.38 */
|
280 kumpf 1.17 CIMNamespaceName(const char* name);
281
|
282 kumpf 1.38 /**
283 Assigns the value of the specified CIMNamespaceName object to this
284 object.
285 @param name The CIMNamespaceName object from which to assign this
286 CIMNamespaceName object.
287 */
|
288 kumpf 1.17 CIMNamespaceName& operator=(const CIMNamespaceName& name);
|
289 karl 1.23
|
290 kumpf 1.38 /**
291 Sets the CIMNamespaceName with a String name. The resulting
292 CIMNamespaceName object is non-null.
293 <p><b>Example:</b>
294 <pre>
295 CIMNamespaceName n;
296 String name = "root/cimv2";
297 n = name;
298 </pre>
299 @param name A String containing the CIM namespace name to set.
300 @return A reference to this CIMNamespaceName object.
301 @exception InvalidNameException If the String does not contain a
302 valid CIM namespace name.
303 */
|
304 kumpf 1.17 CIMNamespaceName& operator=(const String& name);
|
305 kumpf 1.20
|
306 kumpf 1.38 /**
307 Gets a String form of the CIM namespace name.
308 <p><b>Example:</b>
309 <pre>
310 CIMNamespaceName n("test/ns1");
311 String s = n.getString();
312 </pre>
313 @return A reference to a String containing the CIM namespace name.
314 */
|
315 kumpf 1.20 const String& getString() const;
|
316 kumpf 1.17
|
317 kumpf 1.38 /**
318 Determines whether the CIM namespace name is null.
319 <p><b>Example:</b>
320 <pre>
321 CIMNamespaceName n;
322 assert(n.isNull());
323 n = "root/test";
324 assert(!n.isNull());
325 </pre>
326 @return True if the CIM namespace name is null, false otherwise.
327 */
|
328 kumpf 1.17 Boolean isNull() const;
329
|
330 kumpf 1.38 /**
331 Sets the CIM namespace name to a null value.
332 <p><b>Example:</b>
333 <pre>
334 CIMNamespaceName n("root/test");
335 n.clear();
336 assert(n.isNull());
337 </pre>
338 */
|
339 kumpf 1.17 void clear();
340
|
341 kumpf 1.38 /**
342 Compares the CIMNamespaceName with a specified CIMNamespaceName.
343 Comparisons of CIM namespace names are case-insensitive.
344 <p><b>Example:</b>
345 <pre>
346 CIMNamespaceName n1("root/cimv2");
347 CIMNamespaceName n2("Root/CimV2");
348 assert(n1.equal(n2));
349 </pre>
350 @param name The CIMNamespaceName to be compared.
351 @return True if this name is equivalent to the specified name,
352 false otherwise.
|
353 kumpf 1.17 */
354 Boolean equal(const CIMNamespaceName& name) const;
|
355 mike 1.11
|
356 kumpf 1.38 /**
357 Determines whether a name is a valid CIM namespace name.
358 <p><b>Example:</b>
|
359 david.dillard 1.32 <pre>
|
360 kumpf 1.38 assert(CIMNamespaceName::legal("root/test"));
361 assert(!CIMNamespaceName::legal("Wrong!"));
|
362 david.dillard 1.32 </pre>
|
363 kumpf 1.38 @param name A String containing the name to test.
364 @return True if the specified name is a valid CIM namespace name,
365 false otherwise.
|
366 kumpf 1.17 */
|
367 kumpf 1.21 static Boolean legal(const String& name);
|
368 kumpf 1.17
|
369 r.kieninger 1.34 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
370
|
371 kumpf 1.38 /**
372 Compares the CIMNamespaceName with a specified character string.
373 Comparisons of CIM namespace names are case-insensitive.
374 @param name The name to be compared.
375 @return True if this name is equivalent to the specified name,
376 false otherwise.
377 */
|
378 r.kieninger 1.34 Boolean equal(const char* name) const;
379
|
380 kumpf 1.38 /**
381 Sets the CIMNamespaceName with a character string name. The
382 resulting CIMNamespaceName object is non-null.
383 @param name A character string containing the CIM namespace name
384 to set.
385 @return A reference to this CIMNamespaceName object.
386 @exception InvalidNameException If the character string does not
387 contain a valid CIM namespace name.
|
388 thilo.boehm 1.39 @exception All exceptions thrown by String(const char* str) can be
389 thrown here
|
390 kumpf 1.38 */
|
391 r.kieninger 1.34 CIMNamespaceName& operator=(const char* name);
392
393 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
394
|
395 kumpf 1.17 private:
396 String cimNamespaceName;
|
397 mike 1.11 };
|
398 kumpf 1.20
|
399 kumpf 1.38 /**
400 Compares two CIM namespace names for equality.
401 <p><b>Example:</b>
402 <pre>
403 CIMNamespaceName n1("root/test");
404 CIMNamespaceName n2("Root/TEST");
405 assert(n1 == n2);
406 </pre>
407 @param x The first CIMNamespaceName to be compared.
408 @param y The second CIMNamespaceName to be compared.
409 @return True if the CIM namespace names are equivalent, false otherwise.
410 */
|
411 kumpf 1.20 PEGASUS_COMMON_LINKAGE Boolean operator==(
412 const CIMNamespaceName& name1,
413 const CIMNamespaceName& name2);
414
|
415 kumpf 1.38 /**
416 Compares two CIM namespace names for inequality.
417 @param x The first CIMNamespaceName to be compared.
418 @param y The second CIMNamespaceName to be compared.
419 @return False if the CIM namespace names are equivalent, true otherwise.
420 */
|
421 david.dillard 1.31 PEGASUS_COMMON_LINKAGE Boolean operator!=(
422 const CIMNamespaceName& name1,
423 const CIMNamespaceName& name2);
424
|
425 kumpf 1.20 #define PEGASUS_ARRAY_T CIMNamespaceName
426 # include "ArrayInter.h"
427 #undef PEGASUS_ARRAY_T
|
428 mike 1.11
429 PEGASUS_NAMESPACE_END
430
|
431 r.kieninger 1.34 #ifdef PEGASUS_INTERNALONLY
432 # include "CIMNameInline.h"
433 #endif
434
|
435 mike 1.11 #endif /* Pegasus_Name_h */
|