summaryrefslogtreecommitdiff
path: root/src/pugixml.hpp
diff options
context:
space:
mode:
authorarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2006-12-08 14:18:07 +0000
committerarseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640>2006-12-08 14:18:07 +0000
commit2fdfe430a209a851fdd5a22377031099e6c30fe6 (patch)
tree8f5d051a297b4b1e52926c19391831766e2c4519 /src/pugixml.hpp
parent89076ef2e507f5c6f7c775175e9aeb4a51ae22ba (diff)
PUGIXML_NO_STL mode, transfer_ownership ctor/parse function
git-svn-id: http://pugixml.googlecode.com/svn/trunk@12 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'src/pugixml.hpp')
-rw-r--r--src/pugixml.hpp30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/pugixml.hpp b/src/pugixml.hpp
index 7c65ebe..e651b84 100644
--- a/src/pugixml.hpp
+++ b/src/pugixml.hpp
@@ -14,9 +14,10 @@
#ifndef HEADER_PUGIXML_HPP
#define HEADER_PUGIXML_HPP
-#include <vector>
-#include <string>
-#include <istream>
+#ifndef PUGIXML_NO_STL
+# include <string>
+# include <istream>
+#endif
/// The PugiXML Parser namespace.
namespace pugi
@@ -479,11 +480,13 @@ namespace pugi
char data[memory_block_size];
};
+ struct transfer_ownership_tag {};
+
/// Provides a high-level interface to the XML parser.
class xml_parser
{
private:
- std::vector<char> _buffer; ///< character buffer
+ char* _buffer; ///< character buffer
xml_memory_block _memory; ///< Memory block
@@ -504,11 +507,19 @@ namespace pugi
/// \see parse
xml_parser(char* xmlstr, unsigned int optmsk = parse_default);
+ /// Parse constructor that gains ownership.
+ /// \param xmlstr - readwrite string with xml data
+ /// \param optmsk - Options mask.
+ /// \see parse
+ xml_parser(const transfer_ownership_tag&, char* xmlstr, unsigned int optmsk = parse_default);
+
+#ifndef PUGIXML_NO_STL
/// Parse constructor.
/// \param stream - stream with xml data
/// \param optmsk - Options mask.
/// \see parse
xml_parser(std::istream& stream, unsigned int optmsk = parse_default);
+#endif
/// Dtor
~xml_parser();
@@ -528,10 +539,12 @@ namespace pugi
unsigned int options(unsigned int optmsk);
public:
+#ifndef PUGIXML_NO_STL
/// Parse the given XML stream
/// \param stream - stream with xml data
/// \param optmsk - Options mask.
void parse(std::istream& stream, unsigned int optmsk = parse_noset);
+#endif
/// Parse the given XML string in-situ.
/// \param xmlstr - readwrite string with xml data
@@ -539,15 +552,24 @@ namespace pugi
/// \return last position or NULL
/// \rem input string is zero-segmented
char* parse(char* xmlstr, unsigned int optmsk = parse_noset);
+
+ /// Parse the given XML string in-situ (gains ownership).
+ /// \param xmlstr - readwrite string with xml data
+ /// \param optmsk - Options mask.
+ /// \return last position or NULL
+ /// \rem input string is zero-segmented
+ char* parse(const transfer_ownership_tag&, char* xmlstr, unsigned int optmsk = parse_noset);
};
/// Utility functions for xml
+#ifndef PUGIXML_NO_STL
/// Convert utf16 to utf8
std::string utf8(const wchar_t* str);
/// Convert utf8 to utf16
std::wstring utf16(const char* str);
+#endif
}
/// Inline implementation