|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r53032 - in branches/sredl_2009_05_proptree_update/boost/property_tree: . detail
From: sebastian.redl_at_[hidden]
Date: 2009-05-15 13:57:21
Author: cornedbee
Date: 2009-05-15 13:57:20 EDT (Fri, 15 May 2009)
New Revision: 53032
URL: http://svn.boost.org/trac/boost/changeset/53032
Log:
More reformatting, and hopefully complete update to new template args.
Text files modified:
branches/sredl_2009_05_proptree_update/boost/property_tree/detail/exceptions_implementation.hpp | 35 ++-
branches/sredl_2009_05_proptree_update/boost/property_tree/detail/file_parser_error.hpp | 45 +++--
branches/sredl_2009_05_proptree_update/boost/property_tree/detail/info_parser_error.hpp | 8
branches/sredl_2009_05_proptree_update/boost/property_tree/detail/info_parser_read.hpp | 68 ++++---
branches/sredl_2009_05_proptree_update/boost/property_tree/detail/path_implementation.hpp | 26 +-
branches/sredl_2009_05_proptree_update/boost/property_tree/detail/ptree_implementation.hpp | 328 ++++++++++++++++++++--------------------
branches/sredl_2009_05_proptree_update/boost/property_tree/detail/ptree_utils.hpp | 10
branches/sredl_2009_05_proptree_update/boost/property_tree/detail/xml_parser_error.hpp | 2
branches/sredl_2009_05_proptree_update/boost/property_tree/detail/xml_parser_read_spirit.hpp | 4
branches/sredl_2009_05_proptree_update/boost/property_tree/info_parser.hpp | 64 +++++--
branches/sredl_2009_05_proptree_update/boost/property_tree/ini_parser.hpp | 131 ++++++++++-----
branches/sredl_2009_05_proptree_update/boost/property_tree/json_parser.hpp | 61 ++++---
branches/sredl_2009_05_proptree_update/boost/property_tree/ptree.hpp | 6
branches/sredl_2009_05_proptree_update/boost/property_tree/ptree_serialization.hpp | 77 +++++----
branches/sredl_2009_05_proptree_update/boost/property_tree/xml_parser.hpp | 70 +++++---
15 files changed, 525 insertions(+), 410 deletions(-)
Modified: branches/sredl_2009_05_proptree_update/boost/property_tree/detail/exceptions_implementation.hpp
==============================================================================
--- branches/sredl_2009_05_proptree_update/boost/property_tree/detail/exceptions_implementation.hpp (original)
+++ branches/sredl_2009_05_proptree_update/boost/property_tree/detail/exceptions_implementation.hpp 2009-05-15 13:57:20 EDT (Fri, 15 May 2009)
@@ -25,13 +25,16 @@
// Helper for preparing what string in ptree_bad_path exception
template<class P>
- std::string prepare_bad_path_what(const std::string &what, const P &path)
+ std::string prepare_bad_path_what(const std::string &what,
+ const P &path)
{
- using namespace detail; // To allow correct resolution of path_to_string()
+ // To allow correct resolution of path_to_string()
+ using namespace detail;
return what + " (" + path_to_string(path) + ")";
}
- // Default data-to-string converter; this is overridden for default data (string)
+ // Default data-to-string converter; this is overridden for default
+ // data (string)
template<class D>
std::string data_to_string(const D &data)
{
@@ -39,10 +42,12 @@
}
// Helper for preparing what string in ptree_bad_data exception
- template<class D>
- std::string prepare_bad_data_what(const std::string &what, const D &data)
+ template<class D>
+ std::string prepare_bad_data_what(const std::string &what,
+ const D &data)
{
- using namespace detail; // To allow correct resolution of data_to_string()
+ // To allow correct resolution of data_to_string()
+ using namespace detail;
return what + " (" + data_to_string(data) + ")";
}
@@ -53,19 +58,19 @@
inline ptree_error::ptree_error(const std::string &what):
std::runtime_error(what)
- {
+ {
}
-
+
inline ptree_error::~ptree_error() throw()
- {
+ {
}
///////////////////////////////////////////////////////////////////////////
// ptree_bad_data
- template<class D>
+ template<class D>
ptree_bad_data::ptree_bad_data(const std::string &what, const D &data):
- ptree_error(detail::prepare_bad_data_what(what, data)),
+ ptree_error(detail::prepare_bad_data_what(what, data)),
m_data(data)
{
}
@@ -74,7 +79,7 @@
{
}
- template<class D>
+ template<class D>
D ptree_bad_data::data()
{
return boost::any_cast<D>(m_data);
@@ -83,9 +88,9 @@
///////////////////////////////////////////////////////////////////////////
// ptree_bad_path
- template<class P>
+ template<class P>
ptree_bad_path::ptree_bad_path(const std::string &what, const P &path):
- ptree_error(detail::prepare_bad_path_what(what, path)),
+ ptree_error(detail::prepare_bad_path_what(what, path)),
m_path(path)
{
@@ -95,7 +100,7 @@
{
}
- template<class P>
+ template<class P>
P ptree_bad_path::path()
{
return boost::any_cast<P>(m_path);
Modified: branches/sredl_2009_05_proptree_update/boost/property_tree/detail/file_parser_error.hpp
==============================================================================
--- branches/sredl_2009_05_proptree_update/boost/property_tree/detail/file_parser_error.hpp (original)
+++ branches/sredl_2009_05_proptree_update/boost/property_tree/detail/file_parser_error.hpp 2009-05-15 13:57:20 EDT (Fri, 15 May 2009)
@@ -24,30 +24,32 @@
///////////////////////////////////////////////////////////////////////
// Construction & destruction
-
+
// Construct error
- file_parser_error(const std::string &message,
- const std::string &filename,
- unsigned long line):
- ptree_error(format_what(message, filename, line)),
+ file_parser_error(const std::string &message,
+ const std::string &filename,
+ unsigned long line) :
+ ptree_error(format_what(message, filename, line)),
m_message(message), m_filename(filename), m_line(line)
- {
+ {
}
- ~file_parser_error() throw()
- // gcc 3.4.2 complains about lack of throw specifier on compiler generated dtor
+ ~file_parser_error() throw()
+ // gcc 3.4.2 complains about lack of throw specifier on compiler
+ // generated dtor
{
}
///////////////////////////////////////////////////////////////////////
// Data access
-
- // Get error message (without line and file - use what() to get full message)
+
+ // Get error message (without line and file - use what() to get
+ // full message)
std::string message()
{
return m_message;
}
-
+
// Get error filename
std::string filename()
{
@@ -55,29 +57,32 @@
}
// Get error line number
- unsigned long line()
- {
- return m_line;
+ unsigned long line()
+ {
+ return m_line;
}
private:
-
+
std::string m_message;
std::string m_filename;
unsigned long m_line;
// Format error message to be returned by std::runtime_error::what()
std::string format_what(const std::string &message,
- const std::string &filename,
+ const std::string &filename,
unsigned long line)
{
std::stringstream stream;
if (line > 0)
- stream << (filename.empty() ? "<unspecified file>" : filename.c_str()) <<
- '(' << line << "): " << message;
+ stream << (filename.empty() ? "<unspecified file>"
+ : filename.c_str())
+ << '(' << line << "): "
+ << message;
else
- stream << (filename.empty() ? "<unspecified file>" : filename.c_str()) <<
- ": " << message;
+ stream << (filename.empty() ? "<unspecified file>"
+ : filename.c_str())
+ << ": " << message;
return stream.str();
}
Modified: branches/sredl_2009_05_proptree_update/boost/property_tree/detail/info_parser_error.hpp
==============================================================================
--- branches/sredl_2009_05_proptree_update/boost/property_tree/detail/info_parser_error.hpp (original)
+++ branches/sredl_2009_05_proptree_update/boost/property_tree/detail/info_parser_error.hpp 2009-05-15 13:57:20 EDT (Fri, 15 May 2009)
@@ -19,11 +19,11 @@
class info_parser_error: public file_parser_error
{
public:
- info_parser_error(const std::string &message,
- const std::string &filename,
- unsigned long line):
+ info_parser_error(const std::string &message,
+ const std::string &filename,
+ unsigned long line) :
file_parser_error(message, filename, line)
- {
+ {
}
};
Modified: branches/sredl_2009_05_proptree_update/boost/property_tree/detail/info_parser_read.hpp
==============================================================================
--- branches/sredl_2009_05_proptree_update/boost/property_tree/detail/info_parser_read.hpp (original)
+++ branches/sredl_2009_05_proptree_update/boost/property_tree/detail/info_parser_read.hpp 2009-05-15 13:57:20 EDT (Fri, 15 May 2009)
@@ -21,10 +21,10 @@
namespace boost { namespace property_tree { namespace info_parser
{
-
+
// Expand known escape sequences
template<class It>
- std::basic_string<typename std::iterator_traits<It>::value_type>
+ std::basic_string<typename std::iterator_traits<It>::value_type>
expand_escapes(It b, It e)
{
typedef typename std::iterator_traits<It>::value_type Ch;
@@ -36,7 +36,8 @@
++b;
if (b == e)
{
- BOOST_PROPERTY_TREE_THROW(info_parser_error("character expected after backslash", "", 0));
+ BOOST_PROPERTY_TREE_THROW(info_parser_error(
+ "character expected after backslash", "", 0));
}
else if (*b == Ch('0')) result += Ch('\0');
else if (*b == Ch('a')) result += Ch('\a');
@@ -50,7 +51,8 @@
else if (*b == Ch('\'')) result += Ch('\'');
else if (*b == Ch('\\')) result += Ch('\\');
else
- BOOST_PROPERTY_TREE_THROW(info_parser_error("unknown escape sequence", "", 0));
+ BOOST_PROPERTY_TREE_THROW(info_parser_error(
+ "unknown escape sequence", "", 0));
}
else
result += *b;
@@ -58,7 +60,7 @@
}
return result;
}
-
+
// Advance pointer past whitespace
template<class Ch>
void skip_whitespace(const Ch *&text)
@@ -67,7 +69,7 @@
while (isspace(*text))
++text;
}
-
+
// Extract word (whitespace delimited) and advance pointer accordingly
template<class Ch>
std::basic_string<Ch> read_word(const Ch *&text)
@@ -102,10 +104,10 @@
skip_whitespace(text);
if (*text == Ch('\"'))
{
-
+
// Skip "
++text;
-
+
// Find end of string, but skip escaped "
bool escaped = false;
const Ch *start = text;
@@ -114,7 +116,7 @@
escaped = (!escaped && *text == Ch('\\'));
++text;
}
-
+
// If end of string found
if (*text == Ch('\"'))
{
@@ -123,13 +125,15 @@
if (*text == Ch('\\'))
{
if (!need_more_lines)
- BOOST_PROPERTY_TREE_THROW(info_parser_error("unexpected \\", "", 0));
+ BOOST_PROPERTY_TREE_THROW(info_parser_error(
+ "unexpected \\", "", 0));
++text;
skip_whitespace(text);
if (*text == Ch('\0') || *text == Ch(';'))
*need_more_lines = true;
else
- BOOST_PROPERTY_TREE_THROW(info_parser_error("expected end of line after \\", "", 0));
+ BOOST_PROPERTY_TREE_THROW(info_parser_error(
+ "expected end of line after \\", "", 0));
}
else
if (need_more_lines)
@@ -137,13 +141,14 @@
return result;
}
else
- BOOST_PROPERTY_TREE_THROW(info_parser_error("unexpected end of line", "", 0));
+ BOOST_PROPERTY_TREE_THROW(info_parser_error(
+ "unexpected end of line", "", 0));
}
else
BOOST_PROPERTY_TREE_THROW(info_parser_error("expected \"", "", 0));
}
-
+
// Extract key
template<class Ch>
std::basic_string<Ch> read_key(const Ch *&text)
@@ -171,59 +176,64 @@
// Build ptree from info stream
template<class Ptree>
- void read_info_internal(std::basic_istream<typename Ptree::key_type::value_type> &stream,
- Ptree &pt,
+ void read_info_internal(std::basic_istream<
+ typename Ptree::key_type::value_type> &stream,
+ Ptree &pt,
const std::string &filename,
int include_depth)
{
-
// Character type
typedef typename Ptree::key_type::value_type Ch;
-
+
// Possible parser states
- enum state_t {
+ enum state_t {
s_key, // Parser expects key
s_data, // Parser expects data
s_data_cont // Parser expects data continuation
};
-
+
unsigned long line_no = 0;
state_t state = s_key; // Parser state
Ptree *last = NULL; // Pointer to last created ptree
- std::basic_string<Ch> line; // Define line here to minimize reallocations
-
+ // Define line here to minimize reallocations
+ std::basic_string<Ch> line;
+
// Initialize ptree stack (used to handle nesting)
std::stack<Ptree *> stack;
stack.push(&pt); // Push root ptree on stack initially
-
+
try
{
-
// While there are characters in the stream
while (stream.good())
{
-
+
// Read one line from stream
++line_no;
std::getline(stream, line);
if (!stream.good() && !stream.eof())
- BOOST_PROPERTY_TREE_THROW(info_parser_error("read error", "", 0));
+ BOOST_PROPERTY_TREE_THROW(info_parser_error(
+ "read error", "", 0));
const Ch *text = line.c_str();
// If directive found
skip_whitespace(text);
if (*text == Ch('#'))
{
-
+
// Determine directive type
++text; // skip #
std::basic_string<Ch> directive = read_word(text);
- if (directive == convert_chtype<Ch, char>("include")) // #include
+ if (directive == convert_chtype<Ch, char>("include"))
{
+ // #include
if (include_depth > 100)
- BOOST_PROPERTY_TREE_THROW(info_parser_error("include depth too large, probably recursive include", "", 0));
+ BOOST_PROPERTY_TREE_THROW(info_parser_error(
+ "include depth too large, "
+ "probably recursive include", "", 0));
std::basic_string<Ch> s = read_string(text, NULL);
- std::string inc_name = convert_chtype<char, Ch>(s.c_str());
+ std::string inc_name =
+ convert_chtype<char, Ch>(s.c_str());
std::basic_ifstream<Ch> inc_stream(inc_name.c_str());
if (!inc_stream.good())
BOOST_PROPERTY_TREE_THROW(info_parser_error("cannot open include file " + inc_name, "", 0));
Modified: branches/sredl_2009_05_proptree_update/boost/property_tree/detail/path_implementation.hpp
==============================================================================
--- branches/sredl_2009_05_proptree_update/boost/property_tree/detail/path_implementation.hpp (original)
+++ branches/sredl_2009_05_proptree_update/boost/property_tree/detail/path_implementation.hpp 2009-05-15 13:57:20 EDT (Fri, 15 May 2009)
@@ -87,11 +87,11 @@
// Operations
template<class Key>
- template<class C, class D, class X>
- basic_ptree<C, Key, basic_path<Key>, D, X> *
- basic_path<Key>::get_child(basic_ptree<C, Key, basic_path<Key>, D, X> &root) const
+ template<class D, class C, class A, class X>
+ basic_ptree<D, Key, C, A, basic_path<Key>, X> *
+ basic_path<Key>::get_child(basic_ptree<D, Key, C, A, basic_path<Key>, X> &root) const
{
- typedef basic_ptree<C, Key, basic_path<Key>, D, X> ptree_type;
+ typedef basic_ptree<D, Key, C, A, basic_path<Key>, X> ptree_type;
ptree_type *pt = &root;
for (typename std::vector<Key>::const_iterator it = m_path.begin(); it != m_path.end(); ++it)
{
@@ -105,21 +105,21 @@
}
template<class Key>
- template<class C, class D, class X>
- const basic_ptree<C, Key, basic_path<Key>, D, X> *
- basic_path<Key>::get_child(const basic_ptree<C, Key, basic_path<Key>, D, X> &root) const
+ template<class D, class C, class A, class X>
+ const basic_ptree<D, Key, C, A, basic_path<Key>, X> *
+ basic_path<Key>::get_child(const basic_ptree<D, Key, C, A, basic_path<Key>, X> &root) const
{
- typedef basic_ptree<C, Key, basic_path<Key>, D, X> ptree_type;
+ typedef basic_ptree<D, Key, C, A, basic_path<Key>, X> ptree_type;
basic_path<Key> *nc_this = const_cast<basic_path<Key> *>(this);
ptree_type &nc_root = const_cast<ptree_type &>(root);
return nc_this->get_child(nc_root);
}
template<class Key>
- template<class C, class D, class X>
- basic_ptree<C, Key, basic_path<Key>, D, X> *
- basic_path<Key>::put_child(basic_ptree<C, Key, basic_path<Key>, D, X> &root,
- const basic_ptree<C, Key, basic_path<Key>, D, X> &child,
+ template<class D, class C, class A, class X>
+ basic_ptree<D, Key, C, A, basic_path<Key>, X> *
+ basic_path<Key>::put_child(basic_ptree<D, Key, C, A, basic_path<Key>, X> &root,
+ const basic_ptree<D, Key, C, A, basic_path<Key>, X> &child,
bool do_not_replace) const
{
if (m_path.empty())
@@ -129,7 +129,7 @@
else
{
- typedef basic_ptree<C, Key, basic_path<Key>, D, X> ptree_type;
+ typedef basic_ptree<D, Key, C, A, basic_path<Key>, X> ptree_type;
typedef typename std::vector<Key>::const_iterator path_iterator;
ptree_type *pt = &root;
Modified: branches/sredl_2009_05_proptree_update/boost/property_tree/detail/ptree_implementation.hpp
==============================================================================
--- branches/sredl_2009_05_proptree_update/boost/property_tree/detail/ptree_implementation.hpp (original)
+++ branches/sredl_2009_05_proptree_update/boost/property_tree/detail/ptree_implementation.hpp 2009-05-15 13:57:20 EDT (Fri, 15 May 2009)
@@ -45,29 +45,29 @@
///////////////////////////////////////////////////////////////////////////
// Construction & destruction
- template<class C, class K, class P, class D, class X>
- basic_ptree<C, K, P, D, X>::basic_ptree()
+ template<class D, class K, class C, class A, class P, class X>
+ basic_ptree<D, K, C, A, P, X>::basic_ptree()
{
BOOST_PROPERTY_TREE_DEBUG_INCREMENT_INSTANCES_COUNT();
}
- template<class C, class K, class P, class D, class X>
- basic_ptree<C, K, P, D, X>::basic_ptree(const data_type &rhs):
+ template<class D, class K, class C, class A, class P, class X>
+ basic_ptree<D, K, C, A, P, X>::basic_ptree(const data_type &rhs):
m_data(rhs)
{
BOOST_PROPERTY_TREE_DEBUG_INCREMENT_INSTANCES_COUNT();
}
- template<class C, class K, class P, class D, class X>
- basic_ptree<C, K, P, D, X>::basic_ptree(const basic_ptree<C, K, P, D, X> &rhs)
+ template<class D, class K, class C, class A, class P, class X>
+ basic_ptree<D, K, C, A, P, X>::basic_ptree(const basic_ptree<D, K, C, A, P, X> &rhs)
{
m_data = rhs.m_data;
insert(end(), rhs.begin(), rhs.end());
BOOST_PROPERTY_TREE_DEBUG_INCREMENT_INSTANCES_COUNT();
}
- template<class C, class K, class P, class D, class X>
- basic_ptree<C, K, P, D, X>::~basic_ptree()
+ template<class D, class K, class C, class A, class P, class X>
+ basic_ptree<D, K, C, A, P, X>::~basic_ptree()
{
BOOST_PROPERTY_TREE_DEBUG_DECREMENT_INSTANCES_COUNT();
}
@@ -75,58 +75,58 @@
///////////////////////////////////////////////////////////////////////////
// Iterator access
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::iterator
- basic_ptree<C, K, P, D, X>::begin()
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::iterator
+ basic_ptree<D, K, C, A, P, X>::begin()
{
return m_container.begin();
}
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::const_iterator
- basic_ptree<C, K, P, D, X>::begin() const
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::const_iterator
+ basic_ptree<D, K, C, A, P, X>::begin() const
{
return m_container.begin();
}
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::iterator
- basic_ptree<C, K, P, D, X>::end()
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::iterator
+ basic_ptree<D, K, C, A, P, X>::end()
{
return m_container.end();
}
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::const_iterator
- basic_ptree<C, K, P, D, X>::end() const
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::const_iterator
+ basic_ptree<D, K, C, A, P, X>::end() const
{
return m_container.end();
}
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::reverse_iterator
- basic_ptree<C, K, P, D, X>::rbegin()
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::reverse_iterator
+ basic_ptree<D, K, C, A, P, X>::rbegin()
{
return m_container.rbegin();
}
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::const_reverse_iterator
- basic_ptree<C, K, P, D, X>::rbegin() const
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::const_reverse_iterator
+ basic_ptree<D, K, C, A, P, X>::rbegin() const
{
return m_container.rbegin();
}
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::reverse_iterator
- basic_ptree<C, K, P, D, X>::rend()
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::reverse_iterator
+ basic_ptree<D, K, C, A, P, X>::rend()
{
return m_container.rend();
}
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::const_reverse_iterator
- basic_ptree<C, K, P, D, X>::rend() const
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::const_reverse_iterator
+ basic_ptree<D, K, C, A, P, X>::rend() const
{
return m_container.rend();
}
@@ -134,64 +134,64 @@
///////////////////////////////////////////////////////////////////////////
// Data access
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::size_type
- basic_ptree<C, K, P, D, X>::size() const
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::size_type
+ basic_ptree<D, K, C, A, P, X>::size() const
{
return m_container.size();
}
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::size_type
- basic_ptree<C, K, P, D, X>::max_size() const
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::size_type
+ basic_ptree<D, K, C, A, P, X>::max_size() const
{
return m_container.max_size();
}
- template<class C, class K, class P, class D, class X>
- bool basic_ptree<C, K, P, D, X>::empty() const
+ template<class D, class K, class C, class A, class P, class X>
+ bool basic_ptree<D, K, C, A, P, X>::empty() const
{
return m_container.empty();
}
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::data_type &
- basic_ptree<C, K, P, D, X>::data()
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::data_type &
+ basic_ptree<D, K, C, A, P, X>::data()
{
return m_data;
}
- template<class C, class K, class P, class D, class X>
- const typename basic_ptree<C, K, P, D, X>::data_type &
- basic_ptree<C, K, P, D, X>::data() const
+ template<class D, class K, class C, class A, class P, class X>
+ const typename basic_ptree<D, K, C, A, P, X>::data_type &
+ basic_ptree<D, K, C, A, P, X>::data() const
{
return m_data;
}
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::value_type &
- basic_ptree<C, K, P, D, X>::front()
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::value_type &
+ basic_ptree<D, K, C, A, P, X>::front()
{
return m_container.front();
}
- template<class C, class K, class P, class D, class X>
- const typename basic_ptree<C, K, P, D, X>::value_type &
- basic_ptree<C, K, P, D, X>::front() const
+ template<class D, class K, class C, class A, class P, class X>
+ const typename basic_ptree<D, K, C, A, P, X>::value_type &
+ basic_ptree<D, K, C, A, P, X>::front() const
{
return m_container.front();
}
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::value_type &
- basic_ptree<C, K, P, D, X>::back()
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::value_type &
+ basic_ptree<D, K, C, A, P, X>::back()
{
return m_container.back();
}
- template<class C, class K, class P, class D, class X>
- const typename basic_ptree<C, K, P, D, X>::value_type &
- basic_ptree<C, K, P, D, X>::back() const
+ template<class D, class K, class C, class A, class P, class X>
+ const typename basic_ptree<D, K, C, A, P, X>::value_type &
+ basic_ptree<D, K, C, A, P, X>::back() const
{
return m_container.back();
}
@@ -199,9 +199,9 @@
///////////////////////////////////////////////////////////////////////////
// Operators
- template<class C, class K, class P, class D, class X>
- basic_ptree<C, K, P, D, X> &
- basic_ptree<C, K, P, D, X>::operator =(const basic_ptree<C, K, P, D, X> &rhs)
+ template<class D, class K, class C, class A, class P, class X>
+ basic_ptree<D, K, C, A, P, X> &
+ basic_ptree<D, K, C, A, P, X>::operator =(const basic_ptree<D, K, C, A, P, X> &rhs)
{
if (&rhs != this)
{
@@ -212,8 +212,8 @@
return *this;
}
- template<class C, class K, class P, class D, class X>
- bool basic_ptree<C, K, P, D, X>::operator ==(const basic_ptree<C, K, P, D, X> &rhs) const
+ template<class D, class K, class C, class A, class P, class X>
+ bool basic_ptree<D, K, C, A, P, X>::operator ==(const basic_ptree<D, K, C, A, P, X> &rhs) const
{
// Data and sizes must be equal
@@ -238,8 +238,8 @@
}
- template<class C, class K, class P, class D, class X>
- bool basic_ptree<C, K, P, D, X>::operator !=(const basic_ptree<C, K, P, D, X> &rhs) const
+ template<class D, class K, class C, class A, class P, class X>
+ bool basic_ptree<D, K, C, A, P, X>::operator !=(const basic_ptree<D, K, C, A, P, X> &rhs) const
{
return !operator ==(rhs);
}
@@ -247,9 +247,9 @@
///////////////////////////////////////////////////////////////////////////
// Container operations
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::iterator
- basic_ptree<C, K, P, D, X>::find(const key_type &key)
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::iterator
+ basic_ptree<D, K, C, A, P, X>::find(const key_type &key)
{
C comp;
for (iterator it = begin(); it != end(); ++it)
@@ -258,9 +258,9 @@
return end();
}
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::const_iterator
- basic_ptree<C, K, P, D, X>::find(const key_type &key) const
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::const_iterator
+ basic_ptree<D, K, C, A, P, X>::find(const key_type &key) const
{
C comp;
for (const_iterator it = begin(); it != end(); ++it)
@@ -269,9 +269,9 @@
return end();
}
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::size_type
- basic_ptree<C, K, P, D, X>::count(const key_type &key) const
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::size_type
+ basic_ptree<D, K, C, A, P, X>::count(const key_type &key) const
{
C comp;
size_type count = 0;
@@ -281,39 +281,39 @@
return count;
}
- template<class C, class K, class P, class D, class X>
- void basic_ptree<C, K, P, D, X>::clear()
+ template<class D, class K, class C, class A, class P, class X>
+ void basic_ptree<D, K, C, A, P, X>::clear()
{
m_data = data_type();
m_container.clear();
}
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::iterator
- basic_ptree<C, K, P, D, X>::insert(iterator where,
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::iterator
+ basic_ptree<D, K, C, A, P, X>::insert(iterator where,
const value_type &value)
{
return m_container.insert(where, value);
}
- template<class C, class K, class P, class D, class X>
+ template<class D, class K, class C, class A, class P, class X>
template<class It>
- void basic_ptree<C, K, P, D, X>::insert(iterator where, It first, It last)
+ void basic_ptree<D, K, C, A, P, X>::insert(iterator where, It first, It last)
{
for (; first != last; ++first, ++where)
where = insert(where, value_type(first->first, first->second));
}
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::iterator
- basic_ptree<C, K, P, D, X>::erase(iterator where)
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::iterator
+ basic_ptree<D, K, C, A, P, X>::erase(iterator where)
{
return m_container.erase(where);
}
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::size_type
- basic_ptree<C, K, P, D, X>::erase(const key_type &key)
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::size_type
+ basic_ptree<D, K, C, A, P, X>::erase(const key_type &key)
{
C comp;
size_type count = 0;
@@ -331,60 +331,60 @@
return count;
}
- template<class C, class K, class P, class D, class X>
+ template<class D, class K, class C, class A, class P, class X>
template<class It>
- typename basic_ptree<C, K, P, D, X>::iterator
- basic_ptree<C, K, P, D, X>::erase(It first, It last)
+ typename basic_ptree<D, K, C, A, P, X>::iterator
+ basic_ptree<D, K, C, A, P, X>::erase(It first, It last)
{
while (first != last)
first = erase(first);
return first;
}
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::iterator
- basic_ptree<C, K, P, D, X>::push_front(const value_type &value)
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::iterator
+ basic_ptree<D, K, C, A, P, X>::push_front(const value_type &value)
{
return insert(begin(), value);
}
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::iterator
- basic_ptree<C, K, P, D, X>::push_back(const value_type &value)
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::iterator
+ basic_ptree<D, K, C, A, P, X>::push_back(const value_type &value)
{
return insert(end(), value);
}
- template<class C, class K, class P, class D, class X>
- void basic_ptree<C, K, P, D, X>::pop_front()
+ template<class D, class K, class C, class A, class P, class X>
+ void basic_ptree<D, K, C, A, P, X>::pop_front()
{
erase(begin());
}
- template<class C, class K, class P, class D, class X>
- void basic_ptree<C, K, P, D, X>::pop_back()
+ template<class D, class K, class C, class A, class P, class X>
+ void basic_ptree<D, K, C, A, P, X>::pop_back()
{
iterator last = end();
--last;
erase(last);
}
-
- template<class C, class K, class P, class D, class X>
- void basic_ptree<C, K, P, D, X>::swap(basic_ptree<C, K, P, D, X> &rhs)
+
+ template<class D, class K, class C, class A, class P, class X>
+ void basic_ptree<D, K, C, A, P, X>::swap(basic_ptree<D, K, C, A, P, X> &rhs)
{
m_data.swap(rhs.m_data);
m_container.swap(rhs.m_container);
}
- template<class C, class K, class P, class D, class X>
- void basic_ptree<C, K, P, D, X>::reverse()
+ template<class D, class K, class C, class A, class P, class X>
+ void basic_ptree<D, K, C, A, P, X>::reverse()
{
m_container.reverse();
}
- template<class C, class K, class P, class D, class X>
+ template<class D, class K, class C, class A, class P, class X>
template<class SortTr>
- void basic_ptree<C, K, P, D, X>::sort(SortTr tr)
+ void basic_ptree<D, K, C, A, P, X>::sort(SortTr tr)
{
m_container.sort(tr);
}
@@ -393,9 +393,9 @@
// ptree operations
// Get child ptree
- template<class C, class K, class P, class D, class X>
- basic_ptree<C, K, P, D, X> &
- basic_ptree<C, K, P, D, X>::get_child(const path_type &path)
+ template<class D, class K, class C, class A, class P, class X>
+ basic_ptree<D, K, C, A, P, X> &
+ basic_ptree<D, K, C, A, P, X>::get_child(const path_type &path)
{
self_type *child = path.get_child(*this);
if (child)
@@ -405,19 +405,19 @@
}
// Get child ptree
- template<class C, class K, class P, class D, class X>
- const basic_ptree<C, K, P, D, X> &
- basic_ptree<C, K, P, D, X>::get_child(const path_type &path) const
+ template<class D, class K, class C, class A, class P, class X>
+ const basic_ptree<D, K, C, A, P, X> &
+ basic_ptree<D, K, C, A, P, X>::get_child(const path_type &path) const
{
self_type *nc_this = const_cast<self_type *>(this);
return nc_this->get_child(path);
}
// Get child ptree
- template<class C, class K, class P, class D, class X>
- basic_ptree<C, K, P, D, X> &
- basic_ptree<C, K, P, D, X>::get_child(const path_type &path,
- basic_ptree<C, K, P, D, X> &default_value)
+ template<class D, class K, class C, class A, class P, class X>
+ basic_ptree<D, K, C, A, P, X> &
+ basic_ptree<D, K, C, A, P, X>::get_child(const path_type &path,
+ basic_ptree<D, K, C, A, P, X> &default_value)
{
self_type *child = path.get_child(*this);
if (child)
@@ -427,10 +427,10 @@
}
// Get child ptree
- template<class C, class K, class P, class D, class X>
- const basic_ptree<C, K, P, D, X> &
- basic_ptree<C, K, P, D, X>::get_child(const path_type &path,
- const basic_ptree<C, K, P, D, X> &default_value) const
+ template<class D, class K, class C, class A, class P, class X>
+ const basic_ptree<D, K, C, A, P, X> &
+ basic_ptree<D, K, C, A, P, X>::get_child(const path_type &path,
+ const basic_ptree<D, K, C, A, P, X> &default_value) const
{
self_type *nc_this = const_cast<self_type *>(this);
self_type &nc_default_value = const_cast<self_type &>(default_value);
@@ -439,9 +439,9 @@
// Get child ptree
- template<class C, class K, class P, class D, class X>
- optional<basic_ptree<C, K, P, D, X> &>
- basic_ptree<C, K, P, D, X>::get_child_optional(const path_type &path)
+ template<class D, class K, class C, class A, class P, class X>
+ optional<basic_ptree<D, K, C, A, P, X> &>
+ basic_ptree<D, K, C, A, P, X>::get_child_optional(const path_type &path)
{
self_type *child = path.get_child(*this);
if (child)
@@ -451,9 +451,9 @@
}
// Get child ptree
- template<class C, class K, class P, class D, class X>
- optional<const basic_ptree<C, K, P, D, X> &>
- basic_ptree<C, K, P, D, X>::get_child_optional(const path_type &path) const
+ template<class D, class K, class C, class A, class P, class X>
+ optional<const basic_ptree<D, K, C, A, P, X> &>
+ basic_ptree<D, K, C, A, P, X>::get_child_optional(const path_type &path) const
{
self_type *nc_this = const_cast<self_type *>(this);
optional<self_type &> tmp = nc_this->get_child_optional(path);
@@ -464,10 +464,10 @@
}
// Put child ptree
- template<class C, class K, class P, class D, class X>
- basic_ptree<C, K, P, D, X> &
- basic_ptree<C, K, P, D, X>::put_child(const path_type &path,
- const basic_ptree<C, K, P, D, X> &value,
+ template<class D, class K, class C, class A, class P, class X>
+ basic_ptree<D, K, C, A, P, X> &
+ basic_ptree<D, K, C, A, P, X>::put_child(const path_type &path,
+ const basic_ptree<D, K, C, A, P, X> &value,
bool do_not_replace)
{
self_type *child = path.put_child(*this, value, do_not_replace);
@@ -478,9 +478,9 @@
}
// Get value from data of ptree
- template<class C, class K, class P, class D, class X>
+ template<class D, class K, class C, class A, class P, class X>
template<class Type>
- Type basic_ptree<C, K, P, D, X>::get_value(const translator_type &x) const
+ Type basic_ptree<D, K, C, A, P, X>::get_value(const translator_type &x) const
{
BOOST_STATIC_ASSERT(boost::is_pointer<Type>::value == false); // Disallow pointer types, they are unsafe
Type value;
@@ -492,9 +492,9 @@
}
// Get value from data of ptree
- template<class C, class K, class P, class D, class X>
+ template<class D, class K, class C, class A, class P, class X>
template<class Type>
- Type basic_ptree<C, K, P, D, X>::get_value(const Type &default_value,
+ Type basic_ptree<D, K, C, A, P, X>::get_value(const Type &default_value,
const translator_type &x) const
{
BOOST_STATIC_ASSERT(boost::is_pointer<Type>::value == false); // Disallow pointer types, they are unsafe
@@ -506,20 +506,20 @@
}
// Get value from data of ptree
- template<class C, class K, class P, class D, class X>
+ template<class D, class K, class C, class A, class P, class X>
template<class CharType>
std::basic_string<CharType>
- basic_ptree<C, K, P, D, X>::get_value(const CharType *default_value,
+ basic_ptree<D, K, C, A, P, X>::get_value(const CharType *default_value,
const translator_type &x) const
{
return get_value(std::basic_string<CharType>(default_value), x);
}
// Get value from data of ptree
- template<class C, class K, class P, class D, class X>
+ template<class D, class K, class C, class A, class P, class X>
template<class Type>
optional<Type>
- basic_ptree<C, K, P, D, X>::get_value_optional(const translator_type &x) const
+ basic_ptree<D, K, C, A, P, X>::get_value_optional(const translator_type &x) const
{
BOOST_STATIC_ASSERT(boost::is_pointer<Type>::value == false); // Disallow pointer types, they are unsafe
Type value;
@@ -530,18 +530,18 @@
}
// Get value from data of child ptree
- template<class C, class K, class P, class D, class X>
+ template<class D, class K, class C, class A, class P, class X>
template<class Type>
- Type basic_ptree<C, K, P, D, X>::get(const path_type &path,
+ Type basic_ptree<D, K, C, A, P, X>::get(const path_type &path,
const translator_type &x) const
{
return get_child(path).get_value<Type>(x);
}
// Get value from data of child ptree
- template<class C, class K, class P, class D, class X>
+ template<class D, class K, class C, class A, class P, class X>
template<class Type>
- Type basic_ptree<C, K, P, D, X>::get(const path_type &path,
+ Type basic_ptree<D, K, C, A, P, X>::get(const path_type &path,
const Type &default_value,
const translator_type &x) const
{
@@ -552,10 +552,10 @@
}
// Get value from data of child ptree
- template<class C, class K, class P, class D, class X>
+ template<class D, class K, class C, class A, class P, class X>
template<class CharType>
std::basic_string<CharType>
- basic_ptree<C, K, P, D, X>::get(const path_type &path,
+ basic_ptree<D, K, C, A, P, X>::get(const path_type &path,
const CharType *default_value,
const translator_type &x) const
{
@@ -563,22 +563,22 @@
}
// Get value from data of child ptree
- template<class C, class K, class P, class D, class X>
+ template<class D, class K, class C, class A, class P, class X>
template<class Type>
optional<Type>
- basic_ptree<C, K, P, D, X>::get_optional(const path_type &path,
+ basic_ptree<D, K, C, A, P, X>::get_optional(const path_type &path,
const translator_type &x) const
{
- if (optional<const basic_ptree<C, K, P, D, X> &> child = get_child_optional(path))
+ if (optional<const basic_ptree<D, K, C, A, P, X> &> child = get_child_optional(path))
return child.get().get_value_optional<Type>(x);
else
return optional<Type>();
}
// Put value in data of ptree
- template<class C, class K, class P, class D, class X>
+ template<class D, class K, class C, class A, class P, class X>
template<class Type>
- void basic_ptree<C, K, P, D, X>::put_value(const Type &value, const translator_type &x)
+ void basic_ptree<D, K, C, A, P, X>::put_value(const Type &value, const translator_type &x)
{
if (!x.put_value(*this, value))
BOOST_PROPERTY_TREE_THROW(ptree_bad_data(std::string("conversion of type \"") + typeid(Type).name() +
@@ -586,10 +586,10 @@
}
// Put value in data of child ptree
- template<class C, class K, class P, class D, class X>
+ template<class D, class K, class C, class A, class P, class X>
template<class Type>
- basic_ptree<C, K, P, D, X> &
- basic_ptree<C, K, P, D, X>::put(const path_type &path,
+ basic_ptree<D, K, C, A, P, X> &
+ basic_ptree<D, K, C, A, P, X>::put(const path_type &path,
const Type &value,
bool do_not_replace,
const translator_type &x)
@@ -613,21 +613,21 @@
#ifdef BOOST_PROPERTY_TREE_DEBUG
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::size_type
- basic_ptree<C, K, P, D, X>::debug_get_instances_count()
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::size_type
+ basic_ptree<D, K, C, A, P, X>::debug_get_instances_count()
{
- empty_ptree<basic_ptree<C, K, P, D, X> >(); // Make sure empty ptree exists
+ empty_ptree<basic_ptree<D, K, C, A, P, X> >(); // Make sure empty ptree exists
return debug_instances_count - 1; // Do not count empty ptree
}
- template<class C, class K, class P, class D, class X>
- typename basic_ptree<C, K, P, D, X>::size_type
- basic_ptree<C, K, P, D, X>::debug_instances_count;
+ template<class D, class K, class C, class A, class P, class X>
+ typename basic_ptree<D, K, C, A, P, X>::size_type
+ basic_ptree<D, K, C, A, P, X>::debug_instances_count;
- template<class C, class K, class P, class D, class X>
+ template<class D, class K, class C, class A, class P, class X>
boost::detail::lightweight_mutex
- basic_ptree<C, K, P, D, X>::debug_mutex;
+ basic_ptree<D, K, C, A, P, X>::debug_mutex;
#endif
@@ -641,8 +641,8 @@
return pt;
}
- template<class C, class K, class P, class D, class X>
- inline void swap(basic_ptree<C, K, P, D, X> &pt1, basic_ptree<C, K, P, D, X> &pt2)
+ template<class D, class K, class C, class A, class P, class X>
+ inline void swap(basic_ptree<D, K, C, A, P, X> &pt1, basic_ptree<D, K, C, A, P, X> &pt2)
{
pt1.swap(pt2);
}
Modified: branches/sredl_2009_05_proptree_update/boost/property_tree/detail/ptree_utils.hpp
==============================================================================
--- branches/sredl_2009_05_proptree_update/boost/property_tree/detail/ptree_utils.hpp (original)
+++ branches/sredl_2009_05_proptree_update/boost/property_tree/detail/ptree_utils.hpp 2009-05-15 13:57:20 EDT (Fri, 15 May 2009)
@@ -29,7 +29,8 @@
}
inline bool operator()(const T &t1, const T &t2) const
{
- return std::lexicographical_compare(t1.begin(), t1.end(), t2.begin(), t2.end(), *this);
+ return std::lexicographical_compare(t1.begin(), t1.end(),
+ t2.begin(), t2.end(), *this);
}
};
@@ -51,7 +52,6 @@
template<class Ch>
std::string narrow(const Ch *text)
{
- std::locale loc;
std::string result;
while (*text)
{
@@ -66,17 +66,17 @@
// Remove trailing and leading spaces
template<class Ch>
- std::basic_string<Ch> trim(const std::basic_string<Ch> &s,
+ std::basic_string<Ch> trim(const std::basic_string<Ch> &s,
const std::locale &loc = std::locale())
{
typename std::basic_string<Ch>::const_iterator first = s.begin();
typename std::basic_string<Ch>::const_iterator end = s.end();
- while (first != end && std::isspace(*first, loc))
+ while (first != end && std::isspace(*first, loc))
++first;
if (first == end)
return std::basic_string<Ch>();
typename std::basic_string<Ch>::const_iterator last = end;
- do --last; while (std::isspace(*last, loc));
+ do --last; while (std::isspace(*last, loc));
if (first != s.begin() || last + 1 != end)
return std::basic_string<Ch>(first, last + 1);
else
Modified: branches/sredl_2009_05_proptree_update/boost/property_tree/detail/xml_parser_error.hpp
==============================================================================
--- branches/sredl_2009_05_proptree_update/boost/property_tree/detail/xml_parser_error.hpp (original)
+++ branches/sredl_2009_05_proptree_update/boost/property_tree/detail/xml_parser_error.hpp 2009-05-15 13:57:20 EDT (Fri, 15 May 2009)
@@ -24,7 +24,7 @@
const std::string &filename,
unsigned long line):
file_parser_error(message, filename, line)
- {
+ {
}
};
Modified: branches/sredl_2009_05_proptree_update/boost/property_tree/detail/xml_parser_read_spirit.hpp
==============================================================================
--- branches/sredl_2009_05_proptree_update/boost/property_tree/detail/xml_parser_read_spirit.hpp (original)
+++ branches/sredl_2009_05_proptree_update/boost/property_tree/detail/xml_parser_read_spirit.hpp 2009-05-15 13:57:20 EDT (Fri, 15 May 2009)
@@ -19,8 +19,8 @@
#include <boost/property_tree/detail/xml_parser_error.hpp>
#include <boost/property_tree/detail/xml_parser_flags.hpp>
#include <boost/property_tree/detail/xml_parser_utils.hpp>
-#include <boost/spirit.hpp>
-#include <boost/spirit/iterator/position_iterator.hpp>
+#include <boost/spirit/include/classic_spirit.hpp>
+#include <boost/spirit/include/classic_position_iterator.hpp>
#include <string>
#include <locale>
#include <istream>
Modified: branches/sredl_2009_05_proptree_update/boost/property_tree/info_parser.hpp
==============================================================================
--- branches/sredl_2009_05_proptree_update/boost/property_tree/info_parser.hpp (original)
+++ branches/sredl_2009_05_proptree_update/boost/property_tree/info_parser.hpp 2009-05-15 13:57:20 EDT (Fri, 15 May 2009)
@@ -22,8 +22,10 @@
/**
* Read INFO from a the given stream and translate it to a property tree.
- * @note Clears existing contents of property tree. In case of error the property tree unmodified.
- * @throw info_parser_error On error translating the INFO stream to a property tree.
+ * @note Clears existing contents of property tree. In case of error the
+ * property tree is not modified.
+ * @throw info_parser_error On error translating the INFO stream to a
+ * property tree.
* @param stream Stream from which to read in the property tree.
* @param[out] pt The property tree to populate.
*/
@@ -38,10 +40,12 @@
/**
* Read INFO from a the given stream and translate it to a property tree.
- * @note Clears existing contents of property tree. In case of error the property tree unmodified.
+ * @note Clears existing contents of property tree. In case of error the
+ * property tree unmodified.
* @param stream Stream from which to read in the property tree.
* @param[out] pt The property tree to populate.
- * @param default_ptree The property tree to which to set @c pt on error reading the INFO stream.
+ * @param default_ptree The property tree to which to set @c pt on error
+ * reading the INFO stream.
*/
template<class Ptree, class Ch>
void read_info(std::basic_istream<Ch> &stream,
@@ -60,8 +64,10 @@
/**
* Read INFO from a the given file and translate it to a property tree.
- * @note Clears existing contents of property tree. In case of error the property tree unmodified.
- * @throw info_parser_error On error translating the INFO stream to a property tree.
+ * @note Clears existing contents of property tree. In case of error the
+ * property tree is not modified.
+ * @throw info_parser_error On error translating the INFO stream to a
+ * property tree.
* @param filename Name of file from which to read in the property tree.
* @param[out] pt The property tree to populate.
* @param loc The locale to use when reading in the file contents.
@@ -71,9 +77,11 @@
Ptree &pt,
const std::locale &loc = std::locale())
{
- std::basic_ifstream<typename Ptree::key_type::value_type> stream(filename.c_str());
+ std::basic_ifstream<typename Ptree::key_type::value_type>
+ stream(filename.c_str());
if (!stream)
- BOOST_PROPERTY_TREE_THROW(info_parser_error("cannot open file for reading", filename, 0));
+ BOOST_PROPERTY_TREE_THROW(info_parser_error(
+ "cannot open file for reading", filename, 0));
stream.imbue(loc);
Ptree local;
read_info_internal(stream, local, filename, 0);
@@ -82,14 +90,16 @@
/**
* Read INFO from a the given file and translate it to a property tree.
- * @note Clears existing contents of property tree. In case of error the property tree unmodified.
+ * @note Clears existing contents of property tree. In case of error the
+ * property tree is not modified.
* @param filename Name of file from which to read in the property tree.
* @param[out] pt The property tree to populate.
* @param loc The locale to use when reading in the file contents.
- * @param default_ptree The property tree to which to set @c pt on error reading the INFO stream.
+ * @param default_ptree The property tree to which to set @c pt on error
+ * reading the INFO stream.
*/
template<class Ptree>
- void read_info(const std::string &filename,
+ void read_info(const std::string &filename,
Ptree &pt,
const Ptree &default_ptree,
const std::locale &loc = std::locale())
@@ -105,28 +115,30 @@
}
/**
- * Translates the property tree to INFO and writes it the given output stream.
- * @throw info_parser_error In case of error translating the property tree to INFO
- * or writing to the output stream.
+ * Translates the property tree to INFO and writes it the given output
+ * stream.
+ * @throw info_parser_error In case of error translating the property tree
+ * to INFO or writing to the output stream.
* @param stream The stream to which to write the INFO representation of the
* property tree.
* @param pt The property tree to tranlsate to INFO and output.
* @param settings The settings to use when writing the INFO data.
*/
template<class Ptree, class Ch>
- void write_info(std::basic_ostream<Ch> &stream,
+ void write_info(std::basic_ostream<Ch> &stream,
const Ptree &pt,
- const info_writer_settings<Ch> &settings=info_writer_settings<Ch>())
+ const info_writer_settings<Ch> &settings =
+ info_writer_settings<Ch>())
{
write_info_internal(stream, pt, std::string(), settings);
}
/**
* Translates the property tree to INFO and writes it the given file.
- * @throw info_parser_error In case of error translating the property tree to INFO
- * or writing to the file.
- * @param filename The name of the file to which to write the INFO representation
- * of the property tree.
+ * @throw info_parser_error In case of error translating the property tree
+ * to INFO or writing to the file.
+ * @param filename The name of the file to which to write the INFO
+ * representation of the property tree.
* @param pt The property tree to tranlsate to INFO and output.
* @param settings The settings to use when writing the INFO data.
* @param loc The locale to use when writing the file.
@@ -135,11 +147,17 @@
void write_info(const std::string &filename,
const Ptree &pt,
const std::locale &loc = std::locale(),
- const info_writer_settings<typename Ptree::key_type::value_type> &settings = info_writer_make_settings<typename Ptree::key_type::value_type>())
+ const info_writer_settings<
+ typename Ptree::key_type::value_type
+ > &settings =
+ info_writer_make_settings<
+ typename Ptree::key_type::value_type>())
{
- std::basic_ofstream<typename Ptree::key_type::value_type> stream(filename.c_str());
+ std::basic_ofstream<typename Ptree::key_type::value_type>
+ stream(filename.c_str());
if (!stream)
- BOOST_PROPERTY_TREE_THROW(info_parser_error("cannot open file for writing", filename, 0));
+ BOOST_PROPERTY_TREE_THROW(info_parser_error(
+ "cannot open file for writing", filename, 0));
stream.imbue(loc);
write_info_internal(stream, pt, filename, settings);
}
Modified: branches/sredl_2009_05_proptree_update/boost/property_tree/ini_parser.hpp
==============================================================================
--- branches/sredl_2009_05_proptree_update/boost/property_tree/ini_parser.hpp (original)
+++ branches/sredl_2009_05_proptree_update/boost/property_tree/ini_parser.hpp 2009-05-15 13:57:20 EDT (Fri, 15 May 2009)
@@ -42,20 +42,22 @@
/**
* Construct an @c ini_parser_error
* @param message Message describing the parser error.
- * @param filename The name of the file being parsed containing the error.
- * @param line The line in the given file where an error was encountered.
+ * @param filename The name of the file being parsed containing the
+ * error.
+ * @param line The line in the given file where an error was
+ * encountered.
*/
- ini_parser_error(const std::string &message,
- const std::string &filename,
- unsigned long line):
- file_parser_error(message, filename, line)
- {
+ ini_parser_error(const std::string &message,
+ const std::string &filename,
+ unsigned long line)
+ : file_parser_error(message, filename, line)
+ {
}
};
/**
* Read INI from a the given stream and translate it to a property tree.
- * @note Clears existing contents of property tree. In case of error
+ * @note Clears existing contents of property tree. In case of error
* the property tree is not modified.
* @throw ini_parser_error If a format violation is found.
* @param stream Stream from which to read in the property tree.
@@ -85,7 +87,8 @@
++line_no;
std::getline(stream, line);
if (!stream.good() && !stream.eof())
- BOOST_PROPERTY_TREE_THROW(ini_parser_error("read error", "", line_no));
+ BOOST_PROPERTY_TREE_THROW(ini_parser_error(
+ "read error", "", line_no));
// If line is non-empty
line = detail::trim(line, stream.getloc());
@@ -100,24 +103,33 @@
{
typename Str::size_type end = line.find(rbracket);
if (end == Str::npos)
- BOOST_PROPERTY_TREE_THROW(ini_parser_error("unmatched '['", "", line_no));
- Str key = detail::trim(line.substr(1, end - 1), stream.getloc());
+ BOOST_PROPERTY_TREE_THROW(ini_parser_error(
+ "unmatched '['", "", line_no));
+ Str key = detail::trim(line.substr(1, end - 1),
+ stream.getloc());
if (local.find(key) != local.end())
- BOOST_PROPERTY_TREE_THROW(ini_parser_error("duplicate section name", "", line_no));
- section = &local.push_back(std::make_pair(key, Ptree()))->second;
+ BOOST_PROPERTY_TREE_THROW(ini_parser_error(
+ "duplicate section name", "", line_no));
+ section = &local.push_back(
+ std::make_pair(key, Ptree()))->second;
}
else
{
Ptree &container = section ? *section : local;
typename Str::size_type eqpos = line.find(Ch('='));
if (eqpos == Str::npos)
- BOOST_PROPERTY_TREE_THROW(ini_parser_error("'=' character not found in line", "", line_no));
+ BOOST_PROPERTY_TREE_THROW(ini_parser_error(
+ "'=' character not found in line", "", line_no));
if (eqpos == 0)
- BOOST_PROPERTY_TREE_THROW(ini_parser_error("key expected", "", line_no));
- Str key = detail::trim(line.substr(0, eqpos), stream.getloc());
- Str data = detail::trim(line.substr(eqpos + 1, Str::npos), stream.getloc());
+ BOOST_PROPERTY_TREE_THROW(ini_parser_error(
+ "key expected", "", line_no));
+ Str key = detail::trim(line.substr(0, eqpos),
+ stream.getloc());
+ Str data = detail::trim(line.substr(eqpos + 1, Str::npos),
+ stream.getloc());
if (container->find(key) != container->end())
- BOOST_PROPERTY_TREE_THROW(ini_parser_error("duplicate key name", "", line_no));
+ BOOST_PROPERTY_TREE_THROW(ini_parser_error(
+ "duplicate key name", "", line_no));
container->push_back(std::make_pair(key, Ptree(data)));
}
}
@@ -130,7 +142,8 @@
/**
* Read INI from a the given file and translate it to a property tree.
- * @note Clears existing contents of property tree. In case of error the property tree unmodified.
+ * @note Clears existing contents of property tree. In case of error the
+ * property tree unmodified.
* @throw ini_parser_error In case of error deserializing the property tree.
* @param filename Name of file from which to read in the property tree.
* @param[out] pt The property tree to populate.
@@ -141,35 +154,42 @@
Ptree &pt,
const std::locale &loc = std::locale())
{
- std::basic_ifstream<typename Ptree::key_type::value_type> stream(filename.c_str());
+ std::basic_ifstream<typename Ptree::key_type::value_type>
+ stream(filename.c_str());
if (!stream)
- BOOST_PROPERTY_TREE_THROW(ini_parser_error("cannot open file", filename, 0));
+ BOOST_PROPERTY_TREE_THROW(ini_parser_error(
+ "cannot open file", filename, 0));
stream.imbue(loc);
try {
read_ini(stream, pt);
}
catch (ini_parser_error &e) {
- BOOST_PROPERTY_TREE_THROW(ini_parser_error(e.message(), filename, e.line()));
+ BOOST_PROPERTY_TREE_THROW(ini_parser_error(
+ e.message(), filename, e.line()));
}
}
/**
- * Translates the property tree to INI and writes it the given output stream.
+ * Translates the property tree to INI and writes it the given output
+ * stream.
* @pre @e pt cannot have keys with data at its root level.
* @pre @e pt cannot be deaper than two levels.
* @pre There cannot be duplicate keys on any given level of @e pt.
- * @throw ini_parser_error In case of error translating the property tree to INI
- * or writing to the output stream.
+ * @throw ini_parser_error In case of error translating the property tree to
+ * INI or writing to the output stream.
* @param stream The stream to which to write the INI representation of the
* property tree.
* @param pt The property tree to tranlsate to INI and output.
* @param flags The flags to use when writing the INI file.
* The following flags are supported:
- * @li @c skip_ini_validity_check -- Skip check if ptree is a valid ini. The
- * validity check covers the preconditions but takes <tt>O(n log n)</tt> time.
+ * @li @c skip_ini_validity_check -- Skip check if ptree is a valid ini. The
+ * validity check covers the preconditions but takes <tt>O(n log n)</tt>
+ * time.
*/
template<class Ptree>
- void write_ini(std::basic_ostream<typename Ptree::key_type::value_type> &stream,
+ void write_ini(std::basic_ostream<
+ typename Ptree::key_type::value_type
+ > &stream,
const Ptree &pt,
int flags = 0)
{
@@ -178,30 +198,41 @@
typedef std::basic_string<Ch> Str;
BOOST_ASSERT(validate_flags(flags));
-
+
// Verify if ptree is not too rich to be saved as ini
- if (!(flags & skip_ini_validity_check))
- for (typename Ptree::const_iterator it = pt.begin(), end = pt.end(); it != end; ++it)
+ if (!(flags & skip_ini_validity_check)) {
+ for (typename Ptree::const_iterator it = pt.begin(), end = pt.end();
+ it != end; ++it)
{
if (!it->second.data().empty())
- BOOST_PROPERTY_TREE_THROW(ini_parser_error("ptree has data on root level keys", "", 0));
+ BOOST_PROPERTY_TREE_THROW(ini_parser_error(
+ "ptree has data on root level keys", "", 0));
if (pt.count(it->first) > 1)
- BOOST_PROPERTY_TREE_THROW(ini_parser_error("duplicate section name", "", 0));
- for (typename Ptree::const_iterator it2 = it->second.begin(), end2 = it->second.end(); it2 != end2; ++it2)
+ BOOST_PROPERTY_TREE_THROW(ini_parser_error(
+ "duplicate section name", "", 0));
+ for (typename Ptree::const_iterator it2 = it->second.begin(),
+ end2 = it->second.end(); it2 != end2; ++it2)
{
if (!it2->second.empty())
- BOOST_PROPERTY_TREE_THROW(ini_parser_error("ptree is too deep", "", 0));
+ BOOST_PROPERTY_TREE_THROW(ini_parser_error(
+ "ptree is too deep", "", 0));
if (it->second.count(it2->first) > 1)
- BOOST_PROPERTY_TREE_THROW(ini_parser_error("duplicate key name", "", 0));
+ BOOST_PROPERTY_TREE_THROW(ini_parser_error(
+ "duplicate key name", "", 0));
}
}
+ }
// Write ini
- for (typename Ptree::const_iterator it = pt.begin(), end = pt.end(); it != end; ++it)
+ for (typename Ptree::const_iterator it = pt.begin(), end = pt.end();
+ it != end; ++it)
{
stream << Ch('[') << it->first << Ch(']') << Ch('\n');
- for (typename Ptree::const_iterator it2 = it->second.begin(), end2 = it->second.end(); it2 != end2; ++it2)
- stream << it2->first << Ch('=') << it2->second.template get_value<std::basic_string<Ch> >() << Ch('\n');
+ for (typename Ptree::const_iterator it2 = it->second.begin(),
+ end2 = it->second.end(); it2 != end2; ++it2)
+ stream << it2->first << Ch('=')
+ << it2->second.template get_value<std::basic_string<Ch> >()
+ << Ch('\n');
}
}
@@ -211,15 +242,16 @@
* @pre @e pt cannot have keys with data at its root level.
* @pre @e pt cannot be deaper than two levels.
* @pre There cannot be duplicate keys on any given level of @e pt.
- * @throw info_parser_error In case of error translating the property tree to INI
- * or writing to the file.
- * @param filename The name of the file to which to write the INI representation
- * of the property tree.
+ * @throw info_parser_error In case of error translating the property tree
+ * to INI or writing to the file.
+ * @param filename The name of the file to which to write the INI
+ * representation of the property tree.
* @param pt The property tree to tranlsate to INI and output.
* @param flags The flags to use when writing the INI file.
* The following flags are supported:
- * @li @c skip_ini_validity_check -- Skip check if ptree is a valid ini. The
- * validity check covers the preconditions but takes <tt>O(n log n)</tt> time.
+ * @li @c skip_ini_validity_check -- Skip check if ptree is a valid ini. The
+ * validity check covers the preconditions but takes <tt>O(n log n)</tt>
+ * time.
* @param loc The locale to use when writing the file.
*/
template<class Ptree>
@@ -228,15 +260,18 @@
int flags = 0,
const std::locale &loc = std::locale())
{
- std::basic_ofstream<typename Ptree::key_type::value_type> stream(filename.c_str());
+ std::basic_ofstream<typename Ptree::key_type::value_type>
+ stream(filename.c_str());
if (!stream)
- BOOST_PROPERTY_TREE_THROW(ini_parser_error("cannot open file", filename, 0));
+ BOOST_PROPERTY_TREE_THROW(ini_parser_error(
+ "cannot open file", filename, 0));
stream.imbue(loc);
try {
write_ini(stream, pt, flags);
}
catch (ini_parser_error &e) {
- BOOST_PROPERTY_TREE_THROW(ini_parser_error(e.message(), filename, e.line()));
+ BOOST_PROPERTY_TREE_THROW(ini_parser_error(
+ e.message(), filename, e.line()));
}
}
Modified: branches/sredl_2009_05_proptree_update/boost/property_tree/json_parser.hpp
==============================================================================
--- branches/sredl_2009_05_proptree_update/boost/property_tree/json_parser.hpp (original)
+++ branches/sredl_2009_05_proptree_update/boost/property_tree/json_parser.hpp 2009-05-15 13:57:20 EDT (Fri, 15 May 2009)
@@ -29,14 +29,17 @@
* @note Items of JSON arrays are translated into ptree keys with empty
* names. Members of objects are translated into named keys.
* @note JSON data can be a string, a numeric value, or one of literals
- * "null", "true" and "false". During parse, any of the above is copied
- * verbatim into ptree data string.
- * @throw json_parser_error In case of error deserializing the property tree.
+ * "null", "true" and "false". During parse, any of the above is
+ * copied verbatim into ptree data string.
+ * @throw json_parser_error In case of error deserializing the property
+ * tree.
* @param stream Stream from which to read in the property tree.
* @param[out] pt The property tree to populate.
*/
template<class Ptree>
- void read_json(std::basic_istream<typename Ptree::key_type::value_type> &stream,
+ void read_json(std::basic_istream<
+ typename Ptree::key_type::value_type
+ > &stream,
Ptree &pt)
{
read_json_internal(stream, pt, std::string());
@@ -49,9 +52,10 @@
* @note Items of JSON arrays are translated into ptree keys with empty
* names. Members of objects are translated into named keys.
* @note JSON data can be a string, a numeric value, or one of literals
- * "null", "true" and "false". During parse, any of the above is copied
- * verbatim into ptree data string.
- * @throw json_parser_error In case of error deserializing the property tree.
+ * "null", "true" and "false". During parse, any of the above is
+ * copied verbatim into ptree data string.
+ * @throw json_parser_error In case of error deserializing the property
+ * tree.
* @param filename Name of file from which to read in the property tree.
* @param[out] pt The property tree to populate.
* @param loc The locale to use when reading in the file contents.
@@ -61,26 +65,31 @@
Ptree &pt,
const std::locale &loc = std::locale())
{
- std::basic_ifstream<typename Ptree::key_type::value_type> stream(filename.c_str());
+ std::basic_ifstream<typename Ptree::key_type::value_type>
+ stream(filename.c_str());
if (!stream)
- BOOST_PROPERTY_TREE_THROW(json_parser_error("cannot open file", filename, 0));
+ BOOST_PROPERTY_TREE_THROW(json_parser_error(
+ "cannot open file", filename, 0));
stream.imbue(loc);
read_json_internal(stream, pt, filename);
}
/**
- * Translates the property tree to JSON and writes it the given output stream.
- * @note Any property tree key containing only unnamed subkeys will be rendered
- * as JSON arrays.
+ * Translates the property tree to JSON and writes it the given output
+ * stream.
+ * @note Any property tree key containing only unnamed subkeys will be
+ * rendered as JSON arrays.
* @pre @e pt cannot contain keys that have both subkeys and non-empty data.
- * @throw json_parser_error In case of error translating the property tree to JSON
- * or writing to the output stream.
- * @param stream The stream to which to write the JSON representation of the
+ * @throw json_parser_error In case of error translating the property tree
+ * to JSON or writing to the output stream.
+ * @param stream The stream to which to write the JSON representation of the
* property tree.
* @param pt The property tree to tranlsate to JSON and output.
*/
template<class Ptree>
- void write_json(std::basic_ostream<typename Ptree::key_type::value_type> &stream,
+ void write_json(std::basic_ostream<
+ typename Ptree::key_type::value_type
+ > &stream,
const Ptree &pt)
{
write_json_internal(stream, pt, std::string());
@@ -88,14 +97,14 @@
/**
* Translates the property tree to JSON and writes it the given file.
- * @note Any property tree key containing only unnamed subkeys will be rendered
- * as JSON arrays.
+ * @note Any property tree key containing only unnamed subkeys will be
+ * rendered as JSON arrays.
* @pre @e pt cannot contain keys that have both subkeys and non-empty data.
- * @throw json_parser_error In case of error translating the property tree to JSON
- * or writing to the file.
- * @param filename The name of the file to which to write the JSON representation
- * of the property tree.
- * @param pt The property tree to tranlsate to JSON and output.
+ * @throw json_parser_error In case of error translating the property tree
+ * to JSON or writing to the file.
+ * @param filename The name of the file to which to write the JSON
+ * representation of the property tree.
+ * @param pt The property tree to translate to JSON and output.
* @param loc The locale to use when writing out to the output file.
*/
template<class Ptree>
@@ -103,9 +112,11 @@
const Ptree &pt,
const std::locale &loc = std::locale())
{
- std::basic_ofstream<typename Ptree::key_type::value_type> stream(filename.c_str());
+ std::basic_ofstream<typename Ptree::key_type::value_type>
+ stream(filename.c_str());
if (!stream)
- BOOST_PROPERTY_TREE_THROW(json_parser_error("cannot open file", filename, 0));
+ BOOST_PROPERTY_TREE_THROW(json_parser_error(
+ "cannot open file", filename, 0));
stream.imbue(loc);
write_json_internal(stream, pt, filename);
}
Modified: branches/sredl_2009_05_proptree_update/boost/property_tree/ptree.hpp
==============================================================================
--- branches/sredl_2009_05_proptree_update/boost/property_tree/ptree.hpp (original)
+++ branches/sredl_2009_05_proptree_update/boost/property_tree/ptree.hpp 2009-05-15 13:57:20 EDT (Fri, 15 May 2009)
@@ -8,7 +8,8 @@
// For more information, see www.boost.org
// ----------------------------------------------------------------------------
-/// This header contains definition of basic_ptree class template and supporting definitions.
+/// This header contains definition of basic_ptree class template and
+/// supporting definitions.
#ifndef BOOST_PROPERTY_TREE_PTREE_HPP_INCLUDED
#define BOOST_PROPERTY_TREE_PTREE_HPP_INCLUDED
@@ -27,7 +28,8 @@
#include <boost/throw_exception.hpp>
#ifdef BOOST_PROPERTY_TREE_DEBUG
-# include <boost/detail/lightweight_mutex.hpp> // For syncing debug instances counter
+// For syncing debug instances counter
+# include <boost/detail/lightweight_mutex.hpp>
#endif
#include <functional> // for std::less
Modified: branches/sredl_2009_05_proptree_update/boost/property_tree/ptree_serialization.hpp
==============================================================================
--- branches/sredl_2009_05_proptree_update/boost/property_tree/ptree_serialization.hpp (original)
+++ branches/sredl_2009_05_proptree_update/boost/property_tree/ptree_serialization.hpp 2009-05-15 13:57:20 EDT (Fri, 15 May 2009)
@@ -26,69 +26,78 @@
/**
* Serialize the property tree to the given archive.
- * @note In addition to serializing to regular archives, this supports serializing to
- * archives requiring name-value pairs, e.g. XML archives. However, the output
- * format in the XML archive is not guaranteed to be the same as that when using
- * the Boost.PropertyTree library's @c boost::property_tree::xml_parser::write_xml.
- * @param ar The archive to which to save the serialized property tree. This archive
- * should conform to the concept laid out by the Boost.Serialization library.
+ * @note In addition to serializing to regular archives, this supports
+ * serializing to archives requiring name-value pairs, e.g. XML
+ * archives. However, the output format in the XML archive is not
+ * guaranteed to be the same as that when using the Boost.PropertyTree
+ * library's @c boost::property_tree::xml_parser::write_xml.
+ * @param ar The archive to which to save the serialized property tree.
+ * This archive should conform to the concept laid out by the
+ * Boost.Serialization library.
* @param t The property tree to serialize.
* @param file_version file_version for the archive.
* @post @c ar will contain the serialized form of @c t.
*/
- template<class Archive, class C, class K, class P, class D, class X>
- inline void save(Archive &ar,
- const basic_ptree<C, K, P, D, X> &t,
+ template<class Archive, class D, class K,
+ class C, class A, class P, class X>
+ inline void save(Archive &ar,
+ const basic_ptree<D, K, C, A, P, X> &t,
const unsigned int file_version)
{
- serialization::stl::save_collection<Archive, basic_ptree<C, K, P, D, X> >(ar, t);
- ar << serialization::make_nvp("data", t.data());
+ using namespace boost::serialization;
+ stl::save_collection<Archive, basic_ptree<D, K, C, A, P, X> >(ar, t);
+ ar << make_nvp("data", t.data());
}
/**
* De-serialize the property tree to the given archive.
- * @note In addition to de-serializing from regular archives, this supports loading from
- * archives requiring name-value pairs, e.g. XML archives. The format should be
- * that used by boost::property_tree::save.
- * @param ar The archive from which to load the serialized property tree. This archive
- * should conform to the concept laid out by the Boost.Serialization library.
+ * @note In addition to de-serializing from regular archives, this supports
+ * loading from archives requiring name-value pairs, e.g. XML
+ * archives. The format should be that used by
+ * boost::property_tree::save.
+ * @param ar The archive from which to load the serialized property tree.
+ * This archive should conform to the concept laid out by the
+ * Boost.Serialization library.
* @param t The property tree to de-serialize.
* @param file_version file_version for the archive.
* @post @c t will contain the de-serialized data from @c ar.
*/
- template<class Archive, class C, class K, class P, class D, class X>
- inline void load(Archive &ar,
- basic_ptree<C, K, P, D, X> &t,
+ template<class Archive, class D, class K,
+ class C, class A, class P, class X>
+ inline void load(Archive &ar,
+ basic_ptree<D, K, C, A, P, X> &t,
const unsigned int file_version)
{
-
+ using namespace boost::serialization;
// Load children
- boost::serialization::stl::load_collection
- <
- Archive,
- basic_ptree<C, K, P, D, X>,
- boost::serialization::stl::archive_input_seq<Archive, basic_ptree<C, K, P, D, X> >,
- boost::serialization::stl::no_reserve_imp<basic_ptree<C, K, P, D, X> >
- >(ar, t);
-
+ stl::load_collection<Archive,
+ basic_ptree<D, K, C, A, P, X>,
+ stl::archive_input_seq<Archive,
+ basic_ptree<D, K, C, A, P, X> >,
+ stl::no_reserve_imp<
+ basic_ptree<D, K, C, A, P, X> >
+ >(ar, t);
+
// Load data (must be after load_collection, as it calls clear())
ar >> serialization::make_nvp("data", t.data());
-
}
/**
* Load or store the property tree using the given archive.
- * @param ar The archive from which to load or save the serialized property tree.
- * The type of this archive will determine whether saving or loading is performed.
+ * @param ar The archive from which to load or save the serialized property
+ * tree. The type of this archive will determine whether saving or
+ * loading is performed.
* @param t The property tree to load or save.
* @param file_version file_version for the archive.
*/
- template<class Archive, class C, class K, class P, class D, class X>
+ template<class Archive, class D, class K,
+ class C, class A, class P, class X>
inline void serialize(Archive &ar,
- basic_ptree<C, K, P, D, X> &t,
+ basic_ptree<D, K, C, A, P, X> &t,
const unsigned int file_version)
{
- boost::serialization::split_free(ar, t, file_version);
+ using namespace boost::serialization;
+ split_free(ar, t, file_version);
}
} }
Modified: branches/sredl_2009_05_proptree_update/boost/property_tree/xml_parser.hpp
==============================================================================
--- branches/sredl_2009_05_proptree_update/boost/property_tree/xml_parser.hpp (original)
+++ branches/sredl_2009_05_proptree_update/boost/property_tree/xml_parser.hpp 2009-05-15 13:57:20 EDT (Fri, 15 May 2009)
@@ -38,20 +38,23 @@
/**
* Reads XML from an input stream and translates it to property tree.
- * @note Clears existing contents of property tree. In case of error the property tree unmodified.
+ * @note Clears existing contents of property tree. In case of error the
+ * property tree unmodified.
* @note XML attributes are placed under keys named @c \<xmlattr\>.
* @throw xml_parser_error In case of error deserializing the property tree.
* @param stream Stream from which to read in the property tree.
* @param[out] pt The property tree to populate.
* @param flags Flags controlling the bahviour of the parser.
* The following flags are supported:
- * @li @c no_concat_text -- Prevents concatenation of text nodes into datastring
- * of property tree. Puts them in separate @c \<xmltext\>
- * strings instead.
+ * @li @c no_concat_text -- Prevents concatenation of text nodes into
+ * datastring of property tree. Puts them in
+ * separate @c \<xmltext\> strings instead.
* @li @c no_comments -- Skip XML comments.
*/
template<class Ptree>
- void read_xml(std::basic_istream<typename Ptree::key_type::value_type> &stream,
+ void read_xml(std::basic_istream<
+ typename Ptree::key_type::value_type
+ > &stream,
Ptree &pt,
int flags = 0)
{
@@ -59,17 +62,19 @@
}
/**
- * Reads XML from a file using the given locale and translates it to property tree.
- * @note Clears existing contents of property tree. In case of error the property tree unmodified.
+ * Reads XML from a file using the given locale and translates it to
+ * property tree.
+ * @note Clears existing contents of property tree. In case of error the
+ * property tree unmodified.
* @note XML attributes are placed under keys named @c \<xmlattr\>.
* @throw xml_parser_error In case of error deserializing the property tree.
* @param filename The file from which to read in the property tree.
* @param[out] pt The property tree to populate.
* @param flags Flags controlling the bahviour of the parser.
* The following flags are supported:
- * @li @c no_concat_text -- Prevents concatenation of text nodes into datastring
- * of property tree. Puts them in separate @c \<xmltext\>
- * strings instead.
+ * @li @c no_concat_text -- Prevents concatenation of text nodes into
+ * datastring of property tree. Puts them in
+ * separate @c \<xmltext\> strings instead.
* @li @c no_comments -- Skip XML comments.
* @param loc The locale to use when reading in the file contents.
*/
@@ -80,49 +85,64 @@
const std::locale &loc = std::locale())
{
BOOST_ASSERT(validate_flags(flags));
- std::basic_ifstream<typename Ptree::key_type::value_type> stream(filename.c_str());
+ std::basic_ifstream<typename Ptree::key_type::value_type>
+ stream(filename.c_str());
if (!stream)
- BOOST_PROPERTY_TREE_THROW(xml_parser_error("cannot open file", filename, 0));
+ BOOST_PROPERTY_TREE_THROW(xml_parser_error(
+ "cannot open file", filename, 0));
stream.imbue(loc);
read_xml_internal(stream, pt, flags, filename);
}
/**
- * Translates the property tree to XML and writes it the given output stream.
- * @throw xml_parser_error In case of error translating the property tree to XML
- * or writing to the output stream.
+ * Translates the property tree to XML and writes it the given output
+ * stream.
+ * @throw xml_parser_error In case of error translating the property tree to
+ * XML or writing to the output stream.
* @param stream The stream to which to write the XML representation of the
* property tree.
* @param pt The property tree to tranlsate to XML and output.
- * @param settings The settings to use when writing out the property tree as XML.
+ * @param settings The settings to use when writing out the property tree as
+ * XML.
*/
template<class Ptree>
- void write_xml(std::basic_ostream<typename Ptree::key_type::value_type> &stream,
+ void write_xml(std::basic_ostream<
+ typename Ptree::key_type::value_type
+ > &stream,
const Ptree &pt,
- const xml_writer_settings<typename Ptree::key_type::value_type> & settings = xml_writer_settings<typename Ptree::key_type::value_type>() )
+ const xml_writer_settings<
+ typename Ptree::key_type::value_type
+ > & settings = xml_writer_settings<
+ typename Ptree::key_type::value_type>() )
{
write_xml_internal(stream, pt, std::string(), settings);
}
/**
* Translates the property tree to XML and writes it the given file.
- * @throw xml_parser_error In case of error translating the property tree to XML
- * or writing to the output stream.
+ * @throw xml_parser_error In case of error translating the property tree to
+ * XML or writing to the output stream.
* @param filename The file to which to write the XML representation of the
- * property tree.
+ * property tree.
* @param pt The property tree to tranlsate to XML and output.
* @param loc The locale to use when writing the output to file.
- * @param settings The settings to use when writing out the property tree as XML.
+ * @param settings The settings to use when writing out the property tree as
+ * XML.
*/
template<class Ptree>
void write_xml(const std::string &filename,
const Ptree &pt,
const std::locale &loc = std::locale(),
- const xml_writer_settings<typename Ptree::key_type::value_type> & settings = xml_writer_settings<typename Ptree::key_type::value_type>())
+ const xml_writer_settings<
+ typename Ptree::key_type::value_type
+ > & settings = xml_writer_settings<
+ typename Ptree::key_type::value_type>())
{
- std::basic_ofstream<typename Ptree::key_type::value_type> stream(filename.c_str());
+ std::basic_ofstream<typename Ptree::key_type::value_type>
+ stream(filename.c_str());
if (!stream)
- BOOST_PROPERTY_TREE_THROW(xml_parser_error("cannot open file", filename, 0));
+ BOOST_PROPERTY_TREE_THROW(xml_parser_error(
+ "cannot open file", filename, 0));
stream.imbue(loc);
write_xml_internal(stream, pt, filename, settings);
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk