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 
00084     bool isVoid() const;
00085 
00089     bool isBoolean() const;
00090 
00094     bool isInteger() const;
00095 
00099     bool isFloat() const;
00100 
00104     bool isString() const;
00105 
00109     bool isByteblock() const;
00110 
00114     bool isPath() const;
00115 
00119     bool isSymbol() const;
00120 
00124     bool isList() const;
00125 
00130     bool isTerm() const;
00131 
00135     bool isMap() const;
00136 
00140     bool isCode() const;
00141 
00145     bool isBreak() const;
00146 
00150     bool isReturn() const;
00151 
00155     bool isEntry() const;
00156 
00160     bool isReference() const;
00161 
00165     bool isExternal() const;
00166 
00170     YCPVoid asVoid() const;
00171     
00175     YCPBoolean asBoolean() const;
00176 
00180     YCPInteger asInteger() const;
00181 
00185     YCPFloat asFloat() const;
00186 
00190     YCPString asString() const;
00191 
00195     YCPByteblock asByteblock() const;
00196 
00200     YCPPath asPath() const;
00201 
00205     YCPSymbol asSymbol() const;
00206 
00210     YCPList asList() const;
00211 
00215     YCPTerm asTerm() const;
00216 
00220     YCPMap asMap() const;
00221 
00225     YCPCode asCode() const;
00226 
00230     YCPEntry asEntry() const;
00231 
00235     YCPReference asReference() const;
00236 
00240     YCPExternal asExternal() const;
00241 
00246     bool equal (const YCPValue&) const;
00247 
00257     YCPOrder compare(const YCPValue &v, bool rl = false) const;
00258 
00259 };
00260 
00261 
00268 class YCPValue : public YCPElement
00269 {
00270     DEF_COMMON(Value, Element);
00271 public:
00276     YCPValue ();
00277 };
00278 
00279 
00280 // FIXME: remove this in the future
00281 extern YCPValue YCPError ( string message, const YCPValue &ret = YCPNull ());
00282 
00283 #endif   // YCPValue_h

Generated on Fri Jun 16 18:07:45 2006 for yast2-core by  doxygen 1.4.6