1 #ifndef RAPIDXML_UTILS_HPP_INCLUDED 2 #define RAPIDXML_UTILS_HPP_INCLUDED 20 template <
class Ch =
char>
25 file(
const char *filename) {
29 basic_ifstream<Ch> stream(filename, ios::binary);
30 if (!stream)
throw runtime_error(
string(
"cannot open file ") + filename);
31 stream.unsetf(ios::skipws);
34 stream.seekg(0, ios::end);
35 size_t size = stream.tellg();
40 stream.read(&
m_data.front(),
static_cast<streamsize
>(
size));
46 file(std::basic_istream<Ch> &stream) {
50 stream.unsetf(ios::skipws);
51 m_data.assign(istreambuf_iterator<Ch>(stream), istreambuf_iterator<Ch>());
52 if (stream.fail() || stream.bad())
53 throw runtime_error(
"error reading stream");
78 std::size_t count = 0;
91 std::size_t count = 0;
This file contains rapidxml parser and DOM implementation.
std::size_t count_children(xml_node< Ch > *node)
Represents data loaded from a file.
xml_attribute< Ch > * next_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
file(const char *filename)
xml_node< Ch > * first_node(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
file(std::basic_istream< Ch > &stream)
xml_attribute< Ch > * first_attribute(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
xml_node< Ch > * next_sibling(const Ch *name=0, std::size_t name_size=0, bool case_sensitive=true) const
std::size_t count_attributes(xml_node< Ch > *node)