(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.17 and 1.40

version 1.17, 2002/07/30 16:14:53 version 1.40, 2008/11/12 21:05:40
Line 1 
Line 1 
 //%/////////////////////////////////////////////////////////////////////////////  //%2006////////////////////////////////////////////////////////////////////////
 // //
 // Copyright (c) 2000, 2001, 2002 BMC Software, Hewlett-Packard Company, IBM,  // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
 // The Open Group, Tivoli Systems  // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
   // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
   // IBM Corp.; EMC Corporation, The Open Group.
   // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
   // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; VERITAS Software Corporation; The Open Group.
   // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
   // EMC Corporation; Symantec Corporation; The Open Group.
 // //
 // Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to // of this software and associated documentation files (the "Software"), to
Line 21 
Line 29 
 // //
 //============================================================================== //==============================================================================
 // //
 // Author: Mike Brasher (mbrasher@bmc.com)  
 //  
 // Modified By: Roger Kumpf, Hewlett Packard Company (roger_kumpf@hp.com)  
 //  
 //%///////////////////////////////////////////////////////////////////////////// //%/////////////////////////////////////////////////////////////////////////////
  
 #ifndef Pegasus_Name_h #ifndef Pegasus_Name_h
Line 45 
Line 49 
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
  
 /** /**
     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>      <ul>
         <li>alphabetic (a-z and A-Z)
         [A-Z-a-z_][A-Za-z_0-9]*        <li>numeric (0-9)
     </PRE>        <li>underscore (_)
         <li>UCS-2 characters in the range 0x0080 to 0xFFEF
     Notice that the definition of a name is the same as C, C++,      </ul>
     and Java.      The first character of a CIM name may not be numeric.
       A CIMName may be null, meaning that it has no value.
 */ */
 class PEGASUS_COMMON_LINKAGE CIMName class PEGASUS_COMMON_LINKAGE CIMName
 { {
 public: public:
  
       /**
           Constructs a null CIMName.
       */
     CIMName();     CIMName();
   
       /**
           Constructs a non-null CIMName with the specified name.
           @param name A String containing the CIM name.
           @exception InvalidNameException If the String does not contain a
               valid CIM name.
       */
     CIMName(const String& name);     CIMName(const String& name);
   
       /**
           Constructs a non-null CIMName with the specified name.
           @param name A character string containing the CIM name.
           @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(const char* name);     CIMName(const char* name);
  
       /**
           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);
     CIMName& operator=(const String& name);  
     CIMName& operator=(const char* name);  
  
 #if 0      /**
     String toString() const;          Sets the CIMName with a String name.  The resulting CIMName object
 #endif          is non-null.
           <p><b>Example:</b>
           <pre>
           CIMName n;
           String type = "type";
           n = type;
           </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);
  
     operator String() const;      /**
           Gets a String form of the CIM name.
           <p><b>Example:</b>
           <pre>
           CIMName n("name");
           String s = n.getString();
           </pre>
           @return A reference to a String containing the CIM name.
       */
       const String& getString() const;
  
       /**
           Determines whether the CIM name is null.
           <p><b>Example:</b>
           <pre>
           CIMName n;
           assert(n.isNull());
           n = "name";
           assert(!n.isNull());
           </pre>
           @return True if the CIM name is null, false otherwise.
       */
     Boolean isNull() const;     Boolean isNull() const;
  
       /**
           Sets the CIM name to a null value.
           <p><b>Example:</b>
           <pre>
           CIMName n("name");
           n.clear();
           assert(n.isNull());
           </pre>
       */
     void clear();     void clear();
  
     /** equal - Compares two names.      /**
         @return Return true if the two names are equal. CIM names are          Compares the CIMName with a specified CIMName.  Comparisons of
         case insensitive and so it this method.          CIM names are case-insensitive.
           <p><b>Example:</b>
           <pre>
           CIMName n1("name");
           CIMName n2("Name");
           assert(n1.equal(n2));
           </pre>
           @param name The CIMName to be compared.
           @return True if this name is equivalent to the specified name,
               false otherwise.
     */     */
     Boolean equal(const CIMName& name) const;     Boolean equal(const CIMName& name) const;
  
     //  ATTN: Define what is legal      /**
     /** legal - Determine if the name string input is legal as          Determines whether a name is a valid CIM name.
         defnined in the CIMName class definition          <p><b>Example:</b>
         @param - String to test          <pre>
         @return Returns true if the given name is legal.          assert(CIMName::legal("name"));
     */          assert(!CIMName::legal("3types"));
     static Boolean legal(const String& name) throw();          </pre>
           @param name A String containing the name to test.
 #if 0          @return True if the specified name is a valid CIM name,
     /** equal - Compares two names.              false otherwise.
         @return Return true if the two names are equal. CIM names are      */
         case insensitive and so it this method.      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.
     */     */
     static Boolean equal(const String& name1, const String& name2) throw();      Boolean equal(const char* name) const;
 #endif  
       /**
           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;
 }; };
  
 #if 0  /**
 PEGASUS_COMMON_LINKAGE PEGASUS_STD(ostream)& operator<<(      Compares two CIM names for equality.
     PEGASUS_STD(ostream)& os,      <p><b>Example:</b>
     const CIMName& name);      <pre>
 #endif      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==(
       const CIMName& name1,
       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"
Line 124 
Line 243 
 //////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
  
 /** /**
     The CIMNameSpace 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:
         <CIMName>[/<CIMName>]...      <pre>
     </PRE>          &lt;CIMName&gt;[ / &lt;CIMName&gt; ]*
       </pre>
       A namespace name with a leading '/' character is accepted, but the
       leading character is removed.
       A CIMNamespaceName may be null, meaning that it has no value.
 */ */
 class PEGASUS_COMMON_LINKAGE CIMNamespaceName class PEGASUS_COMMON_LINKAGE CIMNamespaceName
 { {
 public: public:
  
       /**
           Constructs a null CIMName.
       */
     CIMNamespaceName();     CIMNamespaceName();
   
       /**
           Constructs a non-null CIMNamespaceName with the specified name.
           @param name A String containing the CIM namespace name.
           @exception InvalidNameException If the String does not contain a
               valid CIM namespace name.
       */
     CIMNamespaceName(const String& name);     CIMNamespaceName(const String& name);
   
       /**
           Constructs a non-null CIMNamespaceName with the specified name.
           @param name A character string containing the CIM namespace name.
           @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(const char* name);     CIMNamespaceName(const char* name);
  
       /**
           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);
     CIMNamespaceName& operator=(const String& name);  
     CIMNamespaceName& operator=(const char* name);  
  
 #if 0      /**
     String toString() const;          Sets the CIMNamespaceName with a String name.  The resulting
 #endif          CIMNamespaceName object is non-null.
           <p><b>Example:</b>
           <pre>
           CIMNamespaceName n;
           String name = "root/cimv2";
           n = name;
           </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);
  
     operator String() const;      /**
           Gets a String form of the CIM namespace name.
           <p><b>Example:</b>
           <pre>
           CIMNamespaceName n("test/ns1");
           String s = n.getString();
           </pre>
           @return A reference to a String containing the CIM namespace name.
       */
       const String& getString() const;
  
       /**
           Determines whether the CIM namespace name is null.
           <p><b>Example:</b>
           <pre>
           CIMNamespaceName n;
           assert(n.isNull());
           n = "root/test";
           assert(!n.isNull());
           </pre>
           @return True if the CIM namespace name is null, false otherwise.
       */
     Boolean isNull() const;     Boolean isNull() const;
  
       /**
           Sets the CIM namespace name to a null value.
           <p><b>Example:</b>
           <pre>
           CIMNamespaceName n("root/test");
           n.clear();
           assert(n.isNull());
           </pre>
       */
     void clear();     void clear();
  
     /** equal - Compares two names.      /**
         @return Return true if the two names are equal. CIM names are          Compares the CIMNamespaceName with a specified CIMNamespaceName.
         case insensitive and so it this method.          Comparisons of CIM namespace names are case-insensitive.
           <p><b>Example:</b>
           <pre>
           CIMNamespaceName n1("root/cimv2");
           CIMNamespaceName n2("Root/CimV2");
           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;
  
     //  ATTN: Define what is legal      /**
     /** legal - Determine if the name string input is legal as          Determines whether a name is a valid CIM namespace name.
         defnined in the CIMNamespaceName class definition          <p><b>Example:</b>
         @param - String to test          <pre>
         @return Returns true if the given name is legal.          assert(CIMNamespaceName::legal("root/test"));
     */          assert(!CIMNamespaceName::legal("Wrong!"));
     static Boolean legal(const String& name) throw();          </pre>
           @param name A String containing the name to test.
 #if 0          @return True if the specified name is a valid CIM namespace name,
     /** equal - Compares two names.              false otherwise.
         @return Return true if the two names are equal. CIM names are  
         case insensitive and so it this method.  
     */     */
     static Boolean equal(const String& name1, const String& name2) throw();      static Boolean legal(const String& name);
 #endif  
   #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==(
       const CIMNamespaceName& name1,
       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
   # include "ArrayInter.h"
   #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.17  
changed lines
  Added in v.1.40

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2