 |
Blamite Game Engine - Strings
00326.06.27.21.0407.blamite
A library containing general purpose utilities and classes for use in multiple projects.
|
Go to the documentation of this file. 1 #ifndef RAPIDXML_UTILS_HPP_INCLUDED
2 #define RAPIDXML_UTILS_HPP_INCLUDED
20 template<
class Ch =
char>
33 basic_ifstream<Ch> stream(filename, ios::binary);
35 throw runtime_error(
string(
"cannot open file ") + filename);
36 stream.unsetf(ios::skipws);
39 stream.seekg(0, ios::end);
40 size_t size = stream.tellg();
44 m_data.resize(
size + 1);
45 stream.read(&m_data.front(),
static_cast<streamsize
>(
size));
51 file(std::basic_istream<Ch> &stream)
56 stream.unsetf(ios::skipws);
57 m_data.assign(istreambuf_iterator<Ch>(stream), istreambuf_iterator<Ch>());
58 if (stream.fail() || stream.bad())
59 throw runtime_error(
"error reading stream");
67 return &m_data.front();
74 return &m_data.front();
86 std::vector<Ch> m_data;
96 std::size_t count = 0;
111 std::size_t count = 0;
std::size_t size() const
Gets file data size.
Definition: rapidxml_utils.hpp:79
std::size_t count_children(xml_node< Ch > *node)
Counts children of node.
Definition: rapidxml_utils.hpp:93
file(std::basic_istream< Ch > &stream)
Loads file into the memory.
Definition: rapidxml_utils.hpp:51
Class representing attribute node of XML document.
Definition: rapidxml.hpp:138
Represents data loaded from a file.
Definition: rapidxml_utils.hpp:21
Ch * data()
Gets file data.
Definition: rapidxml_utils.hpp:65
Definition: rapidxml.hpp:57
const Ch * data() const
Gets file data.
Definition: rapidxml_utils.hpp:72
xml_node< Ch > * first_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Gets first child node, optionally matching node name.
Definition: rapidxml.hpp:936
file(const char *filename)
Loads file into the memory.
Definition: rapidxml_utils.hpp:28
Class representing a node of XML document.
Definition: rapidxml.hpp:137
xml_attribute< Ch > * next_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Gets next attribute, optionally matching attribute name.
Definition: rapidxml.hpp:856
std::size_t count_attributes(xml_node< Ch > *node)
Counts attributes of node.
Definition: rapidxml_utils.hpp:108
xml_attribute< Ch > * first_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Gets first attribute of node, optionally matching attribute name.
Definition: rapidxml.hpp:1025
xml_node< Ch > * next_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
Gets next sibling node, optionally matching node name.
Definition: rapidxml.hpp:1004