version 1.31, 2005/05/03 20:52:06
|
version 1.32, 2005/05/08 13:52:37
|
|
|
<li>Type - legal name | <li>Type - legal name |
<li>3types - Illegal CIMName. | <li>3types - Illegal CIMName. |
</ul> | </ul> |
The CIMName object includes the attribute Null which is required |
The CIMName class includes the attribute Null which is required |
by the DMTF operations definitions. Note that this and the regular | by the DMTF operations definitions. Note that this and the regular |
expression limits on CIMName are what separate this from the String | expression limits on CIMName are what separate this from the String |
class. This allows the names in CIM operations such as getClass to |
class. This allows the names in CIM operations, such as getClass, to |
provide pattern matching tests for the classname parameter as well as | provide pattern matching tests for the classname parameter as well as |
separate the concept of empty from Null. | separate the concept of empty from Null. |
| |
|
|
{ | { |
public: | public: |
| |
/** Default constructor (sets isNull to true). |
/** |
|
Constructs an object with no name. A call to isNull() immediately |
|
after constructing the object will return true. |
|
|
|
@exception bad_alloc Thrown if there is insufficient memory. |
*/ | */ |
CIMName(); | CIMName(); |
| |
/** Constructor creates a new CIMName object from |
/** |
the String provided as input. The String must |
Constructor creates a new CIMName object from the String |
be a legal name. |
provided as input. The String must be a legal name. |
@param String defining the CIMName |
|
@Exception InvalidNameException if the input String is |
@param name defining the CIMName |
|
@exception InvalidNameException if the input String is |
not a legal CIMName | not a legal CIMName |
|
@exception bad_alloc Thrown if there is insufficient memory. |
*/ | */ |
CIMName(const String& name); | CIMName(const String& name); |
|
|
/** | /** |
Constructor creates a new CIMName object from |
Constructor creates a new CIMName object from string |
the String provided as input. The String must |
provided as input. The string must be a legal name. |
be a legal name. |
|
@param char* defining the CIMName text. | @param char* defining the CIMName text. |
@Exception InvalidNameException if the input String is |
@exception InvalidNameException if the input String is |
not a legal CIMName | not a legal CIMName |
|
@exception bad_alloc Thrown if there is insufficient memory. |
*/ | */ |
CIMName(const char* name); | CIMName(const char* name); |
| |
/** Copy Constructor for CIMName object |
/** |
|
Assigns one CIMName to another. |
|
|
|
@param name Source CIMName object to copy. |
|
@exception bad_alloc Thrown if there is insufficient memory. |
*/ | */ |
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 name of the associated object to the |
|
specified String. |
|
|
|
@param name The new name to use for the object. |
@exception InvalidNameException if the input String | @exception InvalidNameException if the input String |
is not a legal CIMName |
is not a legal CIMName. |
|
@exception bad_alloc Thrown if there is insufficient memory. |
|
|
<pre> | <pre> |
CIMName n; | CIMName n; |
String type = "type"; | String type = "type"; |
|
|
*/ | */ |
CIMName& operator=(const String& name); | CIMName& operator=(const String& name); |
| |
/** Extracts the String value of the CIMName |
/** |
from the CIMName object. |
Gets a reference a String containing the name from the |
@return String containing the name. |
associated object. |
|
|
|
@return Reference to a String containing the name. |
|
|
<pre> | <pre> |
CIMName n("name"); | CIMName n("name"); |
String s = n.getString(); | String s = n.getString(); |
|
|
*/ | */ |
const String& getString() const; | const String& getString() const; |
| |
/** Tests the CIMName for NULL attribute. |
/** |
@return true if Null or false if not Null. |
Tests if name is Null, i.e. not set. |
|
|
|
@return true if name is Null, false if not. |
|
|
<pre> | <pre> |
CIMName n; | CIMName n; |
assert(n.isNull()); | assert(n.isNull()); |
|
|
*/ | */ |
Boolean isNull() const; | Boolean isNull() const; |
| |
/** Clears the CIMName and sets it to Null. |
/** |
|
Clears the CIMName. |
|
|
<pre> | <pre> |
CIMMame n("name"); | CIMMame n("name"); |
n.clear(); | n.clear(); |
|
|
*/ | */ |
void clear(); | void clear(); |
| |
/** Compares the CIMName object against another CIMName object for equality. |
/** |
@param CIMName to compare. |
Compares the CIMName object against another CIMName object for equality. |
|
|
|
@param name Object to compare with the associated object. |
@return true if the name passed is equal to the name in this | @return true if the name passed is equal to the name in this |
|
|
class. CIM names are case insensitive and so is this method. | class. CIM names are case insensitive and so is this method. |
<pre> | <pre> |
CIMName n1 = "name"; | CIMName n1 = "name"; |
|
|
*/ | */ |
Boolean equal(const CIMName& name) const; | Boolean equal(const CIMName& name) const; |
| |
/** Determines if the name string input is legal as |
/** |
|
Determines if the name string input is legal as |
defined in the CIMName class definition. This is a static | defined in the CIMName class definition. This is a static |
method used to test String values to determine if they are | method used to test String values to determine if they are |
legal names. | legal names. |
|
|
@param name String to test for legality. | @param name String to test for legality. |
@return true if the given name is legal, false otherwise. |
@return Returns true if the name is legal, otherwise false. |
|
|
<pre> | <pre> |
assert(CIMName::legal("name")); | assert(CIMName::legal("name")); |
assert(!CIMName::legal("3types")); | assert(!CIMName::legal("3types")); |
|
|
String cimName; | String cimName; |
}; | }; |
| |
|
/** |
|
Compares two CIMNames to determine if they are equal. |
|
|
|
@param name1 One name to compare. |
|
@param name2 Another name to compare |
|
@return Returns true if the names are equal, false if they are not. |
|
|
|
CIMNames are not case sensitive, therefore the output of the |
|
following example is "Equal". |
|
|
|
<pre> |
|
CIMName lowerCaseName("this_is_a_name"); |
|
CIMName upperCaseName("THIS_IS_A_NAME"); |
|
|
|
if (lowerCaseName == upperCaseName) |
|
{ |
|
puts("Equal"); |
|
} |
|
else |
|
{ |
|
puts("Not equal"); |
|
} |
|
</pre> |
|
*/ |
PEGASUS_COMMON_LINKAGE Boolean operator==( | PEGASUS_COMMON_LINKAGE Boolean operator==( |
const CIMName& name1, | const CIMName& name1, |
const CIMName& name2); | const CIMName& name2); |
| |
|
/** |
|
Compares two CIMNames to determine if they are not equal. |
|
|
|
@param name1 One name to compare. |
|
@param name2 Another name to compare |
|
@return Returns true if the names are not equal, false if they are. |
|
|
|
The output of the following example is "Not equal". |
|
|
|
<pre> |
|
CIMName name1("this_is_a_name"); |
|
CIMName name2("this is another_name"); |
|
|
|
if (name1 != name2) |
|
{ |
|
puts("Not equal"); |
|
} |
|
else |
|
{ |
|
puts("Equal"); |
|
} |
|
</pre> |
|
*/ |
PEGASUS_COMMON_LINKAGE Boolean operator!=( | PEGASUS_COMMON_LINKAGE Boolean operator!=( |
const CIMName& name1, | const CIMName& name1, |
const CIMName& name2); | const CIMName& name2); |