yast2-core

YCPString.h

Go to the documentation of this file.
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     string v;
00042 
00043 protected:
00044     friend class YCPString;
00045 
00053     YCPStringRep(string s);
00054 
00055 public:
00056 
00060     bool isEmpty() const;
00061 
00066     string value() const;
00067 
00076     YCPOrder compare(const YCPString &v, bool rl = false) const;
00077 
00081     const char *value_cstr() const;
00082 
00089     string toString() const;
00090 
00094     std::ostream & toStream (std::ostream & str) const;
00095     std::ostream & toXml (std::ostream & str, int indent ) const;
00096 
00100     YCPValueType valuetype() const;
00101 };
00102 
00103 
00104 #define CONST_ELEMENT (static_cast<const YCPStringRep*>(element))
00105 
00112 class YCPString : public YCPValue
00113 {
00114     DEF_COMMON(String, Value);
00115 public:
00116     YCPString(string s) : YCPValue(new YCPStringRep(s)) {}
00117     YCPString(bytecodeistream & str);
00118 
00119     bool isEmpty() const { return CONST_ELEMENT->isEmpty(); }
00120 };
00121 
00122 #undef CONST_ELEMENT
00123 
00124 #endif   // YCPString_h
00125     

Generated on a sunny day for yast2-core by doxygen 1.7.3