00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: YCPString.h 00014 00015 Author: Mathias Kettner <kettner@suse.de> 00016 Maintainer: Thomas Roelz <tom@suse.de> 00017 00018 /-*/ 00019 // -*- c++ -*- 00020 00021 #ifndef YCPString_h 00022 #define YCPString_h 00023 00024 00025 #include "YCPValue.h" 00026 #include <y2util/Ustring.h> 00027 00028 00039 class YCPStringRep : public YCPValueRep 00040 { 00041 Ustring v; 00042 00043 protected: 00044 friend class YCPString; 00045 00053 YCPStringRep(string s); 00054 00055 public: 00060 string value() const; 00061 00070 YCPOrder compare(const YCPString &v, bool rl = false) const; 00071 00075 const char *value_cstr() const; 00076 00083 string toString() const; 00084 00088 std::ostream & toStream (std::ostream & str) const; 00089 00093 YCPValueType valuetype() const; 00094 }; 00095 00102 class YCPString : public YCPValue 00103 { 00104 DEF_COMMON(String, Value); 00105 public: 00106 YCPString(string s) : YCPValue(new YCPStringRep(s)) {} 00107 YCPString(std::istream & str); 00108 }; 00109 00110 #endif // YCPString_h 00111