2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://www.apache.org/licenses/LICENSE-2.0
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
19 * @brief This is the implementation file for Boolean class.
21 #include <FBaseBoolean.h>
22 #include <FBaseResult.h>
24 namespace Tizen { namespace Base
27 Boolean::Boolean(bool value)
29 , __pBooleanImpl(null)
33 Boolean::Boolean(const Boolean& value)
35 , __pBooleanImpl(null)
39 Boolean::Boolean(const String& value)
41 const String trueString = L"true";
44 value.ToLower(lowString);
46 if (lowString.Equals(trueString))
55 __pBooleanImpl = null;
58 Boolean::~Boolean(void)
63 Boolean::operator ==(const Boolean& rhs) const
65 return(value == rhs.value);
69 Boolean::operator !=(const Boolean& rhs) const
71 return(value != rhs.value);
75 Boolean::operator =(const Boolean& rhs)
86 Boolean::Equals(const Object& obj) const
88 const Boolean* pOther = dynamic_cast< const Boolean* >(&obj);
94 return *this == *pOther;
98 Boolean::GetHashCode(void) const
100 return static_cast< int >(value);
104 Boolean::Equals(bool value) const
106 return this->value == value;
110 Boolean::ToBool(void) const
116 Boolean::Parse(const String& s)
118 const String trueString = L"true";
119 if (s.Equals(trueString))
128 Boolean::Parse(const String& s, bool caseSensitive)
130 const String trueString = L"true";
134 if (s.Equals(trueString))
141 int len = s.GetLength();
142 int trueLen = trueString.GetLength();
144 result r = E_SUCCESS;
153 r = s.ToLower(lowString);
154 if (!lowString.Equals(trueString))
166 Boolean::ToString(void) const
168 return(Boolean::ToString(value));
172 Boolean::ToString(bool value)
189 Boolean::GetTrue(void)
191 static const Boolean True(true);
196 Boolean::GetFalse(void)
198 static const Boolean False(false);