YCPValue.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:       YCPValue.h
00014 
00015    Authors:     Mathias Kettner <kettner@suse.de>
00016                 Klaus Kaempf <kkaempf@suse.de>
00017    Maintainer:  Klaus Kaempf <kkaempf@suse.de>
00018 
00019 /-*/
00020 // -*- c++ -*-
00021 
00022 #ifndef YCPValue_h
00023 #define YCPValue_h
00024 
00025 #define XREFDEBUG "Y2XREFDEBUG"
00026 
00027 #include "YCPElement.h"
00028 
00029 class bytecodeistream;
00030 
00036 enum YCPValueType { 
00037     YT_VOID        = 0,
00038     YT_BOOLEAN     = 1,
00039     YT_INTEGER     = 2,
00040     YT_FLOAT       = 3,
00041     YT_STRING      = 4,
00042     YT_BYTEBLOCK   = 5,
00043     YT_PATH        = 6,
00044     YT_SYMBOL      = 7,
00045     YT_LIST        = 8,
00046     YT_TERM        = 9,
00047     YT_MAP         = 10,
00048     YT_CODE        = 11,        // YCode as YCPValue
00049     YT_RETURN      = 12,        // value of 'return;'
00050     YT_BREAK       = 13,        // value of 'break;'
00051     YT_ENTRY       = 14,        // just a placeholder for a SymbolEntry belonging to a function (i.e. foreach())
00052     YT_ERROR       = 15,        // error value, will cause trouble
00053     YT_REFERENCE   = 16,        // a reference to a variable
00054     YT_EXTERNAL    = 17         // a reference to an external data
00055 };
00056 
00057 enum YCPOrder {
00058     YO_LESS        = -1,
00059     YO_EQUAL       =  0,
00060     YO_GREATER     =  1
00061 };
00062 
00071 class YCPValueRep : public YCPElementRep
00072 {
00073 public:
00079     virtual YCPValueType valuetype() const = 0;
00080 
00085     const char * valuetype_str() const;
00086 
00090     bool isVoid() const;
00091 
00095     bool isBoolean() const;
00096 
00100     bool isInteger() const;
00101 
00105     bool isFloat() const;
00106 
00110     bool isString() const;
00111 
00115     bool isByteblock() const;
00116 
00120     bool isPath() const;
00121 
00125     bool isSymbol() const;
00126 
00130     bool isList() const;
00131 
00136     bool isTerm() const;
00137 
00141     bool isMap() const;
00142 
00146     bool isCode() const;
00147 
00151     bool isBreak() const;
00152 
00156     bool isReturn() const;
00157 
00161     bool isEntry() const;
00162 
00166     bool isReference() const;
00167 
00171     bool isExternal() const;
00172 
00176     YCPVoid asVoid() const;
00177     
00181     YCPBoolean asBoolean() const;
00182 
00186     YCPInteger asInteger() const;
00187 
00191     YCPFloat asFloat() const;
00192 
00196     YCPString asString() const;
00197 
00201     YCPByteblock asByteblock() const;
00202 
00206     YCPPath asPath() const;
00207 
00211     YCPSymbol asSymbol() const;
00212 
00216     YCPList asList() const;
00217 
00221     YCPTerm asTerm() const;
00222 
00226     YCPMap asMap() const;
00227 
00231     YCPCode asCode() const;
00232 
00236     YCPEntry asEntry() const;
00237 
00241     YCPReference asReference() const;
00242 
00246     YCPExternal asExternal() const;
00247 
00252     bool equal (const YCPValue&) const;
00253 
00263     YCPOrder compare(const YCPValue &v, bool rl = false) const;
00264 
00265 };
00266 
00267 
00274 class YCPValue : public YCPElement
00275 {
00276     DEF_COMMON(Value, Element);
00277 public:
00282     YCPValue ();
00283 };
00284 
00285 
00286 // FIXME: remove this in the future
00287 extern YCPValue YCPError ( string message, const YCPValue &ret = YCPNull ());
00288 
00289 #endif   // YCPValue_h

Generated on Tue Nov 6 01:20:21 2007 for yast2-core by  doxygen 1.5.0