yast2-core
YCPValue.h
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | |
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
8 | |
9 | core system |
10 | (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12 
13  File: YCPValue.h
14 
15  Authors: Mathias Kettner <kettner@suse.de>
16  Klaus Kaempf <kkaempf@suse.de>
17  Maintainer: Klaus Kaempf <kkaempf@suse.de>
18 
19 /-*/
20 // -*- c++ -*-
21 
22 #ifndef YCPValue_h
23 #define YCPValue_h
24 
25 #define XREFDEBUG "Y2XREFDEBUG"
26 
27 #include "YCPElement.h"
28 
29 class bytecodeistream;
30 
36 enum YCPValueType {
37  YT_VOID = 0,
40  YT_FLOAT = 3,
41  YT_STRING = 4,
43  YT_PATH = 6,
44  YT_SYMBOL = 7,
45  YT_LIST = 8,
46  YT_TERM = 9,
47  YT_MAP = 10,
48  YT_CODE = 11, // YCode as YCPValue
49  YT_RETURN = 12, // value of 'return;'
50  YT_BREAK = 13, // value of 'break;'
51  YT_ENTRY = 14, // just a placeholder for a SymbolEntry belonging to a function (i.e. foreach())
52  YT_ERROR = 15, // error value, will cause trouble
53  YT_REFERENCE = 16, // a reference to a variable
54  YT_EXTERNAL = 17 // a reference to an external data
55 };
56 
57 enum YCPOrder {
58  YO_LESS = -1,
59  YO_EQUAL = 0,
61 };
62 
71 class YCPValueRep : public YCPElementRep
72 {
73 public:
79  virtual YCPValueType valuetype() const = 0;
80 
85  const char * valuetype_str() const;
86 
90  bool isVoid() const;
91 
95  bool isBoolean() const;
96 
100  bool isInteger() const;
101 
105  bool isFloat() const;
106 
110  bool isString() const;
111 
115  bool isByteblock() const;
116 
120  bool isPath() const;
121 
125  bool isSymbol() const;
126 
130  bool isList() const;
131 
136  bool isTerm() const;
137 
141  bool isMap() const;
142 
146  bool isCode() const;
147 
151  bool isBreak() const;
152 
156  bool isReturn() const;
157 
161  bool isEntry() const;
162 
166  bool isReference() const;
167 
171  bool isExternal() const;
172 
176  YCPVoid asVoid() const;
177 
181  YCPBoolean asBoolean() const;
182 
186  YCPInteger asInteger() const;
187 
191  YCPFloat asFloat() const;
192 
196  YCPString asString() const;
197 
201  YCPByteblock asByteblock() const;
202 
206  YCPPath asPath() const;
207 
211  YCPSymbol asSymbol() const;
212 
216  YCPList asList() const;
217 
221  YCPTerm asTerm() const;
222 
226  YCPMap asMap() const;
227 
231  YCPCode asCode() const;
232 
236  YCPEntry asEntry() const;
237 
241  YCPReference asReference() const;
242 
246  YCPExternal asExternal() const;
247 
252  bool equal (const YCPValue&) const;
253 
263  YCPOrder compare(const YCPValue &v, bool rl = false) const;
264 
265  virtual std::ostream & toXml (std::ostream & str, int indent ) const = 0;
266 };
267 
268 
275 class YCPValue : public YCPElement
276 {
277  DEF_COMMON(Value, Element);
278 public:
283  YCPValue ();
284 };
285 
286 
287 // FIXME: remove this in the future
288 extern YCPValue YCPError ( string message, const YCPValue &ret = YCPNull ());
289 
290 #endif // YCPValue_h

Generated on a sunny day for yast2-core by doxygen 1.8.2