version 1.37, 2006/01/30 16:16:47
|
version 1.38, 2006/02/17 19:30:37
|
|
|
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
| |
/** | /** |
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-Za-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 CIM name |
<li>underscore (_) |
|
<li>UCS-2 characters in the range 0x0080 to 0xFFEF |
</ul> | </ul> |
The CIMName class 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: |
| |
/** | /** |
Constructs an object with no name. A call to isNull() immediately |
Constructs a null CIMName. |
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 <TT>name</TT>. |
Constructs a non-null CIMName with the specified name. |
<TT>name</TT> must be a legal CIM name. |
@param name A String containing the CIM name. |
|
@exception InvalidNameException If the String does not contain a |
@param name The name to use for the object. |
valid CIM name. |
@exception InvalidNameException if <TT>name</TT> is 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 string |
Constructs a non-null CIMName with the specified name. |
provided as input. The string must be a legal name. |
@param name A character string containing the CIM name. |
|
@exception InvalidNameException If the character string does not |
@param name The name to use for the object. |
contain a valid CIM name. |
@exception InvalidNameException if <TT>name</TT> is not |
|
a legal CIMName |
|
@exception bad_alloc Thrown if there is insufficient memory. |
|
*/ | */ |
CIMName(const char* name); | CIMName(const char* name); |
| |
/** | /** |
Assigns one CIMName to another. |
Assigns the value of the specified CIMName object to this object. |
|
@param name The CIMName object from which to assign this |
@param name CIMName object to copy. |
CIMName object. |
@exception bad_alloc Thrown if there is insufficient memory. |
|
*/ | */ |
CIMName& operator=(const CIMName& name); | CIMName& operator=(const CIMName& name); |
| |
/** | /** |
Sets the name of the associated object to <TT>name</TT>. |
Sets the CIMName with a String name. The resulting CIMName object |
|
is non-null. |
@param name The new name to use for the object. |
<p><b>Example:</b> |
@exception InvalidNameException if <TT>name</TT> 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"; |
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); |
| |
/** | /** |
Gets a reference a String containing the name from the |
Gets a String form of the CIM name. |
associated object. |
<p><b>Example:</b> |
|
|
@return Reference to a String containing the name. |
|
|
|
<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 if name is Null, i.e. not set. |
Determines whether the CIM name is null. |
|
<p><b>Example:</b> |
@return true if name is Null, false if not. |
|
|
|
<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. |
Sets the CIM name to a null value. |
|
<p><b>Example:</b> |
<pre> | <pre> |
CIMName n("name"); | CIMName n("name"); |
n.clear(); | n.clear(); |
|
|
void clear(); | void clear(); |
| |
/** | /** |
Compares the CIMName object against another CIMName object |
Compares the CIMName with a specified CIMName. Comparisons of |
for equality. |
CIM names are case-insensitive. |
|
<p><b>Example:</b> |
@param name CIMName to compare with the associated object. |
<pre> |
@return true if the name passed is equal to the name in this |
CIMName n1("name"); |
class. CIM names are case insensitive and so is this method. |
CIMName n2("Name"); |
<pre> |
assert(n1.equal(n2)); |
CIMName n1 = "name"; |
</pre> |
CIMName n2 = "InstanceID"; |
@param name The CIMName to be compared. |
if( n1.equal(n2) ) |
@return True if this name is equivalent to the specified name, |
... // Should never get here |
false otherwise. |
else |
|
... |
|
</pre> |
|
*/ | */ |
Boolean equal(const CIMName& name) const; | Boolean equal(const CIMName& name) const; |
| |
/** | /** |
Determines if the name string input is legal as |
Determines whether a name is a valid CIM name. |
defined in the CIMName class definition. This is a static |
<p><b>Example:</b> |
method used to test String values to determine if they are |
|
legal names. |
|
|
|
@param name String to test for legality. |
|
@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")); |
</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 | #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; | 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. |
|
*/ |
CIMName& operator=(const char* name); | CIMName& operator=(const char* name); |
| |
#endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */ | #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */ |
|
|
}; | }; |
| |
/** | /** |
Compares two CIMNames to determine if they are equal. |
Compares two CIM names for equality. |
|
<p><b>Example:</b> |
@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> | <pre> |
CIMName lowerCaseName("this_is_a_name"); | CIMName lowerCaseName("this_is_a_name"); |
CIMName upperCaseName("THIS_IS_A_NAME"); | CIMName upperCaseName("THIS_IS_A_NAME"); |
|
assert(lowerCaseName == upperCaseName); |
if (lowerCaseName == upperCaseName) |
|
{ |
|
puts("Equal"); |
|
} |
|
else |
|
{ |
|
puts("Not equal"); |
|
} |
|
</pre> | </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 CIMNames to determine if they are not equal. |
Compares two CIM names for inequality. |
|
@param x The first CIMName to be compared. |
@param name1 One name to compare. |
@param y The second CIMName to be compared. |
@param name2 Another name to compare |
@return False if the CIM names are equivalent, true otherwise. |
@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, |
|
|
//////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////// |
| |
/** | /** |
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> |
<CIMName>[ / <CIMName> ]* | <CIMName>[ / <CIMName> ]* |
</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. |
|
*/ | */ |
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> |
CIMNamespaceName 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> |
CIMNamespaceName ns("root/test"); |
<pre> |
CIMNamespaceName 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 | #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; | 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. |
|
*/ |
CIMNamespaceName& operator=(const char* name); | CIMNamespaceName& operator=(const char* name); |
| |
#endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */ | #endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */ |
|
|
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!=( | PEGASUS_COMMON_LINKAGE Boolean operator!=( |
const CIMNamespaceName& name1, | const CIMNamespaceName& name1, |
const CIMNamespaceName& name2); | const CIMNamespaceName& name2); |