00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef YCPExternal_h
00022 #define YCPExternal_h
00023
00024
00025 #include "YCPValue.h"
00026
00027
00033 class YCPExternalRep : public YCPValueRep
00034 {
00035 void * m_payload;
00036 string m_magic;
00037 void (*m_destructor)(void *, string);
00038
00039 protected:
00040 friend class YCPExternal;
00041
00049 YCPExternalRep(void * payload, string magic, void (*destructor)(void *, string) = 0);
00050
00054 ~YCPExternalRep();
00055
00056 public:
00059 void * payload() const;
00060
00063 string magic () const;
00064
00068 string toString() const;
00069
00075 std::ostream & toStream (std::ostream & str) const;
00076 std::ostream & toXml (std::ostream & str, int indent ) const;
00077
00081 YCPValueType valuetype() const;
00082 };
00083
00090 class YCPExternal : public YCPValue
00091 {
00092 DEF_COMMON(External, Value);
00093 public:
00094 YCPExternal(void * payload, string magic, void (*destructor)(void*, string) = 0)
00095 : YCPValue(new YCPExternalRep(payload, magic, destructor)) {}
00096 YCPExternal(bytecodeistream & str);
00097 };
00098
00099 #endif // YCPExternal_h