1 karl 1.37 //%2006////////////////////////////////////////////////////////////////////////
|
2 mike 1.11 //
|
3 karl 1.29 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
|
6 karl 1.25 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.29 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
|
9 karl 1.30 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.37 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 mike 1.11 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
|
15 kumpf 1.13 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
18 mike 1.11 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
20 //
|
21 kumpf 1.13 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
22 mike 1.11 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
|
24 kumpf 1.13 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
27 mike 1.11 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 //%/////////////////////////////////////////////////////////////////////////////
33
34 #ifndef Pegasus_Name_h
35 #define Pegasus_Name_h
36
37 #include <Pegasus/Common/Config.h>
|
38 kumpf 1.17 #include <Pegasus/Common/Linkage.h>
|
39 mike 1.11 #include <Pegasus/Common/String.h>
|
40 kumpf 1.17 #include <Pegasus/Common/Array.h>
41 #include <Pegasus/Common/Exception.h>
|
42 mike 1.11
43 PEGASUS_NAMESPACE_BEGIN
44
|
45 kumpf 1.17 ////////////////////////////////////////////////////////////////////////////////
46 //
47 // CIMName
48 //
49 ////////////////////////////////////////////////////////////////////////////////
50
|
51 mike 1.11 /**
|
52 kumpf 1.38 The CIMName class represents the DMTF standard CIM name definition.
53 The names of CIM classes, properties, qualifiers, and methods are all
54 CIM names.
55
56 <p>A CIM name must contain characters only from this set:
|
57 karl 1.23 <ul>
|
58 kumpf 1.38 <li>alphabetic (a-z and A-Z)
59 <li>numeric (0-9)
60 <li>underscore (_)
61 <li>UCS-2 characters in the range 0x0080 to 0xFFEF
|
62 karl 1.23 </ul>
|
63 kumpf 1.38 The first character of a CIM name may not be numeric.
64 A CIMName may be null, meaning that it has no value.
|
65 mike 1.11 */
66 class PEGASUS_COMMON_LINKAGE CIMName
67 {
68 public:
69
|
70 david.dillard 1.32 /**
|
71 kumpf 1.38 Constructs a null CIMName.
|
72 karl 1.23 */
|
73 kumpf 1.17 CIMName();
|
74 karl 1.23
|
75 david.dillard 1.32 /**
|
76 kumpf 1.38 Constructs a non-null CIMName with the specified name.
77 @param name A String containing the CIM name.
78 @exception InvalidNameException If the String does not contain a
79 valid CIM name.
|
80 karl 1.23 */
|
81 kumpf 1.17 CIMName(const String& name);
|
82 david.dillard 1.32
|
83 karl 1.23 /**
|
84 kumpf 1.38 Constructs a non-null CIMName with the specified name.
85 @param name A character string containing the CIM name.
86 @exception InvalidNameException If the character string does not
87 contain a valid CIM name.
|
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 */
|
196 r.kieninger 1.34 CIMName& operator=(const char* name);
197
198 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
199
|
200 mike 1.11 private:
|
201 kumpf 1.17 String cimName;
|
202 r.kieninger 1.34 friend class CIMNameUnchecked;
|
203 kumpf 1.17 };
204
|
205 david.dillard 1.32 /**
|
206 kumpf 1.38 Compares two CIM names for equality.
207 <p><b>Example:</b>
208 <pre>
209 CIMName lowerCaseName("this_is_a_name");
210 CIMName upperCaseName("THIS_IS_A_NAME");
211 assert(lowerCaseName == upperCaseName);
212 </pre>
213 @param x The first CIMName to be compared.
214 @param y The second CIMName to be compared.
215 @return True if the CIM names are equivalent, false otherwise.
216 */
|
217 kumpf 1.18 PEGASUS_COMMON_LINKAGE Boolean operator==(
218 const CIMName& name1,
219 const CIMName& name2);
|
220 kumpf 1.17
|
221 david.dillard 1.32 /**
|
222 kumpf 1.38 Compares two CIM names for inequality.
223 @param x The first CIMName to be compared.
224 @param y The second CIMName to be compared.
225 @return False if the CIM names are equivalent, true otherwise.
226 */
|
227 david.dillard 1.31 PEGASUS_COMMON_LINKAGE Boolean operator!=(
228 const CIMName& name1,
229 const CIMName& name2);
230
|
231 kumpf 1.17 #define PEGASUS_ARRAY_T CIMName
232 # include "ArrayInter.h"
233 #undef PEGASUS_ARRAY_T
234
235
236 ////////////////////////////////////////////////////////////////////////////////
237 //
238 // CIMNamespaceName
239 //
240 ////////////////////////////////////////////////////////////////////////////////
241
242 /**
|
243 kumpf 1.38 The CIMNamespaceName class represents the DMTF standard CIM namespace
244 name definition.
245
246 <p>A CIM namespace name must match the following expression:
247 <pre>
|
248 karl 1.24 <CIMName>[ / <CIMName> ]*
|
249 kumpf 1.38 </pre>
250 A namespace name with a leading '/' character is accepted, but the
251 leading character is removed.
252 A CIMNamespaceName may be null, meaning that it has no value.
|
253 kumpf 1.17 */
254 class PEGASUS_COMMON_LINKAGE CIMNamespaceName
255 {
256 public:
257
|
258 kumpf 1.38 /**
259 Constructs a null CIMName.
260 */
|
261 kumpf 1.17 CIMNamespaceName();
|
262 karl 1.23
|
263 kumpf 1.38 /**
264 Constructs a non-null CIMNamespaceName with the specified name.
265 @param name A String containing the CIM namespace name.
266 @exception InvalidNameException If the String does not contain a
267 valid CIM namespace name.
268 */
|
269 kumpf 1.17 CIMNamespaceName(const String& name);
|
270 karl 1.23
|
271 kumpf 1.38 /**
272 Constructs a non-null CIMNamespaceName with the specified name.
273 @param name A character string containing the CIM namespace name.
274 @exception InvalidNameException If the character string does not
275 contain a valid CIM namespace name.
276 */
|
277 kumpf 1.17 CIMNamespaceName(const char* name);
278
|
279 kumpf 1.38 /**
280 Assigns the value of the specified CIMNamespaceName object to this
281 object.
282 @param name The CIMNamespaceName object from which to assign this
283 CIMNamespaceName object.
284 */
|
285 kumpf 1.17 CIMNamespaceName& operator=(const CIMNamespaceName& name);
|
286 karl 1.23
|
287 kumpf 1.38 /**
288 Sets the CIMNamespaceName with a String name. The resulting
289 CIMNamespaceName object is non-null.
290 <p><b>Example:</b>
291 <pre>
292 CIMNamespaceName n;
293 String name = "root/cimv2";
294 n = name;
295 </pre>
296 @param name A String containing the CIM namespace name to set.
297 @return A reference to this CIMNamespaceName object.
298 @exception InvalidNameException If the String does not contain a
299 valid CIM namespace name.
300 */
|
301 kumpf 1.17 CIMNamespaceName& operator=(const String& name);
|
302 kumpf 1.20
|
303 kumpf 1.38 /**
304 Gets a String form of the CIM namespace name.
305 <p><b>Example:</b>
306 <pre>
307 CIMNamespaceName n("test/ns1");
308 String s = n.getString();
309 </pre>
310 @return A reference to a String containing the CIM namespace name.
311 */
|
312 kumpf 1.20 const String& getString() const;
|
313 kumpf 1.17
|
314 kumpf 1.38 /**
315 Determines whether the CIM namespace name is null.
316 <p><b>Example:</b>
317 <pre>
318 CIMNamespaceName n;
319 assert(n.isNull());
320 n = "root/test";
321 assert(!n.isNull());
322 </pre>
323 @return True if the CIM namespace name is null, false otherwise.
324 */
|
325 kumpf 1.17 Boolean isNull() const;
326
|
327 kumpf 1.38 /**
328 Sets the CIM namespace name to a null value.
329 <p><b>Example:</b>
330 <pre>
331 CIMNamespaceName n("root/test");
332 n.clear();
333 assert(n.isNull());
334 </pre>
335 */
|
336 kumpf 1.17 void clear();
337
|
338 kumpf 1.38 /**
339 Compares the CIMNamespaceName with a specified CIMNamespaceName.
340 Comparisons of CIM namespace names are case-insensitive.
341 <p><b>Example:</b>
342 <pre>
343 CIMNamespaceName n1("root/cimv2");
344 CIMNamespaceName n2("Root/CimV2");
345 assert(n1.equal(n2));
346 </pre>
347 @param name The CIMNamespaceName to be compared.
348 @return True if this name is equivalent to the specified name,
349 false otherwise.
|
350 kumpf 1.17 */
351 Boolean equal(const CIMNamespaceName& name) const;
|
352 mike 1.11
|
353 kumpf 1.38 /**
354 Determines whether a name is a valid CIM namespace name.
355 <p><b>Example:</b>
|
356 david.dillard 1.32 <pre>
|
357 kumpf 1.38 assert(CIMNamespaceName::legal("root/test"));
358 assert(!CIMNamespaceName::legal("Wrong!"));
|
359 david.dillard 1.32 </pre>
|
360 kumpf 1.38 @param name A String containing the name to test.
361 @return True if the specified name is a valid CIM namespace name,
362 false otherwise.
|
363 kumpf 1.17 */
|
364 kumpf 1.21 static Boolean legal(const String& name);
|
365 kumpf 1.17
|
366 r.kieninger 1.34 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
367
|
368 kumpf 1.38 /**
369 Compares the CIMNamespaceName with a specified character string.
370 Comparisons of CIM namespace names are case-insensitive.
371 @param name The name to be compared.
372 @return True if this name is equivalent to the specified name,
373 false otherwise.
374 */
|
375 r.kieninger 1.34 Boolean equal(const char* name) const;
376
|
377 kumpf 1.38 /**
378 Sets the CIMNamespaceName with a character string name. The
379 resulting CIMNamespaceName object is non-null.
380 @param name A character string containing the CIM namespace name
381 to set.
382 @return A reference to this CIMNamespaceName object.
383 @exception InvalidNameException If the character string does not
384 contain a valid CIM namespace name.
385 */
|
386 r.kieninger 1.34 CIMNamespaceName& operator=(const char* name);
387
388 #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
389
|
390 kumpf 1.17 private:
391 String cimNamespaceName;
|
392 mike 1.11 };
|
393 kumpf 1.20
|
394 kumpf 1.38 /**
395 Compares two CIM namespace names for equality.
396 <p><b>Example:</b>
397 <pre>
398 CIMNamespaceName n1("root/test");
399 CIMNamespaceName n2("Root/TEST");
400 assert(n1 == n2);
401 </pre>
402 @param x The first CIMNamespaceName to be compared.
403 @param y The second CIMNamespaceName to be compared.
404 @return True if the CIM namespace names are equivalent, false otherwise.
405 */
|
406 kumpf 1.20 PEGASUS_COMMON_LINKAGE Boolean operator==(
407 const CIMNamespaceName& name1,
408 const CIMNamespaceName& name2);
409
|
410 kumpf 1.38 /**
411 Compares two CIM namespace names for inequality.
412 @param x The first CIMNamespaceName to be compared.
413 @param y The second CIMNamespaceName to be compared.
414 @return False if the CIM namespace names are equivalent, true otherwise.
415 */
|
416 david.dillard 1.31 PEGASUS_COMMON_LINKAGE Boolean operator!=(
417 const CIMNamespaceName& name1,
418 const CIMNamespaceName& name2);
419
|
420 kumpf 1.20 #define PEGASUS_ARRAY_T CIMNamespaceName
421 # include "ArrayInter.h"
422 #undef PEGASUS_ARRAY_T
|
423 mike 1.11
424 PEGASUS_NAMESPACE_END
425
|
426 r.kieninger 1.34 #ifdef PEGASUS_INTERNALONLY
427 # include "CIMNameInline.h"
428 #endif
429
|
430 mike 1.11 #endif /* Pegasus_Name_h */
|