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.
22 #include <FBaseBoolean.h>
23 #include <FBaseResult.h>
26 namespace Tizen { namespace Base
29 Boolean::Boolean(bool value)
31 , __pBooleanImpl(null)
35 Boolean::Boolean(const Boolean& value)
37 , __pBooleanImpl(null)
41 Boolean::Boolean(const String& value)
43 const String trueString = L"true";
46 value.ToLower(lowString);
48 if (lowString.Equals(trueString))
57 __pBooleanImpl = null;
60 Boolean::~Boolean(void)
65 Boolean::operator ==(const Boolean& rhs) const
67 return(value == rhs.value);
71 Boolean::operator !=(const Boolean& rhs) const
73 return(value != rhs.value);
77 Boolean::operator =(const Boolean& rhs)
88 Boolean::Equals(const Object& obj) const
90 const Boolean* pOther = dynamic_cast <const Boolean*>(&obj);
96 return *this == *pOther;
100 Boolean::GetHashCode(void) const
102 return static_cast<int> (value);
106 Boolean::Equals(bool value) const
108 return this->value == value;
112 Boolean::ToBool(void) const
118 Boolean::Parse(const String& s)
120 const String trueString = L"true";
121 if (s.Equals(trueString))
130 Boolean::Parse(const String& s, bool caseSensitive)
132 const String trueString = L"true";
136 if (s.Equals(trueString))
143 int len = s.GetLength();
144 int trueLen = trueString.GetLength();
146 result r = E_SUCCESS;
155 r = s.ToLower(lowString);
156 if (!lowString.Equals(trueString))
168 Boolean::ToString(void) const
170 return(Boolean::ToString(value));
174 Boolean::ToString(bool value)
191 Boolean::GetTrue(void)
193 static const Boolean True(true);
198 Boolean::GetFalse(void)
200 static const Boolean False(false);