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

  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 thilo.boehm   1.39         @exception All exceptions thrown by String(const char* str) can be
 89                                thrown here
 90 david.dillard 1.32     */
 91 kumpf         1.17     CIMName(const char* name);
 92                    
 93 david.dillard 1.32     /**
 94 kumpf         1.38         Assigns the value of the specified CIMName object to this object.
 95                            @param name The CIMName object from which to assign this
 96                                CIMName object.
 97 david.dillard 1.32     */
 98 kumpf         1.17     CIMName& operator=(const CIMName& name);
 99 david.dillard 1.32 
100                        /**
101 kumpf         1.38         Sets the CIMName with a String name.  The resulting CIMName object
102                            is non-null.
103                            <p><b>Example:</b>
104 david.dillard 1.32         <pre>
105                            CIMName n;
106                            String type = "type";
107                            n = type;
108                            </pre>
109 kumpf         1.38         @param name A String containing the CIM name to set.
110                            @return A reference to this CIMName object.
111                            @exception InvalidNameException If the String does not contain a
112                                valid CIM name.
113 david.dillard 1.32     */
114 kumpf         1.17     CIMName& operator=(const String& name);
115 kumpf         1.20 
116 david.dillard 1.32     /**
117 kumpf         1.38         Gets a String form of the CIM name.
118                            <p><b>Example:</b>
119 david.dillard 1.32         <pre>
120                            CIMName n("name");
121                            String s = n.getString();
122                            </pre>
123 kumpf         1.38         @return A reference to a String containing the CIM name.
124 david.dillard 1.32     */
125 kumpf         1.20     const String& getString() const;
126 kumpf         1.17 
127 david.dillard 1.32     /**
128 kumpf         1.38         Determines whether the CIM name is null.
129                            <p><b>Example:</b>
130 david.dillard 1.32         <pre>
131                            CIMName n;
132 jim.wunderlich 1.36         assert(n.isNull());
133 david.dillard  1.32         n = "name";
134 jim.wunderlich 1.36         assert(!n.isNull());
135 david.dillard  1.32         </pre>
136 kumpf          1.38         @return True if the CIM name is null, false otherwise.
137 david.dillard  1.32     */
138 kumpf          1.17     Boolean isNull() const;
139                     
140 david.dillard  1.32     /**
141 kumpf          1.38         Sets the CIM name to a null value.
142                             <p><b>Example:</b>
143 david.dillard  1.32         <pre>
144 r.kieninger    1.34         CIMName n("name");
145 david.dillard  1.32         n.clear();
146 jim.wunderlich 1.36         assert(n.isNull());
147 david.dillard  1.32         </pre>
148                         */
149 kumpf          1.17     void clear();
150                     
151 david.dillard  1.32     /**
152 kumpf          1.38         Compares the CIMName with a specified CIMName.  Comparisons of
153                             CIM names are case-insensitive.
154                             <p><b>Example:</b>
155                             <pre>
156                             CIMName n1("name");
157                             CIMName n2("Name");
158                             assert(n1.equal(n2));
159 david.dillard  1.32         </pre>
160 kumpf          1.38         @param name The CIMName to be compared.
161                             @return True if this name is equivalent to the specified name,
162                                 false otherwise.
163 kumpf          1.17     */
164                         Boolean equal(const CIMName& name) const;
165                     
166 david.dillard  1.32     /**
167 kumpf          1.38         Determines whether a name is a valid CIM name.
168                             <p><b>Example:</b>
169 david.dillard  1.32         <pre>
170 jim.wunderlich 1.36         assert(CIMName::legal("name"));
171                             assert(!CIMName::legal("3types"));
172 david.dillard  1.32         </pre>
173 kumpf          1.38         @param name A String containing the name to test.
174                             @return True if the specified name is a valid CIM name,
175                                 false otherwise.
176 mike           1.11     */
177 kumpf          1.21     static Boolean legal(const String& name);
178 mike           1.11 
179 r.kieninger    1.34 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
180                     
181 kumpf          1.38     /**
182                             Compares the CIMName with a specified character string.  Comparisons of
183                             CIM names are case-insensitive.
184                             @param name The name to be compared.
185                             @return True if this name is equivalent to the specified name,
186                                 false otherwise.
187                         */
188 r.kieninger    1.34     Boolean equal(const char* name) const;
189                     
190 kumpf          1.38     /**
191                             Sets the CIMName with a character string name.  The resulting CIMName
192                             object is non-null.
193                             @param name A character string containing the CIM name to set.
194                             @return A reference to this CIMName object.
195                             @exception InvalidNameException If the character string does not
196                                 contain a valid CIM name.
197 thilo.boehm    1.39         @exception All exceptions thrown by String(const char* str) can be
198                                 thrown here
199 kumpf          1.38     */
200 r.kieninger    1.34     CIMName& operator=(const char* name);
201                     
202                     #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
203                     
204 mike           1.11 private:
205 kumpf          1.17     String cimName;
206 r.kieninger    1.34     friend class CIMNameUnchecked;
207 kumpf          1.17 };
208                     
209 david.dillard  1.32 /**
210 kumpf          1.38     Compares two CIM names for equality.
211                         <p><b>Example:</b>
212                         <pre>
213                         CIMName lowerCaseName("this_is_a_name");
214                         CIMName upperCaseName("THIS_IS_A_NAME");
215                         assert(lowerCaseName == upperCaseName);
216                         </pre>
217                         @param x The first CIMName to be compared.
218                         @param y The second CIMName to be compared.
219                         @return True if the CIM names are equivalent, false otherwise.
220                     */
221 kumpf          1.18 PEGASUS_COMMON_LINKAGE Boolean operator==(
222                         const CIMName& name1,
223                         const CIMName& name2);
224 kumpf          1.17 
225 david.dillard  1.32 /**
226 kumpf          1.38     Compares two CIM names for inequality.
227                         @param x The first CIMName to be compared.
228                         @param y The second CIMName to be compared.
229                         @return False if the CIM names are equivalent, true otherwise.
230                     */
231 david.dillard  1.31 PEGASUS_COMMON_LINKAGE Boolean operator!=(
232                         const CIMName& name1,
233                         const CIMName& name2);
234                     
235 kumpf          1.17 #define PEGASUS_ARRAY_T CIMName
236                     # include "ArrayInter.h"
237                     #undef PEGASUS_ARRAY_T
238                     
239                     
240                     ////////////////////////////////////////////////////////////////////////////////
241                     //
242                     // CIMNamespaceName
243                     //
244                     ////////////////////////////////////////////////////////////////////////////////
245                     
246                     /**
247 kumpf          1.38     The CIMNamespaceName class represents the DMTF standard CIM namespace
248                         name definition.
249                     
250                         <p>A CIM namespace name must match the following expression:
251                         <pre>
252 karl           1.24         &lt;CIMName&gt;[ / &lt;CIMName&gt; ]*
253 kumpf          1.38     </pre>
254                         A namespace name with a leading '/' character is accepted, but the
255                         leading character is removed.
256                         A CIMNamespaceName may be null, meaning that it has no value.
257 kumpf          1.17 */
258                     class PEGASUS_COMMON_LINKAGE CIMNamespaceName
259                     {
260                     public:
261                     
262 kumpf          1.38     /**
263                             Constructs a null CIMName.
264                         */
265 kumpf          1.17     CIMNamespaceName();
266 karl           1.23 
267 kumpf          1.38     /**
268                             Constructs a non-null CIMNamespaceName with the specified name.
269                             @param name A String containing the CIM namespace name.
270                             @exception InvalidNameException If the String does not contain a
271                                 valid CIM namespace name.
272                         */
273 kumpf          1.17     CIMNamespaceName(const String& name);
274 karl           1.23 
275 kumpf          1.38     /**
276                             Constructs a non-null CIMNamespaceName with the specified name.
277                             @param name A character string containing the CIM namespace name.
278                             @exception InvalidNameException If the character string does not
279                                 contain a valid CIM namespace name.
280 thilo.boehm    1.39         @exception All exceptions thrown by String(const char* str) can be
281                                 thrown here
282 kumpf          1.38     */
283 kumpf          1.17     CIMNamespaceName(const char* name);
284                     
285 kumpf          1.38     /**
286                             Assigns the value of the specified CIMNamespaceName object to this
287                             object.
288                             @param name The CIMNamespaceName object from which to assign this
289                                 CIMNamespaceName object.
290                         */
291 kumpf          1.17     CIMNamespaceName& operator=(const CIMNamespaceName& name);
292 karl           1.23 
293 kumpf          1.38     /**
294                             Sets the CIMNamespaceName with a String name.  The resulting
295                             CIMNamespaceName object is non-null.
296                             <p><b>Example:</b>
297                             <pre>
298                             CIMNamespaceName n;
299                             String name = "root/cimv2";
300                             n = name;
301                             </pre>
302                             @param name A String containing the CIM namespace name to set.
303                             @return A reference to this CIMNamespaceName object.
304                             @exception InvalidNameException If the String does not contain a
305                                 valid CIM namespace name.
306                         */
307 kumpf          1.17     CIMNamespaceName& operator=(const String& name);
308 kumpf          1.20 
309 kumpf          1.38     /**
310                             Gets a String form of the CIM namespace name.
311                             <p><b>Example:</b>
312                             <pre>
313                             CIMNamespaceName n("test/ns1");
314                             String s = n.getString();
315                             </pre>
316                             @return A reference to a String containing the CIM namespace name.
317                         */
318 kumpf          1.20     const String& getString() const;
319 kumpf          1.17 
320 kumpf          1.38     /**
321                             Determines whether the CIM namespace name is null.
322                             <p><b>Example:</b>
323                             <pre>
324                             CIMNamespaceName n;
325                             assert(n.isNull());
326                             n = "root/test";
327                             assert(!n.isNull());
328                             </pre>
329                             @return True if the CIM namespace name is null, false otherwise.
330                         */
331 kumpf          1.17     Boolean isNull() const;
332                     
333 kumpf          1.38     /**
334                             Sets the CIM namespace name to a null value.
335                             <p><b>Example:</b>
336                             <pre>
337                             CIMNamespaceName n("root/test");
338                             n.clear();
339                             assert(n.isNull());
340                             </pre>
341                         */
342 kumpf          1.17     void clear();
343                     
344 kumpf          1.38     /**
345                             Compares the CIMNamespaceName with a specified CIMNamespaceName.
346                             Comparisons of CIM namespace names are case-insensitive.
347                             <p><b>Example:</b>
348                             <pre>
349                             CIMNamespaceName n1("root/cimv2");
350                             CIMNamespaceName n2("Root/CimV2");
351                             assert(n1.equal(n2));
352                             </pre>
353                             @param name The CIMNamespaceName to be compared.
354                             @return True if this name is equivalent to the specified name,
355                                 false otherwise.
356 kumpf          1.17     */
357                         Boolean equal(const CIMNamespaceName& name) const;
358 mike           1.11 
359 kumpf          1.38     /**
360                             Determines whether a name is a valid CIM namespace name.
361                             <p><b>Example:</b>
362 david.dillard  1.32         <pre>
363 kumpf          1.38         assert(CIMNamespaceName::legal("root/test"));
364                             assert(!CIMNamespaceName::legal("Wrong!"));
365 david.dillard  1.32         </pre>
366 kumpf          1.38         @param name A String containing the name to test.
367                             @return True if the specified name is a valid CIM namespace name,
368                                 false otherwise.
369 kumpf          1.17     */
370 kumpf          1.21     static Boolean legal(const String& name);
371 kumpf          1.17 
372 r.kieninger    1.34 #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
373                     
374 kumpf          1.38     /**
375                             Compares the CIMNamespaceName with a specified character string.
376                             Comparisons of CIM namespace names are case-insensitive.
377                             @param name The name to be compared.
378                             @return True if this name is equivalent to the specified name,
379                                 false otherwise.
380                         */
381 r.kieninger    1.34     Boolean equal(const char* name) const;
382                     
383 kumpf          1.38     /**
384                             Sets the CIMNamespaceName with a character string name.  The
385                             resulting CIMNamespaceName object is non-null.
386                             @param name A character string containing the CIM namespace name
387                                 to set.
388                             @return A reference to this CIMNamespaceName object.
389                             @exception InvalidNameException If the character string does not
390                                 contain a valid CIM namespace name.
391 thilo.boehm    1.39         @exception All exceptions thrown by String(const char* str) can be
392                                 thrown here
393 kumpf          1.38     */
394 r.kieninger    1.34     CIMNamespaceName& operator=(const char* name);
395                     
396                     #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
397                     
398 kumpf          1.17 private:
399                         String cimNamespaceName;
400 mike           1.11 };
401 kumpf          1.20 
402 kumpf          1.38 /**
403                         Compares two CIM namespace names for equality.
404                         <p><b>Example:</b>
405                         <pre>
406                         CIMNamespaceName n1("root/test");
407                         CIMNamespaceName n2("Root/TEST");
408                         assert(n1 == n2);
409                         </pre>
410                         @param x The first CIMNamespaceName to be compared.
411                         @param y The second CIMNamespaceName to be compared.
412                         @return True if the CIM namespace names are equivalent, false otherwise.
413                     */
414 kumpf          1.20 PEGASUS_COMMON_LINKAGE Boolean operator==(
415                         const CIMNamespaceName& name1,
416                         const CIMNamespaceName& name2);
417                     
418 kumpf          1.38 /**
419                         Compares two CIM namespace names for inequality.
420                         @param x The first CIMNamespaceName to be compared.
421                         @param y The second CIMNamespaceName to be compared.
422                         @return False if the CIM namespace names are equivalent, true otherwise.
423                     */
424 david.dillard  1.31 PEGASUS_COMMON_LINKAGE Boolean operator!=(
425                         const CIMNamespaceName& name1,
426                         const CIMNamespaceName& name2);
427                     
428 kumpf          1.20 #define PEGASUS_ARRAY_T CIMNamespaceName
429                     # include "ArrayInter.h"
430                     #undef PEGASUS_ARRAY_T
431 mike           1.11 
432                     PEGASUS_NAMESPACE_END
433                     
434 r.kieninger    1.34 #ifdef PEGASUS_INTERNALONLY
435                     # include "CIMNameInline.h"
436                     #endif
437                     
438 mike           1.11 #endif /* Pegasus_Name_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2