From aeaa1da161f79d328f05c5a40708a9e61ca45c46 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Sun, 27 Jun 2010 20:05:06 +0000 Subject: Renamed encoding_t to xml_encoding, renamed xpath_type_t to xpath_value_type git-svn-id: http://pugixml.googlecode.com/svn/trunk@544 99668b35-9821-0410-8761-19e4c4f06640 --- src/pugixml.cpp | 72 ++++++++++++++++++++++++------------------------- src/pugixml.hpp | 30 ++++++++++----------- src/pugixpath.cpp | 14 +++++----- tests/test.cpp | 2 +- tests/test.hpp | 2 +- tests/test_document.cpp | 18 ++++++------- tests/writer_string.cpp | 10 +++---- tests/writer_string.hpp | 10 +++---- 8 files changed, 79 insertions(+), 79 deletions(-) diff --git a/src/pugixml.cpp b/src/pugixml.cpp index c31eae4..ef30fb0 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -1024,7 +1024,7 @@ namespace return *reinterpret_cast(&ui) == 1; } - encoding_t get_wchar_encoding() + xml_encoding get_wchar_encoding() { STATIC_ASSERT(sizeof(wchar_t) == 2 || sizeof(wchar_t) == 4); @@ -1034,7 +1034,7 @@ namespace return is_little_endian() ? encoding_utf32_le : encoding_utf32_be; } - encoding_t get_buffer_encoding(encoding_t encoding, const void* contents, size_t size) + xml_encoding get_buffer_encoding(xml_encoding encoding, const void* contents, size_t size) { // replace wchar encoding with utf implementation if (encoding == encoding_wchar) return get_wchar_encoding(); @@ -1095,7 +1095,7 @@ namespace } #ifdef PUGIXML_WCHAR_MODE - inline bool need_endian_swap_utf(encoding_t le, encoding_t re) + inline bool need_endian_swap_utf(xml_encoding le, xml_encoding re) { return (le == encoding_utf16_be && re == encoding_utf16_le) || (le == encoding_utf16_le && re == encoding_utf16_be) || (le == encoding_utf32_be && re == encoding_utf32_le) || (le == encoding_utf32_le && re == encoding_utf32_be); @@ -1187,10 +1187,10 @@ namespace return true; } - bool convert_buffer(char_t*& out_buffer, size_t& out_length, encoding_t encoding, const void* contents, size_t size, bool is_mutable) + bool convert_buffer(char_t*& out_buffer, size_t& out_length, xml_encoding encoding, const void* contents, size_t size, bool is_mutable) { // get native encoding - encoding_t wchar_encoding = get_wchar_encoding(); + xml_encoding wchar_encoding = get_wchar_encoding(); // fast path: no conversion required if (encoding == wchar_encoding) return get_mutable_buffer(out_buffer, out_length, contents, size, is_mutable); @@ -1204,7 +1204,7 @@ namespace // source encoding is utf16 if (encoding == encoding_utf16_be || encoding == encoding_utf16_le) { - encoding_t native_encoding = is_little_endian() ? encoding_utf16_le : encoding_utf16_be; + xml_encoding native_encoding = is_little_endian() ? encoding_utf16_le : encoding_utf16_be; return (native_encoding == encoding) ? convert_buffer_utf16(out_buffer, out_length, contents, size, opt_false()) : @@ -1214,7 +1214,7 @@ namespace // source encoding is utf32 if (encoding == encoding_utf32_be || encoding == encoding_utf32_le) { - encoding_t native_encoding = is_little_endian() ? encoding_utf32_le : encoding_utf32_be; + xml_encoding native_encoding = is_little_endian() ? encoding_utf32_le : encoding_utf32_be; return (native_encoding == encoding) ? convert_buffer_utf32(out_buffer, out_length, contents, size, opt_false()) : @@ -1271,7 +1271,7 @@ namespace return true; } - bool convert_buffer(char_t*& out_buffer, size_t& out_length, encoding_t encoding, const void* contents, size_t size, bool is_mutable) + bool convert_buffer(char_t*& out_buffer, size_t& out_length, xml_encoding encoding, const void* contents, size_t size, bool is_mutable) { // fast path: no conversion required if (encoding == encoding_utf8) return get_mutable_buffer(out_buffer, out_length, contents, size, is_mutable); @@ -1279,7 +1279,7 @@ namespace // source encoding is utf16 if (encoding == encoding_utf16_be || encoding == encoding_utf16_le) { - encoding_t native_encoding = is_little_endian() ? encoding_utf16_le : encoding_utf16_be; + xml_encoding native_encoding = is_little_endian() ? encoding_utf16_le : encoding_utf16_be; return (native_encoding == encoding) ? convert_buffer_utf16(out_buffer, out_length, contents, size, opt_false()) : @@ -1289,7 +1289,7 @@ namespace // source encoding is utf32 if (encoding == encoding_utf32_be || encoding == encoding_utf32_le) { - encoding_t native_encoding = is_little_endian() ? encoding_utf32_le : encoding_utf32_be; + xml_encoding native_encoding = is_little_endian() ? encoding_utf32_le : encoding_utf32_be; return (native_encoding == encoding) ? convert_buffer_utf32(out_buffer, out_length, contents, size, opt_false()) : @@ -2378,7 +2378,7 @@ namespace }; // Output facilities - encoding_t get_write_native_encoding() + xml_encoding get_write_native_encoding() { #ifdef PUGIXML_WCHAR_MODE return get_wchar_encoding(); @@ -2387,7 +2387,7 @@ namespace #endif } - encoding_t get_write_encoding(encoding_t encoding) + xml_encoding get_write_encoding(xml_encoding encoding) { // replace wchar encoding with utf implementation if (encoding == encoding_wchar) return get_wchar_encoding(); @@ -2414,7 +2414,7 @@ namespace return (sizeof(wchar_t) == 2 && (unsigned)(static_cast(data[length - 1]) - 0xD800) < 0x400) ? length - 1 : length; } - size_t convert_buffer(char* result, const char_t* data, size_t length, encoding_t encoding) + size_t convert_buffer(char* result, const char_t* data, size_t length, xml_encoding encoding) { // only endian-swapping is required if (need_endian_swap_utf(encoding, get_wchar_encoding())) @@ -2445,7 +2445,7 @@ namespace uint16_t* end = utf_decoder::decode_utf32_block(reinterpret_cast(data), length, dest); // swap if necessary - encoding_t native_encoding = is_little_endian() ? encoding_utf16_le : encoding_utf16_be; + xml_encoding native_encoding = is_little_endian() ? encoding_utf16_le : encoding_utf16_be; if (native_encoding != encoding) convert_utf_endian_swap(dest, dest, static_cast(end - dest)); @@ -2461,7 +2461,7 @@ namespace uint32_t* end = utf_decoder::decode_utf16_block(reinterpret_cast(data), length, dest); // swap if necessary - encoding_t native_encoding = is_little_endian() ? encoding_utf32_le : encoding_utf32_be; + xml_encoding native_encoding = is_little_endian() ? encoding_utf32_le : encoding_utf32_be; if (native_encoding != encoding) convert_utf_endian_swap(dest, dest, static_cast(end - dest)); @@ -2490,7 +2490,7 @@ namespace return length; } - size_t convert_buffer(char* result, const char_t* data, size_t length, encoding_t encoding) + size_t convert_buffer(char* result, const char_t* data, size_t length, xml_encoding encoding) { if (encoding == encoding_utf16_be || encoding == encoding_utf16_le) { @@ -2500,7 +2500,7 @@ namespace uint16_t* end = utf_decoder::decode_utf8_block(reinterpret_cast(data), length, dest); // swap if necessary - encoding_t native_encoding = is_little_endian() ? encoding_utf16_le : encoding_utf16_be; + xml_encoding native_encoding = is_little_endian() ? encoding_utf16_le : encoding_utf16_be; if (native_encoding != encoding) convert_utf_endian_swap(dest, dest, static_cast(end - dest)); @@ -2515,7 +2515,7 @@ namespace uint32_t* end = utf_decoder::decode_utf8_block(reinterpret_cast(data), length, dest); // swap if necessary - encoding_t native_encoding = is_little_endian() ? encoding_utf32_le : encoding_utf32_be; + xml_encoding native_encoding = is_little_endian() ? encoding_utf32_le : encoding_utf32_be; if (native_encoding != encoding) convert_utf_endian_swap(dest, dest, static_cast(end - dest)); @@ -2535,7 +2535,7 @@ namespace xml_buffered_writer& operator=(const xml_buffered_writer&); public: - xml_buffered_writer(xml_writer& writer, encoding_t user_encoding): writer(writer), bufsize(0), encoding(get_write_encoding(user_encoding)) + xml_buffered_writer(xml_writer& writer, xml_encoding user_encoding): writer(writer), bufsize(0), encoding(get_write_encoding(user_encoding)) { } @@ -2687,10 +2687,10 @@ namespace xml_writer& writer; size_t bufsize; - encoding_t encoding; + xml_encoding encoding; }; - void write_bom(xml_writer& writer, encoding_t encoding) + void write_bom(xml_writer& writer, xml_encoding encoding) { switch (encoding) { @@ -2967,7 +2967,7 @@ namespace } #ifndef PUGIXML_NO_STL - template xml_parse_result load_stream_impl(xml_document& doc, std::basic_istream >& stream, unsigned int options, encoding_t encoding) + template xml_parse_result load_stream_impl(xml_document& doc, std::basic_istream >& stream, unsigned int options, xml_encoding encoding) { if (!stream.good()) return make_parse_result(status_io_error); @@ -3991,7 +3991,7 @@ namespace pugi return 0; } - void xml_node::print(xml_writer& writer, const char_t* indent, unsigned int flags, encoding_t encoding, unsigned int depth) const + void xml_node::print(xml_writer& writer, const char_t* indent, unsigned int flags, xml_encoding encoding, unsigned int depth) const { if (!_root) return; @@ -4001,7 +4001,7 @@ namespace pugi } #ifndef PUGIXML_NO_STL - void xml_node::print(std::basic_ostream >& stream, const char_t* indent, unsigned int flags, encoding_t encoding, unsigned int depth) const + void xml_node::print(std::basic_ostream >& stream, const char_t* indent, unsigned int flags, xml_encoding encoding, unsigned int depth) const { if (!_root) return; @@ -4289,7 +4289,7 @@ namespace pugi } #ifndef PUGIXML_NO_STL - xml_parse_result xml_document::load(std::basic_istream >& stream, unsigned int options, encoding_t encoding) + xml_parse_result xml_document::load(std::basic_istream >& stream, unsigned int options, xml_encoding encoding) { create(); @@ -4310,9 +4310,9 @@ namespace pugi // Force native encoding (skip autodetection) #ifdef PUGIXML_WCHAR_MODE - encoding_t encoding = encoding_wchar; + xml_encoding encoding = encoding_wchar; #else - encoding_t encoding = encoding_utf8; + xml_encoding encoding = encoding_utf8; #endif return load_buffer(contents, impl::strlen(contents) * sizeof(char_t), options, encoding); @@ -4328,7 +4328,7 @@ namespace pugi return load_buffer_inplace_own(xmlstr, strlen(xmlstr), options, encoding_utf8); } - xml_parse_result xml_document::load_file(const char* path, unsigned int options, encoding_t encoding) + xml_parse_result xml_document::load_file(const char* path, unsigned int options, xml_encoding encoding) { create(); @@ -4365,12 +4365,12 @@ namespace pugi return load_buffer_inplace_own(s, length, options, encoding); } - xml_parse_result xml_document::load_buffer_impl(void* contents, size_t size, unsigned int options, encoding_t encoding, bool is_mutable, bool own) + xml_parse_result xml_document::load_buffer_impl(void* contents, size_t size, unsigned int options, xml_encoding encoding, bool is_mutable, bool own) { create(); // get actual encoding - encoding_t buffer_encoding = get_buffer_encoding(encoding, contents, size); + xml_encoding buffer_encoding = get_buffer_encoding(encoding, contents, size); // get private buffer char_t* buffer = 0; @@ -4393,22 +4393,22 @@ namespace pugi return res; } - xml_parse_result xml_document::load_buffer(const void* contents, size_t size, unsigned int options, encoding_t encoding) + xml_parse_result xml_document::load_buffer(const void* contents, size_t size, unsigned int options, xml_encoding encoding) { return load_buffer_impl(const_cast(contents), size, options, encoding, false, false); } - xml_parse_result xml_document::load_buffer_inplace(void* contents, size_t size, unsigned int options, encoding_t encoding) + xml_parse_result xml_document::load_buffer_inplace(void* contents, size_t size, unsigned int options, xml_encoding encoding) { return load_buffer_impl(contents, size, options, encoding, true, false); } - xml_parse_result xml_document::load_buffer_inplace_own(void* contents, size_t size, unsigned int options, encoding_t encoding) + xml_parse_result xml_document::load_buffer_inplace_own(void* contents, size_t size, unsigned int options, xml_encoding encoding) { return load_buffer_impl(contents, size, options, encoding, true, true); } - void xml_document::save(xml_writer& writer, const char_t* indent, unsigned int flags, encoding_t encoding) const + void xml_document::save(xml_writer& writer, const char_t* indent, unsigned int flags, xml_encoding encoding) const { if (flags & format_write_bom) write_bom(writer, get_write_encoding(encoding)); @@ -4424,7 +4424,7 @@ namespace pugi } #ifndef PUGIXML_NO_STL - void xml_document::save(std::basic_ostream >& stream, const char_t* indent, unsigned int flags, encoding_t encoding) const + void xml_document::save(std::basic_ostream >& stream, const char_t* indent, unsigned int flags, xml_encoding encoding) const { xml_writer_stream writer(stream); @@ -4439,7 +4439,7 @@ namespace pugi } #endif - bool xml_document::save_file(const char* path, const char_t* indent, unsigned int flags, encoding_t encoding) const + bool xml_document::save_file(const char* path, const char_t* indent, unsigned int flags, xml_encoding encoding) const { FILE* file = fopen(path, "wb"); if (!file) return false; diff --git a/src/pugixml.hpp b/src/pugixml.hpp index 579e5b4..b9b4808 100644 --- a/src/pugixml.hpp +++ b/src/pugixml.hpp @@ -271,7 +271,7 @@ namespace pugi * which means that document encoding is auto-detected from BOM and necessary encoding conversions are * applied. You can override this mode by using any of the specific encodings. */ - enum encoding_t + enum xml_encoding { encoding_auto, //!< Auto-detect input encoding using BOM or < / >& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, encoding_t encoding = encoding_auto, unsigned int depth = 0) const; + void print(std::basic_ostream >& os, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto, unsigned int depth = 0) const; /** * Print subtree to stream @@ -1810,7 +1810,7 @@ namespace pugi ptrdiff_t offset; /// Source document encoding - encoding_t encoding; + xml_encoding encoding; /// Cast to bool operator operator bool() const @@ -1839,7 +1839,7 @@ namespace pugi void create(); void destroy(); - xml_parse_result load_buffer_impl(void* contents, size_t size, unsigned int options, encoding_t encoding, bool is_mutable, bool own); + xml_parse_result load_buffer_impl(void* contents, size_t size, unsigned int options, xml_encoding encoding, bool is_mutable, bool own); public: /** @@ -1862,7 +1862,7 @@ namespace pugi * \param encoding - source data encoding * \return parsing result */ - xml_parse_result load(std::basic_istream >& stream, unsigned int options = parse_default, encoding_t encoding = encoding_auto); + xml_parse_result load(std::basic_istream >& stream, unsigned int options = parse_default, xml_encoding encoding = encoding_auto); /** * Load document from stream. @@ -1919,7 +1919,7 @@ namespace pugi * \param encoding - source data encoding * \return parsing result */ - xml_parse_result load_file(const char* path, unsigned int options = parse_default, encoding_t encoding = encoding_auto); + xml_parse_result load_file(const char* path, unsigned int options = parse_default, xml_encoding encoding = encoding_auto); /** * Load document from buffer @@ -1930,7 +1930,7 @@ namespace pugi * \param encoding - source data encoding * \return parsing result */ - xml_parse_result load_buffer(const void* contents, size_t size, unsigned int options = parse_default, encoding_t encoding = encoding_auto); + xml_parse_result load_buffer(const void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto); /** * Load document from buffer in-situ. @@ -1943,7 +1943,7 @@ namespace pugi * \param encoding - source data encoding * \return parsing result */ - xml_parse_result load_buffer_inplace(void* contents, size_t size, unsigned int options = parse_default, encoding_t encoding = encoding_auto); + xml_parse_result load_buffer_inplace(void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto); /** * Load document from buffer in-situ (gains buffer ownership). @@ -1957,7 +1957,7 @@ namespace pugi * \param encoding - source data encoding * \return parsing result */ - xml_parse_result load_buffer_inplace_own(void* contents, size_t size, unsigned int options = parse_default, encoding_t encoding = encoding_auto); + xml_parse_result load_buffer_inplace_own(void* contents, size_t size, unsigned int options = parse_default, xml_encoding encoding = encoding_auto); /** * Save XML to writer @@ -1967,7 +1967,7 @@ namespace pugi * \param flags - formatting flags * \param encoding - encoding used for writing */ - void save(xml_writer& writer, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, encoding_t encoding = encoding_auto) const; + void save(xml_writer& writer, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const; #ifndef PUGIXML_NO_STL /** @@ -1978,7 +1978,7 @@ namespace pugi * \param flags - formatting flags * \param encoding - encoding used for writing */ - void save(std::basic_ostream >& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, encoding_t encoding = encoding_auto) const; + void save(std::basic_ostream >& stream, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const; /** * Save XML to stream @@ -1999,7 +1999,7 @@ namespace pugi * \param encoding - encoding used for writing * \return success flag */ - bool save_file(const char* path, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, encoding_t encoding = encoding_auto) const; + bool save_file(const char* path, const char_t* indent = PUGIXML_TEXT("\t"), unsigned int flags = format_default, xml_encoding encoding = encoding_auto) const; /** * Compute document order for the whole tree diff --git a/src/pugixpath.cpp b/src/pugixpath.cpp index 89c24cd..5248555 100644 --- a/src/pugixpath.cpp +++ b/src/pugixpath.cpp @@ -1315,7 +1315,7 @@ namespace pugi private: ast_type_t m_type; - xpath_type_t m_rettype; + xpath_value_type m_rettype; // tree node structure xpath_ast_node* m_left; @@ -1336,7 +1336,7 @@ namespace pugi template static bool compare_eq(xpath_ast_node* lhs, xpath_ast_node* rhs, const xpath_context& c, const Comp& comp) { - xpath_type_t lt = lhs->rettype(), rt = rhs->rettype(); + xpath_value_type lt = lhs->rettype(), rt = rhs->rettype(); if (lt != xpath_type_node_set && rt != xpath_type_node_set) { @@ -1405,7 +1405,7 @@ namespace pugi template static bool compare_rel(xpath_ast_node* lhs, xpath_ast_node* rhs, const xpath_context& c, const Comp& comp) { - xpath_type_t lt = lhs->rettype(), rt = rhs->rettype(); + xpath_value_type lt = lhs->rettype(), rt = rhs->rettype(); if (lt != xpath_type_node_set && rt != xpath_type_node_set) return comp(lhs->eval_number(c), rhs->eval_number(c)); @@ -1955,7 +1955,7 @@ namespace pugi else m_contents = 0; } public: - xpath_ast_node(ast_type_t type, xpath_type_t rettype, const xpath_lexer_string& contents, xpath_allocator& a): + xpath_ast_node(ast_type_t type, xpath_value_type rettype, const xpath_lexer_string& contents, xpath_allocator& a): m_type(type), m_rettype(rettype), m_left(0), m_right(0), m_third(0), m_next(0), m_contents(0), m_axis(axis_self), m_test(nodetest_none) { @@ -1968,7 +1968,7 @@ namespace pugi { } - xpath_ast_node(ast_type_t type, xpath_type_t rettype, xpath_ast_node* left = 0, xpath_ast_node* right = 0, xpath_ast_node* third = 0): + xpath_ast_node(ast_type_t type, xpath_value_type rettype, xpath_ast_node* left = 0, xpath_ast_node* right = 0, xpath_ast_node* third = 0): m_type(type), m_rettype(rettype), m_left(left), m_right(right), m_third(third), m_next(0), m_contents(0), m_axis(axis_self), m_test(nodetest_none) { @@ -2608,7 +2608,7 @@ namespace pugi } } - xpath_type_t rettype() const + xpath_value_type rettype() const { return m_rettype; } @@ -3429,7 +3429,7 @@ namespace pugi m_root = p.parse(); } - xpath_type_t xpath_query::return_type() const + xpath_value_type xpath_query::return_type() const { if (!m_root) return xpath_type_none; diff --git a/tests/test.cpp b/tests/test.cpp index 247c714..862a0ea 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -171,7 +171,7 @@ bool is_little_endian() return *reinterpret_cast(&ui) == 1; } -pugi::encoding_t get_native_encoding() +pugi::xml_encoding get_native_encoding() { #ifdef PUGIXML_WCHAR_MODE return pugi::encoding_wchar; diff --git a/tests/test.hpp b/tests/test.hpp index e99eb57..d4b5879 100644 --- a/tests/test.hpp +++ b/tests/test.hpp @@ -146,6 +146,6 @@ inline wchar_t wchar_cast(unsigned int value) } bool is_little_endian(); -pugi::encoding_t get_native_encoding(); +pugi::xml_encoding get_native_encoding(); #endif diff --git a/tests/test_document.cpp b/tests/test_document.cpp index 11be6da..c40c14a 100644 --- a/tests/test_document.cpp +++ b/tests/test_document.cpp @@ -394,7 +394,7 @@ TEST(document_load_file_convert_auto) "tests/data/utftest_utf8_nodecl.xml" }; - encoding_t encodings[] = + xml_encoding encodings[] = { encoding_utf16_be, encoding_utf16_be, encoding_utf16_be, encoding_utf16_le, encoding_utf16_le, encoding_utf16_le, @@ -435,7 +435,7 @@ TEST(document_load_file_convert_specific) "tests/data/utftest_utf8_nodecl.xml" }; - encoding_t encodings[] = + xml_encoding encodings[] = { encoding_utf16_be, encoding_utf16_be, encoding_utf16_be, encoding_utf16_le, encoding_utf16_le, encoding_utf16_le, @@ -448,7 +448,7 @@ TEST(document_load_file_convert_specific) { for (unsigned int j = 0; j < sizeof(files) / sizeof(files[0]); ++j) { - encoding_t encoding = encodings[j]; + xml_encoding encoding = encodings[j]; xml_document doc; xml_parse_result res = doc.load_file(files[i], parse_default, encoding); @@ -490,7 +490,7 @@ TEST(document_load_file_convert_native_endianness) } }; - encoding_t encodings[] = + xml_encoding encodings[] = { encoding_utf16, encoding_utf16, encoding_utf16, encoding_utf32, encoding_utf32, encoding_utf32 @@ -503,7 +503,7 @@ TEST(document_load_file_convert_native_endianness) for (unsigned int j = 0; j < sizeof(encodings) / sizeof(encodings[0]); ++j) { - encoding_t encoding = encodings[j]; + xml_encoding encoding = encodings[j]; // check file with right endianness { @@ -554,7 +554,7 @@ TEST(document_contents_preserve) struct file_t { const char* path; - encoding_t encoding; + xml_encoding encoding; char* data; size_t size; @@ -596,7 +596,7 @@ TEST(document_contents_preserve) } } -static bool test_parse_fail(const void* buffer, size_t size, encoding_t encoding = encoding_utf8) +static bool test_parse_fail(const void* buffer, size_t size, xml_encoding encoding = encoding_utf8) { // copy buffer to heap (to enable out-of-bounds checks) void* temp = malloc(size); @@ -646,7 +646,7 @@ TEST(document_convert_invalid_utf16) TEST(document_load_buffer_empty) { - encoding_t encodings[] = + xml_encoding encodings[] = { encoding_auto, encoding_utf8, @@ -663,7 +663,7 @@ TEST(document_load_buffer_empty) for (unsigned int i = 0; i < sizeof(encodings) / sizeof(encodings[0]); ++i) { - encoding_t encoding = encodings[i]; + xml_encoding encoding = encodings[i]; xml_document doc; CHECK(doc.load_buffer(buffer, 0, parse_default, encoding) && !doc.first_child()); diff --git a/tests/writer_string.cpp b/tests/writer_string.cpp index b2c089f..878a103 100644 --- a/tests/writer_string.cpp +++ b/tests/writer_string.cpp @@ -39,7 +39,7 @@ std::basic_string xml_writer_string::as_string() const return std::basic_string(reinterpret_cast(contents.data()), contents.size() / sizeof(pugi::char_t)); } -std::string save_narrow(const pugi::xml_document& doc, unsigned int flags, pugi::encoding_t encoding) +std::string save_narrow(const pugi::xml_document& doc, unsigned int flags, pugi::xml_encoding encoding) { xml_writer_string writer; @@ -48,12 +48,12 @@ std::string save_narrow(const pugi::xml_document& doc, unsigned int flags, pugi: return writer.as_narrow(); } -bool test_save_narrow(const pugi::xml_document& doc, unsigned int flags, pugi::encoding_t encoding, const char* expected, size_t length) +bool test_save_narrow(const pugi::xml_document& doc, unsigned int flags, pugi::xml_encoding encoding, const char* expected, size_t length) { return test_narrow(save_narrow(doc, flags, encoding), expected, length); } -std::string write_narrow(pugi::xml_node node, unsigned int flags, pugi::encoding_t encoding) +std::string write_narrow(pugi::xml_node node, unsigned int flags, pugi::xml_encoding encoding) { xml_writer_string writer; @@ -62,12 +62,12 @@ std::string write_narrow(pugi::xml_node node, unsigned int flags, pugi::encoding return writer.as_narrow(); } -bool test_write_narrow(pugi::xml_node node, unsigned int flags, pugi::encoding_t encoding, const char* expected, size_t length) +bool test_write_narrow(pugi::xml_node node, unsigned int flags, pugi::xml_encoding encoding, const char* expected, size_t length) { return test_narrow(write_narrow(node, flags, encoding), expected, length); } -std::wstring write_wide(pugi::xml_node node, unsigned int flags, pugi::encoding_t encoding) +std::wstring write_wide(pugi::xml_node node, unsigned int flags, pugi::xml_encoding encoding) { xml_writer_string writer; diff --git a/tests/writer_string.hpp b/tests/writer_string.hpp index a862922..acf6318 100644 --- a/tests/writer_string.hpp +++ b/tests/writer_string.hpp @@ -16,12 +16,12 @@ struct xml_writer_string: public pugi::xml_writer std::basic_string as_string() const; }; -std::string save_narrow(const pugi::xml_document& doc, unsigned int flags, pugi::encoding_t encoding); -bool test_save_narrow(const pugi::xml_document& doc, unsigned int flags, pugi::encoding_t encoding, const char* expected, size_t length); +std::string save_narrow(const pugi::xml_document& doc, unsigned int flags, pugi::xml_encoding encoding); +bool test_save_narrow(const pugi::xml_document& doc, unsigned int flags, pugi::xml_encoding encoding, const char* expected, size_t length); -std::string write_narrow(pugi::xml_node node, unsigned int flags, pugi::encoding_t encoding); -bool test_write_narrow(pugi::xml_node node, unsigned int flags, pugi::encoding_t encoding, const char* expected, size_t length); +std::string write_narrow(pugi::xml_node node, unsigned int flags, pugi::xml_encoding encoding); +bool test_write_narrow(pugi::xml_node node, unsigned int flags, pugi::xml_encoding encoding, const char* expected, size_t length); -std::wstring write_wide(pugi::xml_node node, unsigned int flags, pugi::encoding_t encoding); +std::wstring write_wide(pugi::xml_node node, unsigned int flags, pugi::xml_encoding encoding); #endif -- cgit v1.2.3