Classdesc 3.44
polyXMLBase.h
1/*
2 @copyright Russell Standish 2000-2013
3 @author Russell Standish
4 This file is part of Classdesc
5
6 Open source licensed under the MIT license. See LICENSE for details.
7*/
8
9#ifndef CLASSDESC_POLYXMLBASE_H
10#define CLASSDESC_POLYXMLBASE_H
11
12#include "xml_pack_base.h"
13#include "xml_unpack_base.h"
14
15namespace classdesc
16{
18 {
19 virtual void xml_pack(xml_pack_t&, const string&) const=0;
20 virtual void xml_unpack(xml_unpack_t&, const string&)=0;
21 virtual ~PolyXMLBase() {}
22 };
23
24 template <class T>
25 struct PolyXML: virtual public PolyXMLBase
26 {
27 void xml_pack(xml_pack_t& x, const string& d) const
28 //{::xml_pack(x,d,static_cast<const T&>(*this));}
29 // call access_pack to avoid double wrapping by the XML tag
30 {
32 (x,d,const_cast<T&>(static_cast<const T&>(*this)));
33 }
34
35 void xml_unpack(xml_unpack_t& x, const string& d)
36 {::xml_unpack(x,d,static_cast<T&>(*this));}
37
38 };
39
40 template <> struct tn<classdesc::PolyXMLBase>
41 {
42 static std::string name()
43 {return "classdesc::PolyXMLBase";}
44 };
45 template <class T> struct tn<classdesc::PolyXML<T> >
46 {
47 static std::string name()
48 {return "classdesc::PolyXML<"+typeName<T>()+">";}
49 };
50}
51
52#define CLASSDESC_TYPENAME___classdesc__tn__classdesc____PolyXMLBase___
53#define CLASSDESC_TYPENAME___classdesc__tn__classdesc____PolyXML___T_____
54#define CLASSDESC_TYPENAME___classdesc__PolyXML_T_
55#ifdef CLASSDESC_
56#pragma omit json_pack classdesc::PolyXMLBase
57#pragma omit json_unpack classdesc::PolyXMLBase
58#pragma omit json_pack classdesc::PolyXML
59#pragma omit json_unpack classdesc::PolyXML
60#endif
61
62#endif
63
Definition xml_pack_base.h:56
Definition xml_unpack_base.h:317
Contains definitions related to classdesc functionality.
Definition polyXMLBase.h:18
Definition polyXMLBase.h:26
Definition classdesc.h:571
Definition classdesc_access.h:23
XML serialisation descriptor.
XML deserialisation descriptor.