yast2-core
YCPExternal.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: YCPExternal.h
14 
15  Author: Stanislav Visnovsky <visnov@suse.cz>
16  Maintainer: Stanislav Visnovsky <visnov@suse.cz>
17 
18 /-*/
19 // -*- c++ -*-
20 
21 #ifndef YCPExternal_h
22 #define YCPExternal_h
23 
24 
25 #include "YCPValue.h"
26 
27 
34 {
35  void * m_payload;
36  string m_magic;
37  void (*m_destructor)(void *, string);
38 
39 protected:
40  friend class YCPExternal;
41 
49  YCPExternalRep(void * payload, string magic, void (*destructor)(void *, string) = 0);
50 
55 
56 public:
59  void * payload() const;
60 
63  string magic () const;
64 
68  string toString() const;
69 
75  std::ostream & toStream (std::ostream & str) const;
76  std::ostream & toXml (std::ostream & str, int indent ) const;
77 
81  YCPValueType valuetype() const;
82 };
83 
90 class YCPExternal : public YCPValue
91 {
92  DEF_COMMON(External, Value);
93 public:
94  YCPExternal(void * payload, string magic, void (*destructor)(void*, string) = 0)
95  : YCPValue(new YCPExternalRep(payload, magic, destructor)) {}
97 };
98 
99 #endif // YCPExternal_h
std::ostream & toXml(std::ostream &str, int indent) const
Definition: YCPExternal.cc:80
#define str
Definition: scanner.cc:997
YCPExternal(void *payload, string magic, void(*destructor)(void *, string)=0)
Definition: YCPExternal.h:94
Wrapper for YCPExternalRep This class realizes an automatic memory management via YCPElement...
Definition: YCPExternal.h:90
YCPValueType
Value Type Defines constants for the Value types. The Value type specifies the class the YCPValueRep ...
Definition: YCPValue.h:36
string toString() const
Definition: YCPExternal.cc:65
string magic() const
Definition: YCPExternal.cc:51
DEF_COMMON(External, Value)
void(* m_destructor)(void *, string)
Definition: YCPExternal.h:37
A blackbox wrapper for handling external values in ycp. The payload is handled as a blackbox and is n...
Definition: YCPExternal.h:33
void * payload() const
Definition: YCPExternal.cc:44
YCPExternalRep(void *payload, string magic, void(*destructor)(void *, string)=0)
Definition: YCPExternal.cc:28
string m_magic
Definition: YCPExternal.h:36
~YCPExternalRep()
Definition: YCPExternal.cc:36
Abstract base class of all YCP values. Abstract base class of all YCP elements that can be used as pr...
Definition: YCPValue.h:71
YCPValueType valuetype() const
Definition: YCPExternal.cc:58
std::ostream & toStream(std::ostream &str) const
Definition: YCPExternal.cc:73
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
An istream that remembers some data about the bytecode.
Definition: Bytecode.h:42
void * m_payload
Definition: YCPExternal.h:35

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