1 karl 1.1 //%LICENSE////////////////////////////////////////////////////////////////
2 //
3 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
9 //
10 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
16 //
17 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 karl 1.1 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 //
28 //////////////////////////////////////////////////////////////////////////
29 //
30 //%////////////////////////////////////////////////////////////////////////////
31
32 #include <Pegasus/Common/UintArgs.h>
33 #include <Pegasus/Common/StringConversion.h>
34
35 PEGASUS_NAMESPACE_BEGIN
36
37 //
38 // Uint32Arg Integer Class used for parameters that
39 // require Uint32 on input or output. Provides for NULL as well as
40 // all Uint32 values
41 //
42 Uint32Arg::Uint32Arg() : _value(0), _null(true)
43 karl 1.1 {
44 }
45
46 Uint32Arg::Uint32Arg(const Uint32Arg& x) :
47 _value(x._value), _null(x._null)
48 {
49 }
50
51 Uint32Arg::Uint32Arg(Uint32 x) : _value(x), _null(false)
52 {
53 }
54
55 Uint32Arg::~Uint32Arg()
56 {
57 }
58
59 Uint32Arg& Uint32Arg::operator=(const Uint32Arg& x)
60 {
61 if (&x != this)
62 {
63 _value = x._value;
64 karl 1.1 _null = x._null;
65 }
66
67 return *this;
68 }
69
70
71 const Uint32& Uint32Arg::getValue() const
72 {
73 return _value;
74 }
75
76 void Uint32Arg::setValue(Uint32 x)
77 {
78 _value = x;
79 _null = false;
80 }
81
82 Boolean Uint32Arg::isNull() const
83 {
84 return _null;
85 karl 1.1 }
86
87 void Uint32Arg::setNullValue()
88 {
89 _value = 0;
90 _null = true;
91 }
92
93 String Uint32Arg::toString()
94 {
95 String s;
96 if (_null)
97 {
98 s = "NULL";
99 }
100 else
101 {
102 char buffer[22];
103 Uint32 size;
104 const char* rtn = Uint32ToString(buffer, _value, size);
105 s = rtn;
106 karl 1.1 }
107 return s;
108 }
109 Boolean Uint32Arg::equal(const Uint32Arg& x) const
110 {
111 if ((_null != x._null))
112 {
113 return false;
114 }
115 return _null? true : (_value == x._value);
116 }
117
118 Boolean operator==(const Uint32Arg& x, const Uint32Arg& y)
119 {
120 return x.equal(y);
121 }
122 // Uint64 Class Used for handling of Uint64
123 // parameters on Client input and output
124 //
125
126 Uint64Arg::Uint64Arg() : _value(0), _null(true)
127 karl 1.1 {
128 }
129
130 Uint64Arg::Uint64Arg(const Uint64Arg& x) :
131 _value(x._value), _null(x._null)
132 {
133 }
134
135 Uint64Arg::Uint64Arg(Uint64 x) : _value(x), _null(false)
136 {
137 }
138
139 Uint64Arg::~Uint64Arg()
140 {
141 }
142
143 Uint64Arg& Uint64Arg::operator=(const Uint64Arg& x)
144 {
145 if (&x != this)
146 {
147 _value = x._value;
148 karl 1.1 _null = x._null;
149 }
150
151 return *this;
152 }
153
154
155 const Uint64& Uint64Arg::getValue() const
156 {
157 return _value;
158 }
159
160 void Uint64Arg::setValue(Uint64 x)
161 {
162 _value = x;
163 _null = false;
164 }
165
166 Boolean Uint64Arg::isNull() const
167 {
168 return _null;
169 karl 1.1 }
170
171 void Uint64Arg::setNullValue()
172 {
173 _value = 0;
174 _null = true;
175 }
176 String Uint64Arg::toString()
177 {
178 String s;
179 if (_null)
180 {
181 s = "NULL";
182 }
183 else
184 {
185 char buffer[22];
186 Uint32 size;
187 const char* rtn = Uint64ToString(buffer, _value, size);
188 s = rtn;
189 }
190 karl 1.1 return s;
191 }
192
193 Boolean Uint64Arg::equal(const Uint64Arg& x) const
194 {
195 if ((_null != x._null))
196 {
197 return false;
198 }
199 return _null? true : (_value == x._value);
200 }
201 Boolean operator==(const Uint64Arg& x, const Uint64Arg& y)
202 {
203 return x.equal(y);
204 }
205 PEGASUS_NAMESPACE_END
|