LibLogicalAccess  2.5.0
An Open Source RFID Library
Loading...
Searching...
No Matches
xmlserializable.hpp
Go to the documentation of this file.
1
7#ifndef LOGICALACCESS_XMLSERIALIZABLE_HPP
8#define LOGICALACCESS_XMLSERIALIZABLE_HPP
9
10// Bug number 621653 reported on Microsoft Connect
11#ifdef _MSC_VER
12#pragma warning(push)
13#pragma warning(disable : 4005)
14#include <intsafe.h>
15#include <stdint.h>
16#pragma warning(push)
17#pragma warning(default : 4005)
18#endif
19
20#ifdef _MSC_VER
21#ifdef __cplusplus
22#include <WinSock2.h>
23#endif
24#include <windows.h>
26// typedef __int8 int8_t;
27// typedef unsigned __int8 uint8_t;
28// typedef __int16 int16_t;
29// typedef unsigned __int16 uint16_t;
30// typedef __int32 int32_t;
31// typedef unsigned __int32 uint32_t;
32// typedef __int64 int64_t;
33// typedef unsigned __int64 uint64_t;
34// typedef int ssize_t;
35#define strdup _strdup
36#else
37#include <stdint.h>
38#endif
39
40#include <string>
41#include <vector>
42#include <iostream>
43#include <sstream>
44#include <logicalaccess/lla_core_api.hpp>
46#include <boost/property_tree/ptree_fwd.hpp>
47
48namespace logicalaccess
49{
53class LLA_CORE_API XmlSerializable
54{
55 public:
56 virtual ~XmlSerializable() = default;
61 virtual std::string serialize();
62
67 virtual std::string serializeWithHeaders();
68#ifndef SWIG
73 virtual void serialize(boost::property_tree::ptree &parentNode) = 0;
74#endif
75
81 virtual void serializeToFile(const std::string &filename);
82#ifndef SWIG
87 virtual void unSerialize(boost::property_tree::ptree &node) = 0;
88#endif
89
96 virtual void unSerialize(const std::string &xmlstring, const std::string &rootNode);
97#ifndef SWIG
104 virtual void unSerialize(std::istream &is, const std::string &rootNode);
105
112 virtual void unSerialize(boost::property_tree::ptree &node,
113 const std::string &rootNode);
114#endif
115
121 virtual void unSerializeFromFile(const std::string &filename);
122
127 virtual std::string getDefaultXmlNodeName() const = 0;
128
135 static std::string removeXmlDeclaration(const std::string &xmlstring);
136
142 static ByteVector formatHexString(std::string hexstr);
143
144 protected:
145 static unsigned long long atoull(const std::string &str);
146};
147}
148
149#endif /* LOGICALACCESS_XMLSERIALIZABLE_HPP */
A Xml Serializable base class. Add Xml serialization to a class.
Definition: xmlserializable.hpp:54
virtual void serialize(boost::property_tree::ptree &parentNode)=0
Serialize object to Xml Node.
virtual ~XmlSerializable()=default
virtual std::string getDefaultXmlNodeName() const =0
Get the default Xml Node name for this object.
virtual void unSerialize(boost::property_tree::ptree &node)=0
UnSerialize object from a Xml Node.
std::vector< uint8_t > ByteVector
Definition: lla_fwd.hpp:80
Definition: asn1.hpp:9