00001 /* Copyright (c) 2007, Gennady Bystritsky <bystr@mac.com> 00002 * 00003 * Distributed under the MIT Licence. 00004 * This is free software. See 'LICENSE' for details. 00005 * You must read and accept the license prior to use. 00006 */ 00007 00008 #ifndef _SK_UTIL_BOOLEAN_ 00009 #define _SK_UTIL_BOOLEAN_ 00010 00011 #include <sk/util/Object.h> 00012 #include <sk/util/String.h> 00013 #include <ostream> 00014 00015 namespace sk { 00016 namespace util { 00017 class String; 00018 00019 class Boolean 00020 : public virtual sk::util::Object 00021 { 00022 public: 00023 Boolean(bool value); 00024 explicit Boolean(const sk::util::String& value); 00025 virtual ~Boolean(); 00026 00027 bool booleanValue() const; 00028 const sk::util::String toString() const; 00029 00030 // sk::util::Object re-implementation. 00031 const sk::util::Class getClass() const; 00032 00033 static bool parseBoolean(const sk::util::String& value); 00034 00035 static const Boolean& valueOf(bool value); 00036 static const Boolean& valueOf(const sk::util::String& value); 00037 static const Boolean& valueOf(const char* value); 00038 static const sk::util::String toString(bool value); 00039 00040 static const Boolean B_TRUE; 00041 static const Boolean B_FALSE; 00042 00043 private: 00044 bool _value; 00045 }; 00046 00047 std::ostream& operator << (std::ostream& stream, const sk::util::Boolean& boolean); 00048 } 00049 } 00050 00051 #endif /* _SK_UTIL_BOOLEAN_ */