1*fce4895dSRene Gollent /* 2*fce4895dSRene Gollent * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3*fce4895dSRene Gollent * Distributed under the terms of the MIT License. 4*fce4895dSRene Gollent */ 5*fce4895dSRene Gollent 6*fce4895dSRene Gollent 7*fce4895dSRene Gollent #include "BoolValue.h" 8*fce4895dSRene Gollent 9*fce4895dSRene Gollent BoolValue(bool value)10*fce4895dSRene GollentBoolValue::BoolValue(bool value) 11*fce4895dSRene Gollent : 12*fce4895dSRene Gollent fValue(value) 13*fce4895dSRene Gollent { 14*fce4895dSRene Gollent } 15*fce4895dSRene Gollent 16*fce4895dSRene Gollent ~BoolValue()17*fce4895dSRene GollentBoolValue::~BoolValue() 18*fce4895dSRene Gollent { 19*fce4895dSRene Gollent } 20*fce4895dSRene Gollent 21*fce4895dSRene Gollent 22*fce4895dSRene Gollent bool ToString(BString & _string) const23*fce4895dSRene GollentBoolValue::ToString(BString& _string) const 24*fce4895dSRene Gollent { 25*fce4895dSRene Gollent BString string = fValue ? "true" : "false"; 26*fce4895dSRene Gollent if (string.Length() == 0) 27*fce4895dSRene Gollent return false; 28*fce4895dSRene Gollent 29*fce4895dSRene Gollent _string = string; 30*fce4895dSRene Gollent return true; 31*fce4895dSRene Gollent } 32*fce4895dSRene Gollent 33*fce4895dSRene Gollent 34*fce4895dSRene Gollent bool ToVariant(BVariant & _value) const35*fce4895dSRene GollentBoolValue::ToVariant(BVariant& _value) const 36*fce4895dSRene Gollent { 37*fce4895dSRene Gollent _value = fValue; 38*fce4895dSRene Gollent return true; 39*fce4895dSRene Gollent } 40*fce4895dSRene Gollent 41*fce4895dSRene Gollent 42*fce4895dSRene Gollent bool operator ==(const Value & other) const43*fce4895dSRene GollentBoolValue::operator==(const Value& other) const 44*fce4895dSRene Gollent { 45*fce4895dSRene Gollent const BoolValue* otherBool = dynamic_cast<const BoolValue*>(&other); 46*fce4895dSRene Gollent return otherBool != NULL ? fValue == otherBool->fValue : false; 47*fce4895dSRene Gollent } 48