1 chip 1.1 //%/////////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2000 - 2003 BMC Software, Hewlett-Packard Company, IBM,
4 // The Open Group, Tivoli Systems
5 //
6 // Permission is hereby granted, free of charge, to any person obtaining a copy
7 // of this software and associated documentation files (the "Software"), to
8 // deal in the Software without restriction, including without limitation the
9 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10 // sell copies of the Software, and to permit persons to whom the Software is
11 // furnished to do so, subject to the following conditions:
12 //
13 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
14 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
15 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
16 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
17 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
18 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
19 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 //
22 chip 1.1 //==============================================================================
23 //
24 // Author: Chip Vincent (cvincent@us.ibm.com)
25 //
26 // Modified By:
27 //
28 //%/////////////////////////////////////////////////////////////////////////////
29
30 #include "InternalProviderName.h"
31
32 #include <Pegasus/Common/CIMValue.h>
33
34 PEGASUS_NAMESPACE_BEGIN
35
36 InternalProviderName::InternalProviderName(const String & providerName)
37 : _physicalName(String::EMPTY), _logicalName(String::EMPTY), _objectName(String::EMPTY), _capabilities(0)
38 {
39 // NOTE: format ::= <physical_name>::<logical_name>::<object_name>::<capabilities>
40
41 String s = providerName;
42
43 chip 1.1 Uint32 beg = 0;
44 Uint32 end = 0;
45
46 // get physical name
47 beg = 0;
48 end = s.find("::");
49
50 String temp = s.subString(beg, end - beg);
51 _physicalName = temp;
52
53 s.remove(beg, end + 2); // skip past the "::"
54 beg = end;
55
56 // get logical name
57 beg = 0;
58 end = s.find("::");
59
60 temp = s.subString(beg, end - beg);
61 _logicalName = temp;
62
63 s.remove(beg, end + 2); // skip past the "::"
64 chip 1.1 beg = end;
65
66 // get object name
67 beg = 0;
68 end = s.find("::");
69
70 temp = s.subString(beg, end - beg);
71 _objectName = temp;
72
73 //s.remove(beg, end + 2); // skip past the "::"
74 //beg = end;
75
76 _objectName = temp;
77
78 /*
79 // get capabilities mask
80 beg = 0;
81 end = s.find("::");
82
83 _physicalName = String(s.subString(beg, end - beg));
84 */
85 chip 1.1 }
86
87 InternalProviderName::InternalProviderName(
88 const String & physicalName,
89 const String & logicalName,
90 const String & objectName)
91 : _physicalName(String::EMPTY), _logicalName(String::EMPTY), _objectName(String::EMPTY), _capabilities(0)
92 {
93 // ATTN: validate arguments ???
94 _physicalName = physicalName;
95
96 _logicalName = logicalName;
97
98 _objectName = objectName;
99 }
100
101 InternalProviderName::~InternalProviderName(void)
102 {
103 }
104
105 String InternalProviderName::toString(void) const
106 chip 1.1 {
107 String s;
108
109 s.append(_physicalName);
110 s.append("::");
111 s.append(_logicalName);
112 s.append("::");
113 s.append(_objectName);
114 //s.append("::");
115 //s.append(CIMValue(_capabilities).toString());
116
117 return(s);
118 }
119
120 String InternalProviderName::getPhysicalName(void) const
121 {
122 return(_physicalName);
123 }
124
125 void InternalProviderName::setPhysicalName(const String & physicalName)
126 {
127 chip 1.1 _physicalName = physicalName;
128 }
129
130 String InternalProviderName::getLogicalName(void) const
131 {
132 return(_logicalName);
133 }
134
135 void InternalProviderName::setLogicalName(const String & logicalName)
136 {
137 _logicalName = logicalName;
138 }
139
140 String InternalProviderName::getObjectName(void) const
141 {
142 return(_objectName);
143 }
144
145 void InternalProviderName::setObjectName(const String & logicalName)
146 {
147 _logicalName = logicalName;
148 chip 1.1 }
149
150 Uint32 InternalProviderName::getCapabilitiesMask(void) const
151 {
152 return(_capabilities);
153 }
154
155 void InternalProviderName::setCapabilitiesMask(const Uint32 capabilities)
156 {
157 _capabilities = capabilities;
158 }
159
160 PEGASUS_NAMESPACE_END
|