yast2-core
Type.h
Go to the documentation of this file.
1 /*----------------------------------------------------------*- c++ -*--\
2 | |
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
8 | |
9 | core system |
10 | (C) SuSE Linux AG |
11 \----------------------------------------------------------------------/
12 
13  File: Type.h
14 
15  Author: Klaus Kaempf <kkaempf@suse.de>
16  Maintainer: Klaus Kaempf <kkaempf@suse.de>
17 
18 /-*/
19 
20 #ifndef Type_h
21 #define Type_h
22 
23 #include <iosfwd>
24 #include <vector>
25 
26 // MemUsage.h defines/undefines D_MEMUSAGE
27 #include <y2util/MemUsage.h>
28 #include "ycp/YCPValue.h"
29 #include "ycp/TypePtr.h"
30 
31 class FunctionType;
32 class bytecodeistream;
33 class xmlcodeistream;
34 
36 class Type : public Rep
37 #ifdef D_MEMUSAGE
38  , public MemUsage
39 #endif
40 {
41  REP_BODY(Type);
42 
43 public:
44  // type codes for basic types
45  typedef enum type_kind {
46  UnspecT = 0, // 0 unspecified
47  ErrorT, // 1 error
48  AnyT, // 2 any
49  BooleanT, // 3 boolean
50  ByteblockT, // 4 byteblock
51  FloatT, // 5 float
52  IntegerT, // 6 integer
53  LocaleT, // 7 locale
54  PathT, // 8 path
55  StringT, // 9 string
56  SymbolT, // 10 symbol
57  TermT, // 11 term
58  VoidT, // 12 void
59  WildcardT, // 13 wildcard
60 
61  FlexT, // 14 flex
62  VariableT, // 15 variable <kind>
63  ListT, // 16 list <kind>
64  MapT, // 17 map <key_kind, value_kind>
65  BlockT, // 18 block <kind>
66  TupleT, // 19 tuple <kind, kind, kind, ...>
67  FunctionT, // 20 function <ret_kind, kind, kind, ...>
68 
69  NilT, // 21 only for "return;" (void) vs. "return nil;" (nil)
70  NFlexT // 22 multiple Flex
71  } tkind;
72 
73 protected:
75  bool m_const;
77 
78  Type (tkind kind, bool as_const = false, bool as_reference = false) : m_kind (kind), m_const (as_const), m_reference(as_reference) { };
79 
80 public:
81  //-------------------------------------------------
82  // static member functions
83 
87  static void setNocheck (bool nocheck);
88 
92  static constTypePtr vt2type (enum YCPValueType vt);
93 
97  static int nextToken (const char **signature);
98 
102  static constTypePtr fromSignature (const char **signature);
103 
108  static constTypePtr fromSignature (const string & signature) { const char *s = signature.c_str(); return Type::fromSignature (&s); }
109 
114  static constTypePtr determineFlexType (constFunctionTypePtr actual, constFunctionTypePtr declared);
115 
116 public:
117 
118  static const constTypePtr Unspec; /* unspecified type */
119  static const constTypePtr Error; /* error type */
120  static const constTypePtr Any; /* any type */
121 
122  static const constTypePtr Void; /* void type */
123  static const constTypePtr Boolean; /* boolean type */
124  static const constTypePtr Byteblock;/* byteblock type */
125  static const constTypePtr Float; /* float type */
126  static const constTypePtr Integer; /* integer type */
127  static const constTypePtr Locale; /* locale type */
128  static const constTypePtr Path; /* path type */
129  static const constTypePtr String; /* string type */
130  static const constTypePtr Symbol; /* symbol type */
131  static const constTypePtr Term; /* term type */
132  static const constTypePtr Wildcard; /* wildcard (...) type */
133 
134  static const constTypePtr ConstAny; /* any type */
135  static const constTypePtr ConstVoid; /* void type */
136  static const constTypePtr ConstBoolean; /* boolean type */
137  static const constTypePtr ConstByteblock; /* byteblock type */
138  static const constTypePtr ConstFloat; /* float type */
139  static const constTypePtr ConstInteger; /* integer type */
140  static const constTypePtr ConstLocale; /* locale type */
141  static const constTypePtr ConstPath; /* path type */
142  static const constTypePtr ConstString; /* string type */
143  static const constTypePtr ConstSymbol; /* symbol type */
144  static const constTypePtr ConstTerm; /* term type */
145 
146  static const constTypePtr ConstList; /* list type */
147  static const constTypePtr ConstMap; /* map type */
148 
149  static const constTypePtr Flex;
150  static const constTypePtr ConstFlex;
151  static const constTypePtr NFlex1;
152  static const constTypePtr ConstNFlex1;
153  static const constTypePtr NFlex2;
154  static const constTypePtr ConstNFlex2;
155  static const constTypePtr NFlex3;
156  static const constTypePtr ConstNFlex3;
157  static const constTypePtr NFlex4;
158  static const constTypePtr ConstNFlex4;
159 
160  static const constTypePtr ListUnspec;
161  static const constTypePtr List;
162  static const constTypePtr MapUnspec;
163  static const constTypePtr Map;
164  static const constTypePtr Variable;
165  static const constTypePtr Block;
166 
167  static FunctionTypePtr Function(constTypePtr return_type);
168 
169  static const constTypePtr Nil; /* "return nil;" type */
170 
171 private:
172  /*
173  * get kind
174  */
175  tkind kind () const { return m_kind; }
176 
177 public:
178  Type ();
180  virtual ~Type ();
181 
185  virtual string toString () const;
186  virtual string toXmlString () const;
187 
191  virtual std::ostream & toStream (std::ostream & str) const;
192 
196  virtual std::ostream & toXml (std::ostream & str, int indent ) const;
197 
198  /*
199  * is base or constructed type
200  */
201  virtual bool isBasetype () const { return true; }
202 
203  /*
204  * match <flex<number>> to type, return type if <flex<number>> matches
205  */
206  virtual constTypePtr matchFlex (constTypePtr /*type*/, unsigned int /*number*/ = 0) const { return 0; }
207 
214  virtual int match (constTypePtr expected) const;
215 
220  virtual int matchvalue (YCPValue value) const;
221 
226  virtual bool canCast (constTypePtr to) const;
227 
231  virtual TypePtr clone () const;
232 
236  virtual constTypePtr unflex (constTypePtr type, unsigned int number = 0) const;
237 
241  string preToString () const { return (m_const ? "const " : ""); }
242 
246  string postToString () const { return (m_reference ? " &" : ""); }
247 
251  bool isConst () const { return m_const; }
252 
256  void asConst () { m_const = true; }
257 
261  bool isReference () const { return m_reference; }
262 
266  void asReference () { m_reference = true; }
267 
272  int basematch (constTypePtr expected) const;
273 
277  virtual bool equals (constTypePtr expected) const;
278 
279  // ------------------------------------------------------------
280  // checking types
281 
282  // kind
283  bool isUnspec () const { return m_kind == UnspecT; }
284  bool isError () const { return m_kind == ErrorT; }
285  bool isAny () const { return m_kind == AnyT; }
286  bool isBoolean () const { return m_kind == BooleanT; }
287  bool isByteblock () const { return m_kind == ByteblockT; }
288  bool isFloat () const { return m_kind == FloatT; }
289  bool isInteger () const { return m_kind == IntegerT; }
290  bool isLocale () const { return m_kind == LocaleT; }
291  bool isPath () const { return m_kind == PathT; }
292  bool isString () const { return m_kind == StringT; }
293  bool isSymbol () const { return m_kind == SymbolT; }
294  bool isTerm () const { return m_kind == TermT; }
295  bool isVoid () const { return m_kind == VoidT; }
296  bool isWildcard () const { return m_kind == WildcardT; }
297  bool isFlex () const { return ((m_kind == FlexT) || (m_kind == NFlexT)); }
298  bool isNFlex () const { return m_kind == NFlexT; }
299 
300  bool isVariable () const { return m_kind == VariableT; }
301  bool isList () const { return m_kind == ListT; }
302  bool isMap () const { return m_kind == MapT; }
303  bool isBlock () const { return m_kind == BlockT; }
304  bool isTuple () const { return m_kind == TupleT; }
305  bool isFunction () const { return m_kind == FunctionT; }
306 
307  bool isNil () const { return m_kind == NilT; }
308  // ------------------------------------------------------------
309  // misc methods
310 
311  YCPValueType valueType () const;
312 
313  // determine the common type of two types, used to determine the type of lists
314  // and maps with various elements.
315  // -> returns the largets (containing least amount of information) matching
316  // type (Any if types do not match)
317  // the return type is 'least common denominator'
318  virtual constTypePtr commontype (constTypePtr type) const;
319 
320  // determine the more detailed type of two types, used to determine the type of bracket
321  // element vs. bracket default
322  // -> returns the smallest (containing most amount of information) matching
323  // type (Error if types do not match)
324  virtual constTypePtr detailedtype (constTypePtr type) const;
325 };
326 
328 
329 class FlexType : public Type
330 {
332 public:
333  string toString () const;
334  std::ostream & toStream (std::ostream & str) const;
335  bool isBasetype () const { return false; }
336  constTypePtr matchFlex (constTypePtr type, unsigned int number = 0) const;
337  int match (constTypePtr expected) const;
338  TypePtr clone () const;
339  constTypePtr unflex (constTypePtr type, unsigned int number = 0) const;
340  FlexType (bool as_const = false);
341  FlexType (bytecodeistream & str);
342  ~FlexType ();
343 };
344 
345 
347 
348 class NFlexType : public Type
349 {
351  unsigned int m_number; // there can be more than one flex
352 public:
353  string toString () const;
354  std::ostream & toStream (std::ostream & str) const;
355  bool isBasetype () const { return false; }
356  constTypePtr matchFlex (constTypePtr type, unsigned int number = 0) const;
357  int match (constTypePtr expected) const;
358  TypePtr clone () const;
359  constTypePtr unflex (constTypePtr type, unsigned int number = 0) const;
360  unsigned int number () const;
361  NFlexType (unsigned int number, bool as_const = false);
363  ~NFlexType ();
364 };
365 
366 
368 
369 class VariableType : public Type
370 {
372 private:
373  const constTypePtr m_type;
374 public:
375  string toString () const;
376  std::ostream & toStream (std::ostream & str) const;
377  bool isBasetype () const { return false; }
378  constTypePtr matchFlex (constTypePtr type, unsigned int number = 0) const;
379  int match (constTypePtr expected) const;
380  bool equals (constTypePtr expected) const;
381  TypePtr clone () const;
382  constTypePtr unflex (constTypePtr type, unsigned int number = 0) const;
383  constTypePtr type () const { return m_type; }
384  VariableType (constTypePtr type = Type::Unspec, bool as_const = false);
386  ~VariableType ();
387 };
388 
389 
391 
392 class ListType : public Type
393 {
395 private:
396  const constTypePtr m_type;
397 public:
398  string toString () const;
399  bool isBasetype () const { return false; }
400  constTypePtr matchFlex (constTypePtr type, unsigned int number = 0) const;
401  int match (constTypePtr expected) const;
402  bool equals (constTypePtr expected) const;
403  constTypePtr commontype (constTypePtr type) const;
404  constTypePtr detailedtype (constTypePtr type) const;
405  bool canCast (constTypePtr to) const;
406  TypePtr clone () const;
407  constTypePtr unflex (constTypePtr type, unsigned int number = 0) const;
408  constTypePtr type () const { return m_type; }
409  std::ostream & toStream (std::ostream & str) const;
410  ListType (constTypePtr type = Type::Unspec, bool as_const = false);
412  ~ListType ();
413 };
414 
415 
417 
418 class MapType : public Type
419 {
420  REP_BODY(MapType);
421 private:
422  const constTypePtr m_keytype;
423  const constTypePtr m_valuetype;
424 public:
425  string toString () const;
426  bool isBasetype () const { return false; }
427  constTypePtr matchFlex (constTypePtr type, unsigned int number = 0) const;
428  int match (constTypePtr expected) const;
429  bool equals (constTypePtr expected) const;
430  constTypePtr commontype (constTypePtr type) const;
431  constTypePtr detailedtype (constTypePtr type) const;
432  bool canCast (constTypePtr to) const;
433  TypePtr clone () const;
434  constTypePtr unflex (constTypePtr type, unsigned int number = 0) const;
435  constTypePtr keytype () const { return m_keytype; }
436  constTypePtr valuetype () const { return m_valuetype; }
437  std::ostream & toStream (std::ostream & str) const;
438  MapType (constTypePtr key = Type::Unspec, constTypePtr value = Type::Unspec, bool as_const = false);
440  ~MapType ();
441 };
442 
443 
445 class BlockType : public Type
446 {
448 private:
449  const constTypePtr m_type;
450 public:
451  string toString () const;
452  bool isBasetype () const { return false; }
453  constTypePtr matchFlex (constTypePtr type, unsigned int number = 0) const;
454  int match (constTypePtr expected) const;
455  bool equals (constTypePtr expected) const;
456  bool canCast (constTypePtr to) const;
457  TypePtr clone () const;
458  constTypePtr unflex (constTypePtr type, unsigned int number = 0) const;
459  constTypePtr returnType () const { return m_type; }
460  std::ostream & toStream (std::ostream & str) const;
461  BlockType (constTypePtr type, bool as_const = false);
463  ~BlockType ();
464 };
465 
466 
468 
469 class TupleType : public Type
470 {
472 protected:
473  std::vector <constTypePtr> m_types;
474 public:
475  string toString () const;
476  bool isBasetype () const { return false; }
477  constTypePtr matchFlex (constTypePtr type, unsigned int number = 0) const;
478  int match (constTypePtr expected) const;
479  bool equals (constTypePtr expected) const;
480  bool canCast (constTypePtr to) const;
481  TypePtr clone () const;
482  constTypePtr unflex (constTypePtr type, unsigned int number = 0) const;
483  std::ostream & toStream (std::ostream & str) const;
484  TupleType (constTypePtr type, bool as_const = false);
486  void concat (constTypePtr t);
487  unsigned int parameterCount () const { return m_types.size(); }
488  constTypePtr parameterType (unsigned int parameter_number) const;
489  ~TupleType ();
490 };
491 
492 
494 
495 class FunctionType : public Type
496 {
498 private:
499  const constTypePtr m_returntype;
500  TupleTypePtr m_arguments;
501 public:
502  FunctionType (constTypePtr return_type, constFunctionTypePtr arguments);
503  string toString () const;
504  bool isBasetype () const { return false; }
505  constTypePtr matchFlex (constTypePtr type, unsigned int number = 0) const;
506  int match (constTypePtr expected) const;
507  bool equals (constTypePtr expected) const;
508  bool canCast (constTypePtr /*to*/) const { return false; }
509  TypePtr clone () const;
510  constTypePtr unflex (constTypePtr type, unsigned int number = 0) const;
511  std::ostream & toStream (std::ostream & str) const;
512  FunctionType (constTypePtr returntype = Type::Unspec, bool as_const = false);
514  ~FunctionType ();
515  constTypePtr returnType () const { return m_returntype; }
516  void concat (constTypePtr t);
517  int parameterCount () const;
518  constTypePtr parameterType (unsigned int parameter_number) const;
519  constTupleTypePtr parameters () const;
520 };
521 
522 
523 #endif // Type_h
bool isBasetype() const
Definition: Type.h:426
Definition: Type.h:51
static const constTypePtr Wildcard
Definition: Type.h:132
int match(constTypePtr expected) const
Definition: Type.cc:1076
constTypePtr unflex(constTypePtr type, unsigned int number=0) const
Definition: Type.cc:812
TupleType(constTypePtr type, bool as_const=false)
Definition: Type.cc:1330
int match(constTypePtr expected) const
Definition: Type.cc:885
bool isBasetype() const
Definition: Type.h:377
std::ostream & toStream(std::ostream &str) const
Definition: Type.cc:1238
const constTypePtr m_type
Definition: Type.h:373
constTypePtr detailedtype(constTypePtr type) const
Definition: Type.cc:956
static const constTypePtr ConstLocale
Definition: Type.h:140
bool isBasetype() const
Definition: Type.h:355
constTypePtr unflex(constTypePtr type, unsigned int number=0) const
Definition: Type.cc:698
bool isFlex() const
Definition: Type.h:297
static const constTypePtr Term
Definition: Type.h:131
bool m_const
Definition: Type.h:75
bool isWildcard() const
Definition: Type.h:296
std::ostream & toStream(std::ostream &str) const
Definition: Type.cc:1360
static constTypePtr vt2type(enum YCPValueType vt)
Definition: TypeStatics.cc:30
std::vector< constTypePtr > m_types
Definition: Type.h:473
static const constTypePtr MapUnspec
Definition: Type.h:162
static const constTypePtr NFlex1
Definition: Type.h:151
bool isPath() const
Definition: Type.h:291
REP_BODY(ListType)
Definition: Type.h:69
bool isTerm() const
Definition: Type.h:294
bool isSymbol() const
Definition: Type.h:293
#define str
Definition: scanner.cc:997
Definition: Type.h:57
static const constTypePtr Nil
Definition: Type.h:169
Definition: Type.h:58
int match(constTypePtr expected) const
Definition: Type.cc:673
string toString() const
Definition: Type.cc:1661
REP_BODY(FunctionType)
static const constTypePtr Map
Definition: Type.h:163
virtual std::ostream & toStream(std::ostream &str) const
Definition: Type.cc:145
constTypePtr type() const
Definition: Type.h:408
static const constTypePtr ConstTerm
Definition: Type.h:144
std::ostream & toStream(std::ostream &str) const
Definition: Type.cc:845
constTypePtr commontype(constTypePtr type) const
Definition: Type.cc:930
string toString() const
Definition: Type.cc:644
static const constTypePtr Locale
Definition: Type.h:127
bool equals(constTypePtr expected) const
Definition: Type.cc:910
Type(tkind kind, bool as_const=false, bool as_reference=false)
Definition: Type.h:78
constTypePtr unflex(constTypePtr type, unsigned int number=0) const
Definition: Type.cc:992
std::ostream & toStream(std::ostream &str) const
Definition: Type.cc:1025
bool isReference() const
Definition: Type.h:261
void asReference()
Definition: Type.h:266
static const constTypePtr ConstVoid
Definition: Type.h:135
static const constTypePtr Symbol
Definition: Type.h:130
int match(constTypePtr expected) const
Definition: Type.cc:1270
virtual constTypePtr detailedtype(constTypePtr type) const
Definition: Type.cc:1923
tkind m_kind
Definition: Type.h:74
static void setNocheck(bool nocheck)
REP_BODY(TupleType)
constTypePtr matchFlex(constTypePtr type, unsigned int number=0) const
Definition: Type.cc:549
Definition: Type.h:52
const constTypePtr m_valuetype
Definition: Type.h:423
void concat(constTypePtr t)
Definition: Type.cc:1617
unsigned int number() const
Definition: Type.cc:691
Definition: Type.h:59
bool equals(constTypePtr expected) const
Definition: Type.cc:1771
Definition: Type.h:62
TypePtr clone() const
Definition: Type.cc:577
TypePtr clone() const
Definition: Type.cc:804
static const constTypePtr ConstInteger
Definition: Type.h:139
bool isMap() const
Definition: Type.h:302
Definition: Type.h:49
constTypePtr unflex(constTypePtr type, unsigned int number=0) const
Definition: Type.cc:1828
const constTypePtr m_returntype
Definition: Type.h:499
bool isBasetype() const
Definition: Type.h:504
Definition: Type.h:50
static const constTypePtr ConstNFlex1
Definition: Type.h:152
Definition: Type.h:66
static const constTypePtr ConstFlex
Definition: Type.h:150
bool isList() const
Definition: Type.h:301
int match(constTypePtr expected) const
Definition: Type.cc:771
static constTypePtr determineFlexType(constFunctionTypePtr actual, constFunctionTypePtr declared)
Definition: TypeStatics.cc:525
virtual string toXmlString() const
Definition: Type.cc:208
YCP type Block <type>
Definition: Type.h:445
TypePtr clone() const
Definition: Type.cc:1185
BlockType(constTypePtr type, bool as_const=false)
Definition: Type.cc:1218
const constTypePtr m_type
Definition: Type.h:396
bool isVariable() const
Definition: Type.h:300
static const constTypePtr Flex
Definition: Type.h:149
Tuple <type, type, ...> (function arguments)
Definition: Type.h:469
REP_BODY(FlexType)
bool isBoolean() const
Definition: Type.h:286
Definition: Type.h:53
YCPValueType
Value Type Defines constants for the Value types. The Value type specifies the class the YCPValueRep ...
Definition: YCPValue.h:36
~VariableType()
Definition: Type.cc:735
constTypePtr matchFlex(constTypePtr type, unsigned int number=0) const
Definition: Type.cc:654
static const constTypePtr ConstNFlex2
Definition: Type.h:154
const constTypePtr m_keytype
Definition: Type.h:422
~BlockType()
Definition: Type.cc:1232
enum Type::type_kind tkind
const constTypePtr m_type
Definition: Type.h:449
static int nextToken(const char **signature)
Definition: TypeStatics.cc:69
Definition: Type.h:48
static const constTypePtr ConstNFlex3
Definition: Type.h:156
YCP type <flexN>
Definition: Type.h:348
Type()
Definition: Type.cc:111
Definition: Type.h:54
TypePtr clone() const
Definition: Type.cc:1310
tkind kind() const
Definition: Type.h:175
static const constTypePtr Error
Definition: Type.h:119
static const constTypePtr Block
Definition: Type.h:165
std::ostream & toStream(std::ostream &str) const
Definition: Type.cc:632
constTypePtr parameterType(unsigned int parameter_number) const
Definition: Type.cc:1643
constTypePtr matchFlex(constTypePtr type, unsigned int number=0) const
Definition: Type.cc:1256
bool canCast(constTypePtr to) const
Definition: Type.cc:1303
static const constTypePtr Unspec
Definition: Type.h:118
bool isVoid() const
Definition: Type.h:295
TypePtr clone() const
Definition: Type.cc:1529
bool isError() const
Definition: Type.h:284
constTypePtr matchFlex(constTypePtr type, unsigned int number=0) const
Definition: Type.cc:1684
ListType(constTypePtr type=Type::Unspec, bool as_const=false)
Definition: Type.cc:825
static const constTypePtr Float
Definition: Type.h:125
static const constTypePtr Any
Definition: Type.h:120
static const constTypePtr NFlex3
Definition: Type.h:155
static const constTypePtr ConstPath
Definition: Type.h:141
bool canCast(constTypePtr to) const
Definition: Type.cc:1503
constTypePtr valuetype() const
Definition: Type.h:436
constTypePtr returnType() const
Definition: Type.h:459
~MapType()
Definition: Type.cc:1019
virtual TypePtr clone() const
Definition: Type.cc:497
string toString() const
Definition: Type.cc:750
bool isBasetype() const
Definition: Type.h:399
bool isByteblock() const
Definition: Type.h:287
string toString() const
Definition: Type.cc:1392
REP_BODY(NFlexType)
bool isNil() const
Definition: Type.h:307
static const constTypePtr ConstSymbol
Definition: Type.h:143
FlexType(bool as_const=false)
Definition: Type.cc:513
~TupleType()
Definition: Type.cc:1354
TypePtr clone() const
Definition: Type.cc:984
bool canCast(constTypePtr to) const
Definition: Type.cc:977
string toString() const
Definition: Type.cc:854
int basematch(constTypePtr expected) const
Definition: Type.cc:221
constTupleTypePtr parameters() const
Definition: Type.cc:1654
constTypePtr unflex(constTypePtr type, unsigned int number=0) const
Definition: Type.cc:585
unsigned int parameterCount() const
Definition: Type.h:487
Definition: Type.h:64
YCP type List <type>
Definition: Type.h:392
bool isLocale() const
Definition: Type.h:290
constTypePtr matchFlex(constTypePtr type, unsigned int number=0) const
Definition: Type.cc:1057
static const constTypePtr ConstNFlex4
Definition: Type.h:158
FunctionType(constTypePtr return_type, constFunctionTypePtr arguments)
Definition: Type.cc:1563
bool isUnspec() const
Definition: Type.h:283
Definition: Type.h:46
Definition: Type.h:70
TypePtr clone() const
Definition: Type.cc:683
string toString() const
Definition: Type.cc:542
void concat(constTypePtr t)
Definition: Type.cc:1373
bool isAny() const
Definition: Type.h:285
bool isTuple() const
Definition: Type.h:304
constTypePtr matchFlex(constTypePtr type, unsigned int number=0) const
Definition: Type.cc:1408
static const constTypePtr Path
Definition: Type.h:128
Definition: Type.h:55
int parameterCount() const
Definition: Type.cc:1632
static const constTypePtr String
Definition: Type.h:129
bool isBasetype() const
Definition: Type.h:476
static const constTypePtr Byteblock
Definition: Type.h:124
virtual bool isBasetype() const
Definition: Type.h:201
REP_BODY(MapType)
~FunctionType()
Definition: Type.cc:1611
bool equals(constTypePtr expected) const
Definition: Type.cc:1105
TypePtr clone() const
Definition: Type.cc:1813
TupleTypePtr m_arguments
Definition: Type.h:500
void asConst()
Definition: Type.h:256
static const constTypePtr NFlex2
Definition: Type.h:153
bool equals(constTypePtr expected) const
Definition: Type.cc:1288
static const constTypePtr ListUnspec
Definition: Type.h:160
bool equals(constTypePtr expected) const
Definition: Type.cc:789
bool isFunction() const
Definition: Type.h:305
constTypePtr returnType() const
Definition: Type.h:515
bool isBlock() const
Definition: Type.h:303
static const constTypePtr NFlex4
Definition: Type.h:157
~FlexType()
Definition: Type.cc:528
YCP type Variable <type> for iterator builtins.
Definition: Type.h:369
static constTypePtr fromSignature(const string &signature)
Definition: Type.h:108
VariableType(constTypePtr type=Type::Unspec, bool as_const=false)
Definition: Type.cc:721
virtual int matchvalue(YCPValue value) const
Definition: Type.cc:334
virtual constTypePtr unflex(constTypePtr type, unsigned int number=0) const
Definition: Type.cc:505
string toString() const
Definition: Type.cc:1035
int match(constTypePtr expected) const
Definition: Type.cc:1437
constTypePtr matchFlex(constTypePtr type, unsigned int number=0) const
Definition: Type.cc:757
Definition: Type.h:56
static const constTypePtr ConstString
Definition: Type.h:142
static const constTypePtr ConstFloat
Definition: Type.h:138
bool canCast(constTypePtr) const
Definition: Type.h:508
std::ostream & toStream(std::ostream &str) const
Definition: Type.cc:534
MapType(constTypePtr key=Type::Unspec, constTypePtr value=Type::Unspec, bool as_const=false)
Definition: Type.cc:1003
int match(constTypePtr expected) const
Definition: Type.cc:1707
bool isInteger() const
Definition: Type.h:289
YCP type Map <keytype, valuetype>
Definition: Type.h:418
virtual bool canCast(constTypePtr to) const
Definition: Type.cc:472
bool isNFlex() const
Definition: Type.h:298
std::ostream & toStream(std::ostream &str) const
Definition: Type.cc:741
type_kind
Definition: Type.h:45
bool canCast(constTypePtr to) const
Definition: Type.cc:1172
constTypePtr unflex(constTypePtr type, unsigned int number=0) const
Definition: Type.cc:1318
virtual std::ostream & toXml(std::ostream &str, int indent) const
Definition: Type.cc:158
YCP type Function <returntype, arg1type, arg2type, ...>
Definition: Type.h:495
bool isBasetype() const
Definition: Type.h:335
static const constTypePtr ConstBoolean
Definition: Type.h:136
constTypePtr type() const
Definition: Type.h:383
YCP type.
Definition: Type.h:36
constTypePtr commontype(constTypePtr type) const
Definition: Type.cc:1126
REP_BODY(Type)
constTypePtr detailedtype(constTypePtr type) const
Definition: Type.cc:1151
string toString() const
Definition: Type.cc:1247
static const constTypePtr Variable
Definition: Type.h:164
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
constTypePtr parameterType(unsigned int parameter_number) const
Definition: Type.cc:1381
virtual constTypePtr commontype(constTypePtr type) const
Definition: Type.cc:1888
Definition: Type.h:61
static const constTypePtr Integer
Definition: Type.h:126
unsigned int m_number
Definition: Type.h:351
YCPValueType valueType() const
Definition: Type.cc:1847
virtual string toString() const
Definition: Type.cc:170
bool equals(constTypePtr expected) const
Definition: Type.cc:1474
Base class for reference counted objects.
Definition: Rep.h:46
static const constTypePtr List
Definition: Type.h:161
YCP type <flex>
Definition: Type.h:329
static FunctionTypePtr Function(constTypePtr return_type)
Definition: Type.cc:103
static const constTypePtr ConstAny
Definition: Type.h:134
constTypePtr unflex(constTypePtr type, unsigned int number=0) const
Definition: Type.cc:1193
static const constTypePtr ConstMap
Definition: Type.h:147
NFlexType(unsigned int number, bool as_const=false)
Definition: Type.cc:608
static const constTypePtr Boolean
Definition: Type.h:123
REP_BODY(BlockType)
int match(constTypePtr expected) const
Definition: Type.cc:567
constTypePtr unflex(constTypePtr type, unsigned int number=0) const
Definition: Type.cc:1541
An istream that remembers some data about the xmlcode.
Definition: Xmlcode.h:42
An istream that remembers some data about the bytecode.
Definition: Bytecode.h:42
Definition: Type.h:65
bool m_reference
Definition: Type.h:76
static const constTypePtr Void
Definition: Type.h:122
bool isFloat() const
Definition: Type.h:288
string postToString() const
Definition: Type.h:246
constTypePtr matchFlex(constTypePtr type, unsigned int number=0) const
Definition: Type.cc:871
bool isConst() const
Definition: Type.h:251
~NFlexType()
Definition: Type.cc:626
virtual ~Type()
Definition: Type.cc:122
virtual constTypePtr matchFlex(constTypePtr, unsigned int=0) const
Definition: Type.h:206
constTypePtr keytype() const
Definition: Type.h:435
string preToString() const
Definition: Type.h:241
bool isBasetype() const
Definition: Type.h:452
~ListType()
Definition: Type.cc:839
virtual int match(constTypePtr expected) const
Definition: Type.cc:275
static const constTypePtr ConstByteblock
Definition: Type.h:137
static constTypePtr fromSignature(const char **signature)
Definition: TypeStatics.cc:281
Definition: MemUsage.h:37
Definition: Type.h:63
virtual bool equals(constTypePtr expected) const
Definition: Type.cc:486
static const constTypePtr ConstList
Definition: Type.h:146
bool isString() const
Definition: Type.h:292
Definition: Type.h:47
std::ostream & toStream(std::ostream &str) const
Definition: Type.cc:1591
REP_BODY(VariableType)
Definition: Type.h:67

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