00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: YCPFloat.h 00014 00015 Author: Mathias Kettner <kettner@suse.de> 00016 Maintainer: Thomas Roelz <tom@suse.de> 00017 00018 /-*/ 00019 // -*- c++ -*- 00020 00021 #ifndef YCPFloat_h 00022 #define YCPFloat_h 00023 00024 00025 #include "YCPValue.h" 00026 00027 00038 class YCPFloatRep : public YCPValueRep 00039 { 00040 double v; 00041 00042 protected: 00043 friend class YCPFloat; 00044 00049 YCPFloatRep(double v); 00050 00055 YCPFloatRep(const char *r); 00056 00057 public: 00062 double value() const; 00063 00071 YCPOrder compare(const YCPFloat &v) const; 00072 00081 string toString() const; 00082 00086 std::ostream & toStream (std::ostream & str) const; 00087 00091 YCPValueType valuetype() const; 00092 }; 00093 00100 class YCPFloat : public YCPValue 00101 { 00102 DEF_COMMON(Float, Value); 00103 public: 00104 YCPFloat(double v) : YCPValue(new YCPFloatRep(v)) {} 00105 YCPFloat(const char *r) : YCPValue(new YCPFloatRep(r)) {} 00106 YCPFloat(std::istream & str); 00107 }; 00108 00109 #endif // YCPFloat_h