File indexing completed on 2025-01-18 10:14:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 #if !defined(XERCESC_INCLUDE_GUARD_XSERIALIZABLE_HPP)
0023 #define XERCESC_INCLUDE_GUARD_XSERIALIZABLE_HPP
0024
0025 #include <xercesc/internal/XSerializeEngine.hpp>
0026 #include <xercesc/internal/XProtoType.hpp>
0027
0028 XERCES_CPP_NAMESPACE_BEGIN
0029
0030 class XMLUTIL_EXPORT XSerializable
0031 {
0032 public :
0033
0034
0035
0036
0037 virtual ~XSerializable() {} ;
0038
0039
0040
0041
0042 virtual bool isSerializable() const = 0;
0043
0044 virtual void serialize(XSerializeEngine& ) = 0;
0045
0046 virtual XProtoType* getProtoType() const = 0;
0047
0048 protected:
0049 XSerializable() {}
0050 XSerializable(const XSerializable& ) {}
0051
0052 private:
0053
0054
0055
0056 XSerializable& operator=(const XSerializable&);
0057
0058 };
0059
0060 inline void XSerializable::serialize(XSerializeEngine& )
0061 {
0062 }
0063
0064
0065
0066
0067
0068 #define DECL_XSERIALIZABLE(class_name) \
0069 public: \
0070 \
0071 DECL_XPROTOTYPE(class_name) \
0072 \
0073 virtual bool isSerializable() const ; \
0074 virtual XProtoType* getProtoType() const; \
0075 virtual void serialize(XSerializeEngine&); \
0076 \
0077 inline friend XSerializeEngine& operator>>(XSerializeEngine& serEng \
0078 , class_name*& objPtr) \
0079 {objPtr = (class_name*) serEng.read(XPROTOTYPE_CLASS(class_name)); \
0080 return serEng; \
0081 };
0082
0083
0084
0085
0086
0087 #define IMPL_XSERIALIZABLE_TOCREATE(class_name) \
0088 IMPL_XPROTOTYPE_TOCREATE(class_name) \
0089 IMPL_XSERIAL(class_name)
0090
0091
0092
0093
0094
0095 #define IMPL_XSERIALIZABLE_NOCREATE(class_name) \
0096 IMPL_XPROTOTYPE_NOCREATE(class_name) \
0097 IMPL_XSERIAL(class_name)
0098
0099
0100
0101
0102 #define IMPL_XSERIAL(class_name) \
0103 bool class_name::isSerializable() const \
0104 {return true; } \
0105 XProtoType* class_name::getProtoType() const \
0106 {return XPROTOTYPE_CLASS(class_name); }
0107
0108 #define IS_EQUIVALENT(lptr, rptr) \
0109 if (lptr == rptr) \
0110 return true; \
0111 if (( lptr && !rptr) || (!lptr && rptr)) \
0112 return false;
0113
0114 XERCES_CPP_NAMESPACE_END
0115
0116 #endif
0117