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 };
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
00270 extern YCPValue YCPError ( string message, const YCPValue &ret = YCPNull ());
00271
00272 #endif // YCPValue_h