00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
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,
00049 YT_RETURN = 12,
00050 YT_BREAK = 13,
00051 YT_ENTRY = 14,
00052 YT_ERROR = 15,
00053 YT_REFERENCE = 16,
00054 YT_EXTERNAL = 17
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
00281 extern YCPValue YCPError ( string message, const YCPValue &ret = YCPNull ());
00282
00283 #endif // YCPValue_h