1 karl 1.4 //%2006////////////////////////////////////////////////////////////////////////
|
2 r.kieninger 1.2 //
3 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
6 // IBM Corp.; EMC Corporation, The Open Group.
7 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
9 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.4 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.;
12 // EMC Corporation; Symantec Corporation; The Open Group.
|
13 r.kieninger 1.2 //
14 // Permission is hereby granted, free of charge, to any person obtaining a copy
15 // of this software and associated documentation files (the "Software"), to
16 // deal in the Software without restriction, including without limitation the
17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
18 // sell copies of the Software, and to permit persons to whom the Software is
19 // furnished to do so, subject to the following conditions:
|
20 karl 1.4 //
|
21 r.kieninger 1.2 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
22 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
24 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
27 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30 //==============================================================================
31 //
32 //%/////////////////////////////////////////////////////////////////////////////
33
|
34 mike 1.3 #if !defined(Pegasus_CIMNameInline_cxx)
35 # if !defined(PEGASUS_INTERNALONLY) || defined(PEGASUS_DISABLE_INTERNAL_INLINES)
36 # define Pegasus_CIMNameInline_h
37 # endif
|
38 r.kieninger 1.2 #endif
39
40 #ifndef Pegasus_CIMNameInline_h
41 #define Pegasus_CIMNameInline_h
42
43 #include <Pegasus/Common/CIMName.h>
44
45 #ifdef Pegasus_CIMNameInline_cxx
46 # define PEGASUS_CIMNAME_INLINE
47 #else
48 # define PEGASUS_CIMNAME_INLINE inline
49 #endif
50
51 PEGASUS_NAMESPACE_BEGIN
52
53 PEGASUS_CIMNAME_INLINE CIMName::CIMName()
54 {
55 }
56
57 PEGASUS_CIMNAME_INLINE CIMName& CIMName::operator=(const CIMName& name)
58 {
59 r.kieninger 1.2 cimName = name.cimName;
60 return *this;
61 }
62
63 PEGASUS_CIMNAME_INLINE const String& CIMName::getString() const
64 {
65 return cimName;
66 }
67
68 PEGASUS_CIMNAME_INLINE Boolean CIMName::isNull() const
69 {
|
70 kumpf 1.5 return cimName.size() == 0;
|
71 r.kieninger 1.2 }
72
73 PEGASUS_CIMNAME_INLINE void CIMName::clear()
74 {
75 cimName.clear();
76 }
77
78 PEGASUS_CIMNAME_INLINE Boolean CIMName::equal(const CIMName& name) const
79 {
80 return String::equalNoCase(cimName, name.cimName);
81 }
82
83 PEGASUS_CIMNAME_INLINE Boolean CIMName::equal(const char* name) const
84 {
85 return String::equalNoCase(cimName, name);
86 }
87
88 PEGASUS_CIMNAME_INLINE Boolean operator==(
89 const CIMName& name1, const CIMName& name2)
90 {
91 return name1.equal(name2);
92 r.kieninger 1.2 }
93
94 PEGASUS_CIMNAME_INLINE Boolean operator==(
95 const CIMName& name1, const char* name2)
96 {
97 return name1.equal(name2);
98 }
99
100 PEGASUS_CIMNAME_INLINE Boolean operator==(
101 const char* name1, const CIMName& name2)
102 {
103 return name2.equal(name1);
104 }
105
106 PEGASUS_CIMNAME_INLINE Boolean operator!=(
107 const CIMName& name1, const CIMName& name2)
108 {
109 return !name1.equal(name2);
110 }
111
112 PEGASUS_CIMNAME_INLINE Boolean operator!=(
113 r.kieninger 1.2 const CIMName& name1, const char* name2)
114 {
115 return !name1.equal(name2);
116 }
117
118 PEGASUS_CIMNAME_INLINE Boolean operator!=(
119 const char* name1, const CIMName& name2)
120 {
121 return !name2.equal(name1);
122 }
123
124 PEGASUS_CIMNAME_INLINE CIMNamespaceName::CIMNamespaceName()
125 {
126 }
127
128 PEGASUS_CIMNAME_INLINE const String& CIMNamespaceName::getString() const
129 {
130 return cimNamespaceName;
131 }
132
133 PEGASUS_CIMNAME_INLINE Boolean CIMNamespaceName::isNull() const
134 r.kieninger 1.2 {
|
135 kumpf 1.5 return cimNamespaceName.size() == 0;
|
136 r.kieninger 1.2 }
137
138 PEGASUS_CIMNAME_INLINE void CIMNamespaceName::clear()
139 {
140 cimNamespaceName.clear();
141 }
142
143 PEGASUS_CIMNAME_INLINE Boolean CIMNamespaceName::equal(
144 const CIMNamespaceName& name) const
145 {
146 return String::equalNoCase(cimNamespaceName, name.cimNamespaceName);
147 }
148
149 PEGASUS_CIMNAME_INLINE Boolean CIMNamespaceName::equal(const char* name) const
150 {
151 return String::equalNoCase(cimNamespaceName, name);
152 }
153
|
154 mike 1.6 //
155 // This function performs a compile-time cast from String to CIMName. It should
156 // only be used where the String is already known to contain a valid CIM name,
157 // thereby avoiding the overhead of checking every character of the String.
158 // This cast is possible because CIMName has a single String member. Note that
159 // that sizeof(CIMName) == sizeof(String) and that the classes are identical
160 // in their representation, differing only by interface. When compiled for
161 // debug, this function checks that str refers to a valid CIM name.
162 //
163 inline const CIMName& CIMNameCast(const String& str)
164 {
165 #if defined(PEGASUS_DEBUG)
166
|
167 kumpf 1.8 if (str.size() && !CIMName::legal(str))
|
168 mike 1.6 {
169 throw InvalidNameException(str);
170 }
171
172 #endif
173
|
174 kumpf 1.8 return *(reinterpret_cast<const CIMName*>(&str));
175 }
176
177 inline const CIMNamespaceName& CIMNamespaceNameCast(const String& str)
178 {
179 #if defined(PEGASUS_DEBUG)
180
181 if (str.size() && !CIMNamespaceName::legal(str))
182 {
183 throw InvalidNamespaceNameException(str);
184 }
185
186 #endif
187
188 return *(reinterpret_cast<const CIMNamespaceName*>(&str));
|
189 mike 1.6 }
190
|
191 mike 1.7 /** Checks whether a given character string consists of ASCII only and
192 legal characters for a CIMName (i.e. letter, numbers and underscore)
193 The first character has to be a letter or underscore
194 @param str character string to be checked
195 @return 0 in case non-legal ASCII character was found
196 >0 length of the character string str
197 */
198 PEGASUS_COMMON_LINKAGE Uint32 CIMNameLegalASCII(const char* str);
199
|
200 r.kieninger 1.2 PEGASUS_NAMESPACE_END
201
202 #endif /* Pegasus_CIMNameInline_h */
|