Go to the documentation of this file.
19 template<
class Ch =
char>
32 basic_ifstream<Ch> stream(
filename, ios::binary);
36 throw runtime_error(
string(
"cannot open file ") +
filename);
39 stream.unsetf(ios::skipws);
42 stream.seekg(0, ios::end);
43 size_t size = stream.tellg();
47 m_data.resize(
size + 1);
48 stream.read(&m_data.front(),
static_cast<streamsize
>(
size));
54 file(std::basic_istream<Ch>& stream)
59 stream.unsetf(ios::skipws);
60 m_data.assign(istreambuf_iterator<Ch>(stream), istreambuf_iterator<Ch>());
62 if (stream.fail() || stream.bad())
64 throw runtime_error(
"error reading stream");
74 return &m_data.front();
81 return &m_data.front();
93 std::vector<Ch> m_data;
103 std::size_t count = 0;
120 std::size_t count = 0;
xml_node< Ch > * next_sibling(const Ch *name=nullptr, std::size_t name_size=0, bool case_sensitive=true) const
Gets next sibling node, optionally matching node name.
xml_attribute< Ch > * next_attribute(const Ch *name=nullptr, std::size_t name_size=0, bool case_sensitive=true) const
Gets next attribute, optionally matching attribute name.
std::size_t count_children(xml_node< Ch > *node)
Counts children of node.
xml_attribute< Ch > * first_attribute(const Ch *name=nullptr, std::size_t name_size=0, bool case_sensitive=true) const
Gets first attribute of node, optionally matching attribute name.
Ch * data()
Gets file data.
Class representing attribute node of XML document.
Represents data loaded from a file.
file(std::basic_istream< Ch > &stream)
Loads file into the memory.
xml_node< Ch > * first_node(const Ch *name=nullptr, std::size_t name_size=0, bool case_sensitive=true) const
Gets first child node, optionally matching node name.
Class representing a node of XML document.
file(const char *filename)
Loads file into the memory.
std::size_t count_attributes(xml_node< Ch > *node)
Counts attributes of node.
std::size_t size() const
Gets file data size.
const Ch * data() const
Gets file data.