Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Examples

YCPElement.h File Reference

#include <y2util/MemUsage.h>
#include <iosfwd>
#include <string>
#include <vector>
#include <map>
#include "toString.h"

Go to the source code of this file.

Classes

class  YCPNull
class  YCPElementRep
 Abstract base class of all YCP elements.

There are some basic rules of memory managesment common to all YCPElementRep classes. If you call a constructor of any YCPElementRep subclass or if you call an add method, that adds elements to a YCPListRep, YCPTermRep YCPDeclTermRep or YCPBlockRep, and if this constructor or add method has arguments of type const YCPElementRep * (or of a subclass), then the responsibility for the values you gave for those arguments goes over to the object whose constructor or add function has been called. You may refer that object afterwards in any way. Therefore create the object either with new or with the YCPElementRep::clone method. More...

class  YCPElement
 Wrapper for YCPElementRep This class realizes an automatic memory management via YCPElement. Access the functionality of YCPElementRep with the arrow operator. See YCPElementRep. More...


Defines

#define DEF_OPS(name)
#define DEF_COMMON(name, base)
#define DEF_COW_OPS(name)
#define DEF_COW_COMMON(name, base)


Define Documentation

#define DEF_COMMON name,
base   ) 
 

Value:

DEF_OPS(name)                                           \
    friend class YCP##base##Rep;                                \
public:                                                         \
    virtual size_t mem_size () const { return sizeof (YCP##name); } \
    YCP##name(const YCPNull &n) : YCP##base(n) {}               \
protected:                                                      \
    YCP##name (const YCP##name##Rep *x) : YCP##base(x) {}

#define DEF_COW_COMMON name,
base   ) 
 

Value:

friend class YCP##base##Rep;                            \
    DEF_COW_OPS(name)                                           \
public:                                                         \
    YCP##name(const YCPNull &n) : YCP##base(n) {}               \
protected:                                                      \
    YCP##name (const YCP##name##Rep *x) : YCP##base(x) {}       \
public:                                                         \
    YCPOrder compare(const YCP##name x) const {                 \
        return (static_cast<const YCP##name##Rep*>(element))->compare(x);                               \
    }                                                           \
    string toString () const { return element->toString (); }   \
    std::ostream & toStream (std::ostream & str ) const {       \
        return element->toStream (str);                         \
    }                                                           \
    YCPValueType valuetype () const { return (static_cast<const YCP##name##Rep*>(element))->valuetype (); }

#define DEF_COW_OPS name   ) 
 

Value:

public:                                                         \
    const YCP##name *operator ->() const {                      \
        return static_cast<const YCP##name *>(this); }          \
    YCP##name *operator ->() {                                  \
        return const_cast<YCP##name *>(                         \
               static_cast<const YCP##name *>(this)); }         \
private:                                                        \
    int operator !() const;                                     \
    int operator ==(const YCPElement &) const;

#define DEF_OPS name   ) 
 

Value:

public:                                                         \
    const YCP##name##Rep *operator ->() const {                 \
        return static_cast<const YCP##name##Rep *>(element); }  \
    YCP##name##Rep *operator ->() {                             \
        return const_cast<YCP##name##Rep *>(                    \
               static_cast<const YCP##name##Rep *>(element)); } \
private:                                                        \
    int operator !() const;                                     \
    int operator ==(const YCPElement &) const;


Generated on Fri Nov 9 18:15:23 2007 for yast2-core by doxygen 1.3.6