summaryrefslogtreecommitdiff
path: root/tests/writer_string.cpp
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-07-19 09:57:32 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2010-07-19 09:57:32 +0000
commit7d24b9b5655d584b6dc8b89df7cbd58d2e940a81 (patch)
tree0301baa043cd688068f6ffa11ad56d284031e664 /tests/writer_string.cpp
parent86ac39edb09647b83784c078f9ea3bd3b7a7d4e8 (diff)
Set svn:eol-style to native for all text files
git-svn-id: http://pugixml.googlecode.com/svn/trunk@607 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/writer_string.cpp')
-rw-r--r--tests/writer_string.cpp154
1 files changed, 77 insertions, 77 deletions
diff --git a/tests/writer_string.cpp b/tests/writer_string.cpp
index 878a103..f35b461 100644
--- a/tests/writer_string.cpp
+++ b/tests/writer_string.cpp
@@ -1,77 +1,77 @@
-#include "writer_string.hpp"
-
-#include "test.hpp"
-
-static bool test_narrow(const std::string& result, const char* expected, size_t length)
-{
- // check result
- if (result != std::string(expected, expected + length)) return false;
-
- // check comparison operator (incorrect implementation can theoretically early-out on zero terminators...)
- if (length > 0 && result == std::string(expected, expected + length - 1) + "?") return false;
-
- return true;
-}
-
-void xml_writer_string::write(const void* data, size_t size)
-{
- contents += std::string(static_cast<const char*>(data), size);
-}
-
-std::string xml_writer_string::as_narrow() const
-{
- return contents;
-}
-
-std::wstring xml_writer_string::as_wide() const
-{
- CHECK(contents.size() % sizeof(wchar_t) == 0);
-
- return std::wstring(reinterpret_cast<const wchar_t*>(contents.data()), contents.size() / sizeof(wchar_t));
-}
-
-std::basic_string<pugi::char_t> xml_writer_string::as_string() const
-{
-#ifdef PUGIXML_WCHAR_MODE // to avoid "condition is always true" warning in BCC
- CHECK(contents.size() % sizeof(pugi::char_t) == 0);
-#endif
-
- return std::basic_string<pugi::char_t>(reinterpret_cast<const pugi::char_t*>(contents.data()), contents.size() / sizeof(pugi::char_t));
-}
-
-std::string save_narrow(const pugi::xml_document& doc, unsigned int flags, pugi::xml_encoding encoding)
-{
- xml_writer_string writer;
-
- doc.save(writer, STR(""), flags, encoding);
-
- return writer.as_narrow();
-}
-
-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::xml_encoding encoding)
-{
- xml_writer_string writer;
-
- node.print(writer, STR(""), flags, encoding);
-
- return writer.as_narrow();
-}
-
-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::xml_encoding encoding)
-{
- xml_writer_string writer;
-
- node.print(writer, STR(""), flags, encoding);
-
- return writer.as_wide();
-}
+#include "writer_string.hpp"
+
+#include "test.hpp"
+
+static bool test_narrow(const std::string& result, const char* expected, size_t length)
+{
+ // check result
+ if (result != std::string(expected, expected + length)) return false;
+
+ // check comparison operator (incorrect implementation can theoretically early-out on zero terminators...)
+ if (length > 0 && result == std::string(expected, expected + length - 1) + "?") return false;
+
+ return true;
+}
+
+void xml_writer_string::write(const void* data, size_t size)
+{
+ contents += std::string(static_cast<const char*>(data), size);
+}
+
+std::string xml_writer_string::as_narrow() const
+{
+ return contents;
+}
+
+std::wstring xml_writer_string::as_wide() const
+{
+ CHECK(contents.size() % sizeof(wchar_t) == 0);
+
+ return std::wstring(reinterpret_cast<const wchar_t*>(contents.data()), contents.size() / sizeof(wchar_t));
+}
+
+std::basic_string<pugi::char_t> xml_writer_string::as_string() const
+{
+#ifdef PUGIXML_WCHAR_MODE // to avoid "condition is always true" warning in BCC
+ CHECK(contents.size() % sizeof(pugi::char_t) == 0);
+#endif
+
+ return std::basic_string<pugi::char_t>(reinterpret_cast<const pugi::char_t*>(contents.data()), contents.size() / sizeof(pugi::char_t));
+}
+
+std::string save_narrow(const pugi::xml_document& doc, unsigned int flags, pugi::xml_encoding encoding)
+{
+ xml_writer_string writer;
+
+ doc.save(writer, STR(""), flags, encoding);
+
+ return writer.as_narrow();
+}
+
+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::xml_encoding encoding)
+{
+ xml_writer_string writer;
+
+ node.print(writer, STR(""), flags, encoding);
+
+ return writer.as_narrow();
+}
+
+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::xml_encoding encoding)
+{
+ xml_writer_string writer;
+
+ node.print(writer, STR(""), flags, encoding);
+
+ return writer.as_wide();
+}