64 #define DEF_OPS(name) \
66 const YCP##name##Rep *operator ->() const { \
67 return static_cast<const YCP##name##Rep *>(element); } \
68 YCP##name##Rep *operator ->() { \
69 return const_cast<YCP##name##Rep *>( \
70 static_cast<const YCP##name##Rep *>(element)); } \
72 int operator !() const; \
73 int operator ==(const YCPElement &) const;
77 #define DEF_MEMSIZE(name) \
78 virtual size_t mem_size () const { return sizeof (YCP##name); }
80 #define DEF_MEMSIZE(name)
83 #define DEF_COMMON(name, base) \
85 friend class YCP##base##Rep; \
88 YCP##name(const YCPNull &n) : YCP##base(n) {} \
90 YCP##name (const YCP##name##Rep *x) : YCP##base(x) {}
93 #define DEF_COW_OPS(name) \
95 const YCP##name *operator ->() const { \
96 return static_cast<const YCP##name *>(this); } \
97 YCP##name *operator ->() { \
98 return const_cast<YCP##name *>( \
99 static_cast<const YCP##name *>(this)); } \
101 int operator !() const; \
102 int operator ==(const YCPElement &) const;
104 #define DEF_COW_COMMON(name, base) \
105 friend class YCP##base##Rep; \
108 YCP##name(const YCPNull &n) : YCP##base(n) {} \
110 YCP##name (const YCP##name##Rep *x) : YCP##base(x) {} \
112 YCPOrder compare(const YCP##name x) const { \
113 return (static_cast<const YCP##name##Rep*>(element))->compare(x); \
115 string toString () const { return element->toString (); } \
116 std::ostream & toStream (std::ostream & str ) const { \
117 return element->toStream (str); \
119 std::ostream & toXml (std::ostream & str, int indent ) const { \
120 return element->toXml( str, indent ); \
122 YCPValueType valuetype () const { return (static_cast<const YCP##name##Rep*>(element))->valuetype (); }
275 virtual string toString()
const = 0;
280 virtual std::ostream &
toStream (std::ostream &
str)
const = 0;
281 virtual std::ostream &
toXml (std::ostream &
str,
int indent )
const = 0;
347 bool isNull()
const {
return element == 0; }
351 #endif // YCPElement_h
#define str
Definition: scanner.cc:997
int reference_counter
Definition: YCPElement.h:245
YCPElement()
Definition: YCPElement.cc:63
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
void destroy() const
Definition: YCPElement.cc:38
YCPElementRep()
Definition: YCPElement.cc:28
static string old(const string &filename, int i, const char *suffix)
Definition: y2changes.cc:257
virtual std::ostream & toXml(std::ostream &str, int indent) const =0
Wrapper for YCPExternalRep This class realizes an automatic memory management via YCPElement...
Definition: YCPExternal.h:90
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
bool refersToSameElementAs(const YCPElement &e) const
Definition: YCPElement.h:348
const YCPElementRep * element
Definition: YCPElement.h:324
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
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
const YCPElement & operator=(const YCPElement &e)
Definition: YCPElement.cc:90
Wrapper for YCPReferenceRep This class realizes an automatic memory management via YCPElement...
Definition: YCPCode.h:377
bool isNull() const
Definition: YCPElement.h:347
~YCPElement()
Definition: YCPElement.cc:83
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
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
Abstract base class of all YCP elements.
Definition: YCPElement.h:222
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
YCPValue asValue() const
Definition: YCPElement.cc:55
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
YCPElementRep & operator=(const YCPElementRep &)
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
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
const YCPElementRep * clone() const
Definition: YCPElement.cc:48
virtual ~YCPElementRep()
Definition: YCPElement.cc:33
virtual string toString() const =0
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
virtual const YCPElementRep * shallowCopy() const
Definition: YCPElement.h:287
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
const YCPElementRep * writeCopy()
Definition: YCPElement.h:330
Definition: MemUsage.h:37
virtual std::ostream & toStream(std::ostream &str) const =0
Definition: YCPElement.h:125