00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: YCPBoolean.h 00014 00015 Author: Mathias Kettner <kettner@suse.de> 00016 Maintainer: Thomas Roelz <tom@suse.de> 00017 00018 /-*/ 00019 // -*- c++ -*- 00020 00021 #ifndef YCPBoolean_h 00022 #define YCPBoolean_h 00023 00024 00025 #include "YCPValue.h" 00026 00027 00034 class YCPBooleanRep : public YCPValueRep 00035 { 00036 bool v; 00037 00038 protected: 00039 friend class YCPBoolean; 00040 00044 YCPBooleanRep(bool v); 00045 00051 YCPBooleanRep(const char *r); 00052 00053 public: 00058 bool value() const; 00059 00067 YCPOrder compare(const YCPBoolean &) const; 00068 00073 string toString() const; 00074 00078 std::ostream & toStream (std::ostream & str) const; 00079 std::ostream & toXml (std::ostream & str, int indent ) const; 00080 00084 YCPValueType valuetype() const; 00085 }; 00086 00093 class YCPBoolean : public YCPValue 00094 { 00095 DEF_COMMON(Boolean, Value); 00096 00097 static YCPBoolean* trueboolean; 00098 static YCPBoolean* falseboolean; 00099 00100 public: 00101 YCPBoolean(bool v); 00102 YCPBoolean(const char *r) : YCPValue(new YCPBooleanRep(r)) {} 00103 YCPBoolean(bytecodeistream & str); 00104 }; 00105 00106 #endif // YCPBoolean_h