#include <secstwo_serialize.h>
Public Types | |
typedef std::vector< pmsg_t > | msg_container_t |
Type define for a message container. | |
Public Member Functions | |
xml_deserializer_t (xmlNode *pnode) | |
XML Deserialiser default ctor. Deserializes a given libxml2 node into a data item or into a message, depending on the contents. If things go wrong, the ctor throws an empty exception. Sample code is as follows:. | |
operator const pdata_item_t & () | |
Data item cast operator to get deserialized data item. | |
operator const pmsg_t & () | |
Message cast operator to get deserialized message. | |
Static Public Member Functions | |
static int | from_file (int fd, int schema_fd, msg_container_t &msg_container) |
Deserialize xml file with validation against XML schema. | |
static int | from_mem (void *buf, size_t buflen, void *schema_buf, size_t schema_buflen, msg_container_t &msg_container) |
Parse XML data stored in memory. Logics is the same as in. |
Definition at line 169 of file secstwo_serialize.h.
xml_deserializer_t::xml_deserializer_t | ( | xmlNode * | pnode | ) |
XML Deserialiser default ctor. Deserializes a given libxml2 node into a data item or into a message, depending on the contents. If things go wrong, the ctor throws an empty exception. Sample code is as follows:.
xmlDocPtr pdoc = xmlParseMemory(xml_string, xml_string_len) xml_deserializer_t deserialiser(xmlDocGetRootElement(pdoc)) pdata_item_t pitem = deserializer;
pnode | libxml2 node that shold contain either data item or the message. |
Definition at line 814 of file secstwo_serialize.cpp.
References freesecs::secstwo::list_item_t::_data, freesecs::secstwo::string_data_item_t< _type >::_data, freesecs::secstwo::msg_item_impl_t< _type >::_data, freesecs::secstwo::list_item_t::size(), and freesecs::secstwo::list_item_t::variable().
xml_deserializer_t::operator const pdata_item_t & | ( | ) |
Data item cast operator to get deserialized data item.
NULL | == pitem.get() means deserialization was not OK or deserialised was a message. |
Definition at line 1055 of file secstwo_serialize.cpp.
xml_deserializer_t::operator const pmsg_t & | ( | ) |
Message cast operator to get deserialized message.
NULL | == pmsg.get() means deserialization was not OK or deserialised was a data item. |
Definition at line 1060 of file secstwo_serialize.cpp.
int xml_deserializer_t::from_file | ( | int | fd, | |
int | schema_fd, | |||
msg_container_t & | msg_container | |||
) | [static] |
Deserialize xml file with validation against XML schema.
fd | XML file descriptor | |
schema_fd | FREESECS secstwo.xsd file descriptor | |
msg_container | Message container where deserialized messages are to be stored. It is assumed the file contains message descriptions. Data items will not be stored anywhere. If the schema file is not provided, validation is not performed and this may be the subject to later deserialization errors. It is recommentded to do validation to check for the XML file consistency. |
0 | Deserialization successful. Need to check the size of message container however. | |
-1 | Failed to read schema file | |
-2 | Schema file parse error | |
-3 | Schema file parse error | |
-4 | Schema file parse error | |
-5 | Schema file parse error | |
-6 | XML file parse error |
Definition at line 1138 of file secstwo_serialize.cpp.
int xml_deserializer_t::from_mem | ( | void * | buf, | |
size_t | buflen, | |||
void * | schema_buf, | |||
size_t | schema_buflen, | |||
msg_container_t & | msg_container | |||
) | [static] |
Parse XML data stored in memory. Logics is the same as in.
Definition at line 1160 of file secstwo_serialize.cpp.