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

  1 karl  1.30 //%2005////////////////////////////////////////////////////////////////////////
  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 mike  1.11 //
 12            // Permission is hereby granted, free of charge, to any person obtaining a copy
 13 kumpf 1.13 // of this software and associated documentation files (the "Software"), to
 14            // deal in the Software without restriction, including without limitation the
 15            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 16 mike  1.11 // sell copies of the Software, and to permit persons to whom the Software is
 17            // furnished to do so, subject to the following conditions:
 18            // 
 19 kumpf 1.13 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 20 mike  1.11 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 21            // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 22 kumpf 1.13 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 23            // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 24            // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 25 mike  1.11 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 26            // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27            //
 28            //==============================================================================
 29            //
 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.17     The CIMName class defines methods for handling CIM names.
 51 kumpf 1.14     <p>
 52 mike  1.11     The names of classes, properties, qualifiers, and methods are all
 53                CIM names. A CIM name must match the following regular
 54                expression:
 55                <PRE>
 56            	[A-Z-a-z_][A-Za-z_0-9]*
 57                </PRE>
 58 karl  1.23     <B>Examples:</B>
 59                <ul>
 60                <li>name - legal name
 61                <li>Type - legal name
 62                <li>3types - Illegal CIMName.
 63                </ul>
 64                The CIMName object includes the attribute Null which is required
 65                by the DMTF operations definitions.  Note that this and the regular
 66                expression limits on CIMName are what separate this from the String
 67                class. This allows the names in CIM operations such as getClass to 
 68                provide pattern matching tests for the classname parameter as well as
 69                separate the concept of empty from Null.
 70                
 71 mike  1.11 */
 72            class PEGASUS_COMMON_LINKAGE CIMName
 73            {
 74            public:
 75            
 76 karl  1.23     /** Default constructor (sets isNull to true).
 77                */
 78 kumpf 1.17     CIMName();
 79 karl  1.23 
 80            	/** Constructor creates a new CIMName object from
 81            	    the String provided as input. The String must
 82            	    be a legal name.
 83            	    @param String defining the CIMName
 84            	    @Exception InvalidNameException if the input String is 
 85            	    not a legal CIMName
 86                */
 87 kumpf 1.17     CIMName(const String& name);
 88 karl  1.23     /**
 89            	Constructor creates a new CIMName object from
 90            			the String provided as input. The String must
 91            			be a legal name.
 92            			@param char* defining the CIMName text.
 93            			@Exception InvalidNameException if the input String is 
 94            			not a legal CIMName
 95            	*/
 96 kumpf 1.17     CIMName(const char* name);
 97            
 98 karl  1.23     /**	Copy Constructor for CIMName object
 99            	*/
100 kumpf 1.17     CIMName& operator=(const CIMName& name);
101 karl  1.23     /**	Copy constructor String object. Allows copying
102            	    String value into a CIMName.
103            	    @param String to be copied into CIMName
104            	    @exception InvalidNameException if the input String
105            	    is not a legal CIMName
106            	    <pre>
107            			CIMName n;
108            			String type = "type";
109            			n = type;
110            	    </pre>
111            	*/
112 kumpf 1.17     CIMName& operator=(const String& name);
113 kumpf 1.20 
114 karl  1.23     /** Extracts the String value of the CIMName
115            	    from the CIMName object.
116            	    @return String containing the name.
117            	    <pre>
118            			CIMName n("name");
119            			String s = n.getString();
120            	    </pre>
121            	*/
122 kumpf 1.20     const String& getString() const;
123 kumpf 1.17 
124 karl  1.23     /**	Tests the CIMName for NULL attribute.
125            	    @return true if Null or false if not Null.
126            	    <pre>
127            			CIMName n;
128            			assert(n.isNull());
129            			n = "name";
130            			assert(!n.isNull());
131            	    </pre>
132            	*/
133 kumpf 1.17     Boolean isNull() const;
134            
135 karl  1.23     /**	Clears the CIMName and sets it to Null.
136            	    <pre>
137            		CIMMame n("name");
138            		n.clear();
139            		assert(n.isNull());
140            	    </pre>
141            	*/
142 kumpf 1.17     void clear();
143            
144 karl  1.23     /** Compares the CIMName object against another CIMName object for equality.
145            	    @param CIMName to compare.
146            		@return true if the name passed is equal to the name in this
147 kumpf 1.22         class. CIM names are case insensitive and so is this method.
148 karl  1.23 	    <pre>
149            	    CIMName n1 = "name";
150            	    CIMName n2 = "InstanceID";
151            	    if( n1.equal(n2) )
152            		    ...						// Should never get here
153            	    else
154            		    ...
155            	    </pre>
156 kumpf 1.17     */
157                Boolean equal(const CIMName& name) const;
158            
159 kumpf 1.22     /** Determines if the name string input is legal as
160 karl  1.23 		defined in the CIMName class definition. This is a static
161            		method used to test String values to determine if they are
162            		legal names.
163            		@param name String to test for legality.
164            		@return true if the given name is legal, false otherwise.
165            	<pre>
166            	    assert(CIMName::legal("name"));
167            	    assert(!CIMName::legal("3types"));
168            	</pre>
169 mike  1.11     */
170 kumpf 1.21     static Boolean legal(const String& name);
171 mike  1.11 
172            private:
173 kumpf 1.17     String cimName;
174            };
175            
176 kumpf 1.18 PEGASUS_COMMON_LINKAGE Boolean operator==(
177                const CIMName& name1,
178                const CIMName& name2);
179 kumpf 1.17 
180 david.dillard 1.31 PEGASUS_COMMON_LINKAGE Boolean operator!=(
181                        const CIMName& name1,
182                        const CIMName& name2);
183                    
184 kumpf         1.17 #define PEGASUS_ARRAY_T CIMName
185                    # include "ArrayInter.h"
186                    #undef PEGASUS_ARRAY_T
187                    
188                    
189                    ////////////////////////////////////////////////////////////////////////////////
190                    //
191                    // CIMNamespaceName
192                    //
193                    ////////////////////////////////////////////////////////////////////////////////
194                    
195                    /**
196 kumpf         1.19     The CIMNamespaceName class defines methods for handling CIM namespace names.
197 kumpf         1.17     <p>
198                        A CIM namespace name must match the following expression:
199                        <PRE>
200 karl          1.24         &lt;CIMName&gt;[ / &lt;CIMName&gt; ]*
201 kumpf         1.17     </PRE>
202 kumpf         1.22     </p>
203 karl          1.23     <B>Examples</B>
204                        <UL>
205                        <LI>root
206                        <LI>root/test
207                        </UL>
208                        NOTE: Pegasus uses namespaces starting with the top level name (ex. root).  It does
209 karl          1.24     not use the form /root/test with a leading slash.  The legal() test method in this class
210 karl          1.23     allows that form as a legal entity however.
211 kumpf         1.17 */
212                    class PEGASUS_COMMON_LINKAGE CIMNamespaceName
213                    {
214                    public:
215                    
216 karl          1.23     /** Default constructor sets object Null. The Null state
217                    	    indicates that there is no name assigned to this object.
218                    	    The Null state can be tested with the isNull() method and
219                    	    set with the clear() method.
220                    	*/
221 kumpf         1.17     CIMNamespaceName();
222 karl          1.23 
223                        /** Constructor builds namespace from input String.
224                    	    The String input must be a legal namespace name.
225                    	    @param String from which the namespace object is built.
226                    	    This must be a legal namespace name.
227                    	    @exeception InvalidNamespaceName exception thrown if
228                    	    the namespace name input is illegal.
229                    	*/
230 kumpf         1.17     CIMNamespaceName(const String& name);
231 karl          1.23 
232                        /** Constructor builds namespace from input char*.
233                    	    The String input must be a legal namespace name.
234                    	    @param char* from which the namespace object is built.
235                    	    This must be a legal namespace name.
236                    	    @exeception InvalidNamespaceName exception thrown if
237                    	    the namespace name input parameter is illegal.
238                    	*/    
239 kumpf         1.17     CIMNamespaceName(const char* name);
240                    
241 karl          1.23     /** Assign one namespace object to another.
242                    		@param CIMNamespaceName to assign to the object.
243                    	*/
244 kumpf         1.17     CIMNamespaceName& operator=(const CIMNamespaceName& name);
245 karl          1.23 
246                        /** Assign a String object to a CIMNamespaceName object.
247                    		@param CIMNamespaceName to assign
248                    		@exeception InvalidNamespaceName exception thrown if
249                    		the namespace name input parameter is illegal.
250                    	    <pre>
251                    			String s = "root/test";
252                    			CIMNamespacename ns;
253                    			ns = s;
254                    	    </pre>
255                    	*/
256 kumpf         1.17     CIMNamespaceName& operator=(const String& name);
257 kumpf         1.20 
258 karl          1.23     /** Extracts the String value of the CIMNamespaceName
259                    	    from the object.
260                    	    @return String containing the name.
261                    	    <pre>
262                    			CIMNamespaceName ns("root/test");
263                    			String s = ns.getString();
264                    	    </pre>
265                    	*/
266 kumpf         1.20     const String& getString() const;
267 kumpf         1.17 
268 karl          1.23     /**	Tests the CIMNamespaceName for NULL attribute. Returns
269                    	    true if Null.  New objects without parameter and objects
270                    	    set with clear() are Null.  When a name is set into the
271                    	    object is is set to nonnull.  When the object is Null, it
272                    	    returns empty string.
273                    	    @return true if Null or false if not Null.
274                    	    <pre>
275                    			CIMName n;
276                    			assert(n.isNull());
277                    			n = "name";
278                    			assert(!n.isNull());
279                    	    </pre>
280                    	*/
281 kumpf         1.17     Boolean isNull() const;
282                    
283 karl          1.23     /**	Clears the CIMNamespaceName and sets it to Null. A Null
284                    	    object contains no name so that accessing it with getString
285                    	    should return an empty String
286                    	    <pre>
287                    			CIMMamespaceName ns("root/test");
288                    			ns.clear();
289                    			assert(ns.isNull());
290                    	    </pre>
291                    	*/
292 kumpf         1.17     void clear();
293                    
294 karl          1.23     /** Compares two CIMNamespace objects for equality.
295                    		@return true if the name passed is equal to the name in this
296 kumpf         1.22         class. CIM names are case insensitive and so is this method.
297 karl          1.23 		<pre>
298                    		CIMMamespaceName ns("root/test");
299                    		CIMMamespaceName ns1("root/test");
300                    		assert( ns.equal(ns1);
301                    	    </pre>
302 kumpf         1.17     */
303                        Boolean equal(const CIMNamespaceName& name) const;
304 mike          1.11 
305 kumpf         1.22     /** Determines if the name string input is legal as
306 karl          1.23 	defined in the CIMNamespaceName class definition.
307 kumpf         1.22 	@param name String to test for legality.
308                    	@return true if the given name is legal, false otherwise.
309 karl          1.23 	<pre>
310                    		assert(CIMNamespaceName::legal("root/test"));
311                    	</pre>
312 kumpf         1.17     */
313 kumpf         1.21     static Boolean legal(const String& name);
314 kumpf         1.17 
315                    private:
316                        String cimNamespaceName;
317 mike          1.11 };
318 kumpf         1.20 
319                    PEGASUS_COMMON_LINKAGE Boolean operator==(
320                        const CIMNamespaceName& name1,
321                        const CIMNamespaceName& name2);
322                    
323 david.dillard 1.31 PEGASUS_COMMON_LINKAGE Boolean operator!=(
324                        const CIMNamespaceName& name1,
325                        const CIMNamespaceName& name2);
326                    
327 kumpf         1.20 #define PEGASUS_ARRAY_T CIMNamespaceName
328                    # include "ArrayInter.h"
329                    #undef PEGASUS_ARRAY_T
330 mike          1.11 
331                    PEGASUS_NAMESPACE_END
332                    
333                    #endif /* Pegasus_Name_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2