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

Diff for /pegasus/src/Pegasus/Common/CIMName.h between version 1.27 and 1.41

version 1.27, 2004/06/15 18:38:24 version 1.41, 2008/12/01 17:49:48
Line 1 
Line 1 
 //%2003////////////////////////////////////////////////////////////////////////  //%LICENSE////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002  BMC Software, Hewlett-Packard Development  // Licensed to The Open Group (TOG) under one or more contributor license
 // Company, L. P., IBM Corp., The Open Group, Tivoli Systems.  // agreements.  Refer to the OpenPegasusNOTICE.txt file distributed with
 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L. P.;  // this work for additional information regarding copyright ownership.
 // IBM Corp.; EMC Corporation, The Open Group.  // Each contributor licenses this file to you under the OpenPegasus Open
   // Source License; you may not use this file except in compliance with the
   // License.
   //
   // Permission is hereby granted, free of charge, to any person obtaining a
   // copy of this software and associated documentation files (the "Software"),
   // to deal in the Software without restriction, including without limitation
   // the rights to use, copy, modify, merge, publish, distribute, sublicense,
   // and/or sell copies of the Software, and to permit persons to whom the
   // Software is furnished to do so, subject to the following conditions:
   //
   // The above copyright notice and this permission notice shall be included
   // in all copies or substantial portions of the Software.
   //
   // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
   // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
   // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
   // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
   // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
   // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
   // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy  //////////////////////////////////////////////////////////////////////////
 // of this software and associated documentation files (the "Software"), to  
 // deal in the Software without restriction, including without limitation the  
 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or  
 // sell copies of the Software, and to permit persons to whom the Software is  
 // furnished to do so, subject to the following conditions:  
 //  
 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN  
 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED  
 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT  
 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR  
 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT  
 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN  
 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION  
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  
 //  
 //==============================================================================  
 //  
 // Author: Mike Brasher (mbrasher@bmc.com)  
 //  
 // Modified By: Roger Kumpf, Hewlett Packard Company (roger_kumpf@hp.com)  
 //              Carol Ann Krug Graves, Hewlett-Packard Company  
 //                (carolann_graves@hp.com)  
 // //
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
Line 49 
Line 47 
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
  
 /** /**
     The CIMName class defines methods for handling CIM names.      The CIMName class represents the DMTF standard CIM name definition.
     <p>      The names of CIM classes, properties, qualifiers, and methods are all
     The names of classes, properties, qualifiers, and methods are all      CIM names.
     CIM names. A CIM name must match the following regular  
     expression:      <p>A CIM name must contain characters only from this set:
     <PRE>  
         [A-Z-a-z_][A-Za-z_0-9]*  
     </PRE>  
     <B>Examples:</B>  
     <ul>     <ul>
     <li>name - legal name        <li>alphabetic (a-z and A-Z)
     <li>Type - legal name        <li>numeric (0-9)
     <li>3types - Illegal CIMName.        <li>underscore (_)
         <li>UCS-2 characters in the range 0x0080 to 0xFFEF
     </ul>     </ul>
     The CIMName object includes the attribute Null which is required      The first character of a CIM name may not be numeric.
     by the DMTF operations definitions.  Note that this and the regular      A CIMName may be null, meaning that it has no value.
     expression limits on CIMName are what separate this from the String  
     class. This allows the names in CIM operations such as getClass to  
     provide pattern matching tests for the classname parameter as well as  
     separate the concept of empty from Null.  
   
 */ */
 class PEGASUS_COMMON_LINKAGE CIMName class PEGASUS_COMMON_LINKAGE CIMName
 { {
 public: public:
  
     /** Default constructor (sets isNull to true).      /**
           Constructs a null CIMName.
     */     */
     CIMName();     CIMName();
  
         /** Constructor creates a new CIMName object from      /**
             the String provided as input. The String must          Constructs a non-null CIMName with the specified name.
             be a legal name.          @param name A String containing the CIM name.
             @param String defining the CIMName          @exception InvalidNameException If the String does not contain a
             @Exception InvalidNameException if the input String is              valid CIM name.
             not a legal CIMName  
     */     */
     CIMName(const String& name);     CIMName(const String& name);
   
     /**     /**
         Constructor creates a new CIMName object from          Constructs a non-null CIMName with the specified name.
                         the String provided as input. The String must          @param name A character string containing the CIM name.
                         be a legal name.          @exception InvalidNameException If the character string does not
                         @param char* defining the CIMName text.              contain a valid CIM name.
                         @Exception InvalidNameException if the input String is          @exception All exceptions thrown by String(const char* str) can be
                         not a legal CIMName              thrown here
         */         */
     CIMName(const char* name);     CIMName(const char* name);
  
     /** Copy Constructor for CIMName object      /**
           Assigns the value of the specified CIMName object to this object.
           @param name The CIMName object from which to assign this
               CIMName object.
         */         */
     CIMName& operator=(const CIMName& name);     CIMName& operator=(const CIMName& name);
     /** Copy constructor String object. Allows copying  
             String value into a CIMName.      /**
             @param String to be copied into CIMName          Sets the CIMName with a String name.  The resulting CIMName object
             @exception InvalidNameException if the input String          is non-null.
             is not a legal CIMName          <p><b>Example:</b>
             <pre>             <pre>
                         CIMName n;                         CIMName n;
                         String type = "type";                         String type = "type";
                         n = type;                         n = type;
             </pre>             </pre>
           @param name A String containing the CIM name to set.
           @return A reference to this CIMName object.
           @exception InvalidNameException If the String does not contain a
               valid CIM name.
         */         */
     CIMName& operator=(const String& name);     CIMName& operator=(const String& name);
  
     /** Extracts the String value of the CIMName      /**
             from the CIMName object.          Gets a String form of the CIM name.
             @return String containing the name.          <p><b>Example:</b>
             <pre>             <pre>
                         CIMName n("name");                         CIMName n("name");
                         String s = n.getString();                         String s = n.getString();
             </pre>             </pre>
           @return A reference to a String containing the CIM name.
         */         */
     const String& getString() const;     const String& getString() const;
  
     /** Tests the CIMName for NULL attribute.      /**
             @return true if Null or false if not Null.          Determines whether the CIM name is null.
           <p><b>Example:</b>
             <pre>             <pre>
                         CIMName n;                         CIMName n;
                         assert(n.isNull());                         assert(n.isNull());
                         n = "name";                         n = "name";
                         assert(!n.isNull());                         assert(!n.isNull());
             </pre>             </pre>
           @return True if the CIM name is null, false otherwise.
         */         */
     Boolean isNull() const;     Boolean isNull() const;
  
     /** Clears the CIMName and sets it to Null.      /**
           Sets the CIM name to a null value.
           <p><b>Example:</b>
             <pre>             <pre>
                 CIMMame n("name");          CIMName n("name");
                 n.clear();                 n.clear();
                 assert(n.isNull());                 assert(n.isNull());
             </pre>             </pre>
         */         */
     void clear();     void clear();
  
     /** Compares the CIMName object against another CIMName object for equality.      /**
             @param CIMName to compare.          Compares the CIMName with a specified CIMName.  Comparisons of
                 @return true if the name passed is equal to the name in this          CIM names are case-insensitive.
         class. CIM names are case insensitive and so is this method.          <p><b>Example:</b>
             <pre>          <pre>
             CIMName n1 = "name";          CIMName n1("name");
             CIMName n2 = "InstanceID";          CIMName n2("Name");
             if( n1.equal(n2) )          assert(n1.equal(n2));
                     ...                                         // Should never get here          </pre>
             else          @param name The CIMName to be compared.
                     ...          @return True if this name is equivalent to the specified name,
             </pre>              false otherwise.
     */     */
     Boolean equal(const CIMName& name) const;     Boolean equal(const CIMName& name) const;
  
     /** Determines if the name string input is legal as      /**
                 defined in the CIMName class definition. This is a static          Determines whether a name is a valid CIM name.
                 method used to test String values to determine if they are          <p><b>Example:</b>
                 legal names.  
                 @param name String to test for legality.  
                 @return true if the given name is legal, false otherwise.  
         <pre>         <pre>
             assert(CIMName::legal("name"));             assert(CIMName::legal("name"));
             assert(!CIMName::legal("3types"));             assert(!CIMName::legal("3types"));
         </pre>         </pre>
           @param name A String containing the name to test.
           @return True if the specified name is a valid CIM name,
               false otherwise.
     */     */
     static Boolean legal(const String& name);     static Boolean legal(const String& name);
  
   #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
   
       /**
           Compares the CIMName with a specified character string.  Comparisons of
           CIM names are case-insensitive.
           @param name The name to be compared.
           @return True if this name is equivalent to the specified name,
               false otherwise.
       */
       Boolean equal(const char* name) const;
   
       /**
           Sets the CIMName with a character string name.  The resulting CIMName
           object is non-null.
           @param name A character string containing the CIM name to set.
           @return A reference to this CIMName object.
           @exception InvalidNameException If the character string does not
               contain a valid CIM name.
           @exception All exceptions thrown by String(const char* str) can be
               thrown here
       */
       CIMName& operator=(const char* name);
   
   #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
   
 private: private:
     String cimName;     String cimName;
 }; };
  
   /**
       Compares two CIM names for equality.
       <p><b>Example:</b>
       <pre>
       CIMName lowerCaseName("this_is_a_name");
       CIMName upperCaseName("THIS_IS_A_NAME");
       assert(lowerCaseName == upperCaseName);
       </pre>
       @param x The first CIMName to be compared.
       @param y The second CIMName to be compared.
       @return True if the CIM names are equivalent, false otherwise.
   */
 PEGASUS_COMMON_LINKAGE Boolean operator==( PEGASUS_COMMON_LINKAGE Boolean operator==(
     const CIMName& name1,     const CIMName& name1,
     const CIMName& name2);     const CIMName& name2);
  
   /**
       Compares two CIM names for inequality.
       @param x The first CIMName to be compared.
       @param y The second CIMName to be compared.
       @return False if the CIM names are equivalent, true otherwise.
   */
   PEGASUS_COMMON_LINKAGE Boolean operator!=(
       const CIMName& name1,
       const CIMName& name2);
   
 #define PEGASUS_ARRAY_T CIMName #define PEGASUS_ARRAY_T CIMName
 # include "ArrayInter.h" # include "ArrayInter.h"
 #undef PEGASUS_ARRAY_T #undef PEGASUS_ARRAY_T
Line 191 
Line 241 
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
  
 /** /**
     The CIMNamespaceName class defines methods for handling CIM namespace names.      The CIMNamespaceName class represents the DMTF standard CIM namespace
     <p>      name definition.
     A CIM namespace name must match the following expression:  
     <PRE>      <p>A CIM namespace name must match the following expression:
       <pre>
         &lt;CIMName&gt;[ / &lt;CIMName&gt; ]*         &lt;CIMName&gt;[ / &lt;CIMName&gt; ]*
     </PRE>      </pre>
     </p>      A namespace name with a leading '/' character is accepted, but the
     <B>Examples</B>      leading character is removed.
     <UL>      A CIMNamespaceName may be null, meaning that it has no value.
     <LI>root  
     <LI>root/test  
     </UL>  
     NOTE: Pegasus uses namespaces starting with the top level name (ex. root).  It does  
     not use the form /root/test with a leading slash.  The legal() test method in this class  
     allows that form as a legal entity however.  
 */ */
 class PEGASUS_COMMON_LINKAGE CIMNamespaceName class PEGASUS_COMMON_LINKAGE CIMNamespaceName
 { {
 public: public:
  
     /** Default constructor sets object Null. The Null state      /**
             indicates that there is no name assigned to this object.          Constructs a null CIMName.
             The Null state can be tested with the isNull() method and  
             set with the clear() method.  
         */         */
     CIMNamespaceName();     CIMNamespaceName();
  
     /** Constructor builds namespace from input String.      /**
             The String input must be a legal namespace name.          Constructs a non-null CIMNamespaceName with the specified name.
             @param String from which the namespace object is built.          @param name A String containing the CIM namespace name.
             This must be a legal namespace name.          @exception InvalidNameException If the String does not contain a
             @exeception InvalidNamespaceName exception thrown if              valid CIM namespace name.
             the namespace name input is illegal.  
         */         */
     CIMNamespaceName(const String& name);     CIMNamespaceName(const String& name);
  
     /** Constructor builds namespace from input char*.      /**
             The String input must be a legal namespace name.          Constructs a non-null CIMNamespaceName with the specified name.
             @param char* from which the namespace object is built.          @param name A character string containing the CIM namespace name.
             This must be a legal namespace name.          @exception InvalidNameException If the character string does not
             @exeception InvalidNamespaceName exception thrown if              contain a valid CIM namespace name.
             the namespace name input parameter is illegal.          @exception All exceptions thrown by String(const char* str) can be
               thrown here
         */         */
     CIMNamespaceName(const char* name);     CIMNamespaceName(const char* name);
  
     /** Assign one namespace object to another.      /**
                 @param CIMNamespaceName to assign to the object.          Assigns the value of the specified CIMNamespaceName object to this
           object.
           @param name The CIMNamespaceName object from which to assign this
               CIMNamespaceName object.
         */         */
     CIMNamespaceName& operator=(const CIMNamespaceName& name);     CIMNamespaceName& operator=(const CIMNamespaceName& name);
  
     /** Assign a String object to a CIMNamespaceName object.      /**
                 @param CIMNamespaceName to assign          Sets the CIMNamespaceName with a String name.  The resulting
                 @exeception InvalidNamespaceName exception thrown if          CIMNamespaceName object is non-null.
                 the namespace name input parameter is illegal.          <p><b>Example:</b>
             <pre>          <pre>
                         String s = "root/test";          CIMNamespaceName n;
                         CIMNamespacename ns;          String name = "root/cimv2";
                         ns = s;          n = name;
             </pre>          </pre>
           @param name A String containing the CIM namespace name to set.
           @return A reference to this CIMNamespaceName object.
           @exception InvalidNameException If the String does not contain a
               valid CIM namespace name.
         */         */
     CIMNamespaceName& operator=(const String& name);     CIMNamespaceName& operator=(const String& name);
  
     /** Extracts the String value of the CIMNamespaceName      /**
             from the object.          Gets a String form of the CIM namespace name.
             @return String containing the name.          <p><b>Example:</b>
             <pre>             <pre>
                         CIMNamespaceName ns("root/test");          CIMNamespaceName n("test/ns1");
                         String s = ns.getString();          String s = n.getString();
             </pre>             </pre>
           @return A reference to a String containing the CIM namespace name.
         */         */
     const String& getString() const;     const String& getString() const;
  
     /** Tests the CIMNamespaceName for NULL attribute. Returns      /**
             true if Null.  New objects without parameter and objects          Determines whether the CIM namespace name is null.
             set with clear() are Null.  When a name is set into the          <p><b>Example:</b>
             object is is set to nonnull.  When the object is Null, it  
             returns empty string.  
             @return true if Null or false if not Null.  
             <pre>             <pre>
                         CIMName n;          CIMNamespaceName n;
                         assert(n.isNull());                         assert(n.isNull());
                         n = "name";          n = "root/test";
                         assert(!n.isNull());                         assert(!n.isNull());
             </pre>             </pre>
           @return True if the CIM namespace name is null, false otherwise.
         */         */
     Boolean isNull() const;     Boolean isNull() const;
  
     /** Clears the CIMNamespaceName and sets it to Null. A Null      /**
             object contains no name so that accessing it with getString          Sets the CIM namespace name to a null value.
             should return an empty String          <p><b>Example:</b>
             <pre>          <pre>
                         CIMMamespaceName ns("root/test");          CIMNamespaceName n("root/test");
                         ns.clear();          n.clear();
                         assert(ns.isNull());          assert(n.isNull());
             </pre>             </pre>
         */         */
     void clear();     void clear();
  
     /** Compares two CIMNamespace objects for equality.      /**
                 @return true if the name passed is equal to the name in this          Compares the CIMNamespaceName with a specified CIMNamespaceName.
         class. CIM names are case insensitive and so is this method.          Comparisons of CIM namespace names are case-insensitive.
                 <pre>          <p><b>Example:</b>
                 CIMMamespaceName ns("root/test");          <pre>
                 CIMMamespaceName ns1("root/test");          CIMNamespaceName n1("root/cimv2");
                 assert( ns.equal(ns1);          CIMNamespaceName n2("Root/CimV2");
             </pre>          assert(n1.equal(n2));
           </pre>
           @param name The CIMNamespaceName to be compared.
           @return True if this name is equivalent to the specified name,
               false otherwise.
     */     */
     Boolean equal(const CIMNamespaceName& name) const;     Boolean equal(const CIMNamespaceName& name) const;
  
     /** Determines if the name string input is legal as      /**
         defined in the CIMNamespaceName class definition.          Determines whether a name is a valid CIM namespace name.
         @param name String to test for legality.          <p><b>Example:</b>
         @return true if the given name is legal, false otherwise.  
         <pre>         <pre>
                 assert(CIMNamespaceName::legal("root/test"));                 assert(CIMNamespaceName::legal("root/test"));
           assert(!CIMNamespaceName::legal("Wrong!"));
         </pre>         </pre>
           @param name A String containing the name to test.
           @return True if the specified name is a valid CIM namespace name,
               false otherwise.
     */     */
     static Boolean legal(const String& name);     static Boolean legal(const String& name);
  
   #ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES
   
       /**
           Compares the CIMNamespaceName with a specified character string.
           Comparisons of CIM namespace names are case-insensitive.
           @param name The name to be compared.
           @return True if this name is equivalent to the specified name,
               false otherwise.
       */
       Boolean equal(const char* name) const;
   
       /**
           Sets the CIMNamespaceName with a character string name.  The
           resulting CIMNamespaceName object is non-null.
           @param name A character string containing the CIM namespace name
               to set.
           @return A reference to this CIMNamespaceName object.
           @exception InvalidNameException If the character string does not
               contain a valid CIM namespace name.
           @exception All exceptions thrown by String(const char* str) can be
               thrown here
       */
       CIMNamespaceName& operator=(const char* name);
   
   #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */
   
 private: private:
     String cimNamespaceName;     String cimNamespaceName;
 }; };
  
   /**
       Compares two CIM namespace names for equality.
       <p><b>Example:</b>
       <pre>
       CIMNamespaceName n1("root/test");
       CIMNamespaceName n2("Root/TEST");
       assert(n1 == n2);
       </pre>
       @param x The first CIMNamespaceName to be compared.
       @param y The second CIMNamespaceName to be compared.
       @return True if the CIM namespace names are equivalent, false otherwise.
   */
 PEGASUS_COMMON_LINKAGE Boolean operator==( PEGASUS_COMMON_LINKAGE Boolean operator==(
     const CIMNamespaceName& name1,     const CIMNamespaceName& name1,
     const CIMNamespaceName& name2);     const CIMNamespaceName& name2);
  
   /**
       Compares two CIM namespace names for inequality.
       @param x The first CIMNamespaceName to be compared.
       @param y The second CIMNamespaceName to be compared.
       @return False if the CIM namespace names are equivalent, true otherwise.
   */
   PEGASUS_COMMON_LINKAGE Boolean operator!=(
       const CIMNamespaceName& name1,
       const CIMNamespaceName& name2);
   
 #define PEGASUS_ARRAY_T CIMNamespaceName #define PEGASUS_ARRAY_T CIMNamespaceName
 # include "ArrayInter.h" # include "ArrayInter.h"
 #undef PEGASUS_ARRAY_T #undef PEGASUS_ARRAY_T
  
 PEGASUS_NAMESPACE_END PEGASUS_NAMESPACE_END
  
   #ifdef PEGASUS_INTERNALONLY
   # include "CIMNameInline.h"
   #endif
   
 #endif /* Pegasus_Name_h */ #endif /* Pegasus_Name_h */


Legend:
Removed from v.1.27  
changed lines
  Added in v.1.41

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2