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