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
bool isByteblock() const
Definition: YCPValue.cc:66
bool isString() const
Definition: YCPValue.cc:65
#define str
Definition: scanner.cc:997
bool isInteger() const
Definition: YCPValue.cc:63
Definition: YCPValue.h:42
bool isSymbol() const
Definition: YCPValue.cc:68
bool isBoolean() const
Definition: YCPValue.cc:62
const char * valuetype_str() const
Definition: YCPValue.cc:50
YCPReference asReference() const
Definition: YCPValue.cc:240
Wrapper for YCPIntegerRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPIntegerRep with the arrow operator. See YCPIntegerRep.
Definition: YCPInteger.h:92
bool isEntry() const
Definition: YCPValue.cc:75
Definition: YCPValue.h:37
YCPBoolean asBoolean() const
Definition: YCPValue.cc:95
Definition: YCPValue.h:40
YCPTerm asTerm() const
Definition: YCPValue.cc:192
Definition: YCPValue.h:54
bool isReference() const
Definition: YCPValue.cc:76
Definition: YCPValue.h:45
Wrapper for YCPExternalRep This class realizes an automatic memory management via YCPElement...
Definition: YCPExternal.h:90
bool isCode() const
Definition: YCPValue.cc:72
Definition: YCPValue.h:51
YCPList asList() const
Definition: YCPValue.cc:180
virtual std::ostream & toXml(std::ostream &str, int indent) const =0
YCPValueType
Value Type Defines constants for the Value types. The Value type specifies the class the YCPValueRep ...
Definition: YCPValue.h:36
Wrapper for YCPByteblockRep This class realizes an automatic memory management via YCPElement...
Definition: YCPByteblock.h:108
Wrapper for YCPElementRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPElementRep with the arrow operator. See YCPElementRep.
Definition: YCPElement.h:317
Definition: YCPValue.h:47
YCPCode asCode() const
Definition: YCPValue.cc:216
Definition: YCPValue.h:52
bool isVoid() const
Definition: YCPValue.cc:60
Definition: YCPValue.h:53
Wrapper for YCPCodeRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPCodeRep with the arrow operator. See YCPCodeRep.
Definition: YCPCode.h:96
bool isReturn() const
Definition: YCPValue.cc:74
YCPSymbol asSymbol() const
Definition: YCPValue.cc:168
YCPString asString() const
Definition: YCPValue.cc:131
YCPValue()
Definition: YCPValue.cc:312
Wrapper for YCPMapRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPMapRep with the arrow operator. See YCPMapRep.
Definition: YCPMap.h:184
Wrapper for YCPSymbolRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPSymbolRep with the arrow operator. See YCPSymbolRep.
Definition: YCPSymbol.h:101
YCPVoid asVoid() const
Definition: YCPValue.cc:83
YCPPath asPath() const
Definition: YCPValue.cc:156
Definition: YCPValue.h:50
virtual YCPValueType valuetype() const =0
Definition: YCPValue.h:60
Wrapper for YCPReferenceRep This class realizes an automatic memory management via YCPElement...
Definition: YCPCode.h:377
YCPFloat asFloat() const
Definition: YCPValue.cc:119
Definition: YCPValue.h:43
bool isMap() const
Definition: YCPValue.cc:71
YCPMap asMap() const
Definition: YCPValue.cc:204
bool isPath() const
Definition: YCPValue.cc:67
Wrapper for YCPStringRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPStringRep with the arrow operator. See YCPStringRep.
Definition: YCPString.h:133
Wrapper for YCPEntryRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPEntryRep with the arrow operator. See YCPEntryRep.
Definition: YCPCode.h:305
Definition: YCPValue.h:44
Definition: YCPValue.h:59
YCPOrder
Definition: YCPValue.h:57
Wrapper for YCPListRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPListRep with the arrow operator. See YCPListRep.
Definition: YCPList.h:236
bool isList() const
Definition: YCPValue.cc:69
Definition: YCPValue.h:38
Definition: YCPValue.h:58
bool isFloat() const
Definition: YCPValue.cc:64
Abstract base class of all YCP values. Abstract base class of all YCP elements that can be used as pr...
Definition: YCPValue.h:71
YCPEntry asEntry() const
Definition: YCPValue.cc:228
Abstract base class of all YCP elements.
Definition: YCPElement.h:222
YCPOrder compare(const YCPValue &v, bool rl=false) const
Definition: YCPValue.cc:271
Wrapper for YCPVoidRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPVoidRep with the arrow operator. See YCPVoidRep.
Definition: YCPVoid.h:75
DEF_COMMON(Value, Element)
Wrapper for YCPTermRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPTermRep with the arrow operator. See YCPTermRep.
Definition: YCPTerm.h:177
bool isBreak() const
Definition: YCPValue.cc:73
YCPByteblock asByteblock() const
Definition: YCPValue.cc:143
bool isExternal() const
Definition: YCPValue.cc:77
Wrapper for YCPValueRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPValueRep with the arrow operator. See YCPValueRep.
Definition: YCPValue.h:275
YCPExternal asExternal() const
Definition: YCPValue.cc:252
YCPValue YCPError(string message, const YCPValue &ret=YCPNull())
Definition: YCPValue.cc:317
Wrapper for YCPPathRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPPathRep with the arrow operator. See YCPPathRep.
Definition: YCPPath.h:175
YCPInteger asInteger() const
Definition: YCPValue.cc:107
An istream that remembers some data about the bytecode.
Definition: Bytecode.h:42
Definition: YCPValue.h:41
Definition: YCPValue.h:49
bool isTerm() const
Definition: YCPValue.cc:70
bool equal(const YCPValue &) const
Definition: YCPValue.cc:264
Wrapper for YCPFloatRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPFloatRep with the arrow operator. See YCPFloatRep.
Definition: YCPFloat.h:101
Wrapper for YCPBooleanRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPBooleanRep with the arrow operator. See YCPBooleanRep.
Definition: YCPBoolean.h:93
Definition: YCPValue.h:46
Definition: YCPValue.h:39
Definition: YCPElement.h:125
Definition: YCPValue.h:48

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