Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Examples

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 };
00055 
00056 enum YCPOrder {
00057     YO_LESS        = -1,
00058     YO_EQUAL       =  0,
00059     YO_GREATER     =  1
00060 };
00061 
00070 class YCPValueRep : public YCPElementRep
00071 {
00072 public:
00078     virtual YCPValueType valuetype() const = 0;
00079 
00083     bool isVoid() const;
00084 
00088     bool isBoolean() const;
00089 
00093     bool isInteger() const;
00094 
00098     bool isFloat() const;
00099 
00103     bool isString() const;
00104 
00108     bool isByteblock() const;
00109 
00113     bool isPath() const;
00114 
00118     bool isSymbol() const;
00119 
00123     bool isList() const;
00124 
00129     bool isTerm() const;
00130 
00134     bool isMap() const;
00135 
00139     bool isCode() const;
00140 
00144     bool isBreak() const;
00145 
00149     bool isReturn() const;
00150 
00154     bool isEntry() const;
00155 
00159     bool isReference() const;
00160 
00164     YCPVoid asVoid() const;
00165     
00169     YCPBoolean asBoolean() const;
00170 
00174     YCPInteger asInteger() const;
00175 
00179     YCPFloat asFloat() const;
00180 
00184     YCPString asString() const;
00185 
00189     YCPByteblock asByteblock() const;
00190 
00194     YCPPath asPath() const;
00195 
00199     YCPSymbol asSymbol() const;
00200 
00204     YCPList asList() const;
00205 
00209     YCPTerm asTerm() const;
00210 
00214     YCPMap asMap() const;
00215 
00219     YCPCode asCode() const;
00220 
00224     YCPEntry asEntry() const;
00225 
00229     YCPReference asReference() const;
00230 
00235     bool equal (const YCPValue&) const;
00236 
00246     YCPOrder compare(const YCPValue &v, bool rl = false) const;
00247 
00248 };
00249 
00250 
00257 class YCPValue : public YCPElement
00258 {
00259     DEF_COMMON(Value, Element);
00260 public:
00265     YCPValue ();
00266 };
00267 
00268 
00269 // FIXME: remove this in the future
00270 extern YCPValue YCPError ( string message, const YCPValue &ret = YCPNull ());
00271 
00272 #endif   // YCPValue_h

Generated on Tue Mar 22 11:35:48 2005 for yast2-core by  doxygen 1.4.1