version 1.29, 2004/10/17 20:39:16
|
version 1.35, 2005/11/27 03:11:36
|
|
|
//%2004//////////////////////////////////////////////////////////////////////// |
//%2005//////////////////////////////////////////////////////////////////////// |
// | // |
// Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development | // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development |
// Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. | // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. |
|
|
// IBM Corp.; EMC Corporation, The Open Group. | // IBM Corp.; EMC Corporation, The Open Group. |
// Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; | // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; |
// IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. | // 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. |
// | // |
// 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 |
|
|
CIM names. A CIM name must match the following regular | CIM names. A CIM name must match the following regular |
expression: | expression: |
<PRE> | <PRE> |
[A-Z-a-z_][A-Za-z_0-9]* |
[A-Za-z_][A-Za-z_0-9]* |
</PRE> | </PRE> |
<B>Examples:</B> | <B>Examples:</B> |
<ul> | <ul> |
<li>name - legal name | <li>name - legal name |
<li>Type - legal name | <li>Type - legal name |
<li>3types - Illegal CIMName. |
<li>3types - Illegal CIM name |
</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 <TT>name</TT>. |
be a legal name. |
<TT>name</TT> must be a legal CIM name. |
@param String defining the CIMName |
|
@Exception InvalidNameException if the input String is |
@param name The name to use for the object. |
not a legal CIMName |
@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 |
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 name The name to use for the object. |
@Exception InvalidNameException if the input String is |
@exception InvalidNameException if <TT>name</TT> is not |
not a legal CIMName |
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 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 <TT>name</TT>. |
@exception InvalidNameException if the input String |
|
is not a legal CIMName |
@param name The new name to use for the object. |
|
@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"; |
|
|
*/ | */ |
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()); |
PEGASUS_ASSERT(n.isNull()); |
n = "name"; | n = "name"; |
assert(!n.isNull()); |
PEGASUS_ASSERT(!n.isNull()); |
</pre> | </pre> |
*/ | */ |
Boolean isNull() const; | Boolean isNull() const; |
| |
/** Clears the CIMName and sets it to Null. |
/** |
|
Clears the CIMName. |
|
|
<pre> | <pre> |
CIMMame n("name"); |
CIMName n("name"); |
n.clear(); | n.clear(); |
assert(n.isNull()); |
PEGASUS_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 object against another CIMName object |
|
for equality. |
|
|
|
@param name CIMName 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> |
|
|
*/ | */ |
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")); |
PEGASUS_ASSERT(CIMName::legal("name")); |
assert(!CIMName::legal("3types")); |
PEGASUS_ASSERT(!CIMName::legal("3types")); |
</pre> | </pre> |
*/ | */ |
static Boolean legal(const String& name); | static Boolean legal(const String& name); |
| |
|
#ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES |
|
|
|
Boolean equal(const char* name) const; |
|
|
|
CIMName& operator=(const char* name); |
|
|
|
#endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */ |
|
|
private: | private: |
String cimName; | String cimName; |
|
friend class CIMNameUnchecked; |
}; | }; |
| |
|
/** |
|
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!=( |
|
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 |
|
|
@return true if Null or false if not Null. | @return true if Null or false if not Null. |
<pre> | <pre> |
CIMName n; | CIMName n; |
assert(n.isNull()); |
PEGASUS_ASSERT(n.isNull()); |
n = "name"; | n = "name"; |
assert(!n.isNull()); |
PEGASUS_ASSERT(!n.isNull()); |
</pre> | </pre> |
*/ | */ |
Boolean isNull() const; | Boolean isNull() const; |
|
|
object contains no name so that accessing it with getString | object contains no name so that accessing it with getString |
should return an empty String | should return an empty String |
<pre> | <pre> |
CIMMamespaceName ns("root/test"); |
CIMNamespaceName ns("root/test"); |
ns.clear(); | ns.clear(); |
assert(ns.isNull()); |
PEGASUS_ASSERT(ns.isNull()); |
</pre> | </pre> |
*/ | */ |
void clear(); | void clear(); |
|
|
@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> |
CIMMamespaceName ns("root/test"); |
CIMNamespaceName ns("root/test"); |
CIMMamespaceName ns1("root/test"); |
CIMNamespaceName ns1("root/test"); |
assert( ns.equal(ns1); |
PEGASUS_ASSERT( ns.equal(ns1); |
</pre> | </pre> |
*/ | */ |
Boolean equal(const CIMNamespaceName& name) const; | Boolean equal(const CIMNamespaceName& name) const; |
|
|
@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 true if the given name is legal, false otherwise. |
<pre> | <pre> |
assert(CIMNamespaceName::legal("root/test")); |
PEGASUS_ASSERT(CIMNamespaceName::legal("root/test")); |
</pre> | </pre> |
*/ | */ |
static Boolean legal(const String& name); | static Boolean legal(const String& name); |
| |
|
#ifdef PEGASUS_USE_EXPERIMENTAL_INTERFACES |
|
|
|
Boolean equal(const char* name) const; |
|
|
|
CIMNamespaceName& operator=(const char* name); |
|
|
|
#endif /* PEGASUS_USE_EXPERIMENTAL_INTERFACES */ |
|
|
private: | private: |
String cimNamespaceName; | String cimNamespaceName; |
}; | }; |
|
|
const CIMNamespaceName& name1, | const CIMNamespaceName& name1, |
const CIMNamespaceName& name2); | const CIMNamespaceName& name2); |
| |
|
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 */ |