diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-03-11 20:22:35 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-03-11 22:22:04 (GMT) |
commit | 59aa5d7e29ca142ae324ad97e6a5f0353d1a6b89 (patch) | |
tree | e450b95ff4c0ba7f770723402a2634773f1a0451 /3rdParty/Boost/src/boost/property_tree/detail/file_parser_error.hpp | |
parent | 3ff52013d810f94b6095e93f550f58133e2df239 (diff) | |
download | swift-contrib-59aa5d7e29ca142ae324ad97e6a5f0353d1a6b89.zip swift-contrib-59aa5d7e29ca142ae324ad97e6a5f0353d1a6b89.tar.bz2 |
Store JID->Avatar mappings.
Resolves: #653
Diffstat (limited to '3rdParty/Boost/src/boost/property_tree/detail/file_parser_error.hpp')
-rw-r--r-- | 3rdParty/Boost/src/boost/property_tree/detail/file_parser_error.hpp | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/3rdParty/Boost/src/boost/property_tree/detail/file_parser_error.hpp b/3rdParty/Boost/src/boost/property_tree/detail/file_parser_error.hpp new file mode 100644 index 0000000..ff90583 --- /dev/null +++ b/3rdParty/Boost/src/boost/property_tree/detail/file_parser_error.hpp @@ -0,0 +1,88 @@ +// ---------------------------------------------------------------------------- +// Copyright (C) 2002-2006 Marcin Kalicinski +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// For more information, see www.boost.org +// ---------------------------------------------------------------------------- +#ifndef BOOST_PROPERTY_TREE_DETAIL_FILE_PARSER_ERROR_HPP_INCLUDED +#define BOOST_PROPERTY_TREE_DETAIL_FILE_PARSER_ERROR_HPP_INCLUDED + +#include <boost/property_tree/ptree.hpp> +#include <string> + +namespace boost { namespace property_tree +{ + + //! File parse error + class file_parser_error: public ptree_error + { + + public: + + /////////////////////////////////////////////////////////////////////// + // Construction & destruction + + // Construct error + file_parser_error(const std::string &msg, + const std::string &file, + unsigned long l) : + ptree_error(format_what(msg, file, l)), + m_message(msg), m_filename(file), m_line(l) + { + } + + ~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) + std::string message() const + { + return m_message; + } + + // Get error filename + std::string filename() const + { + return m_filename; + } + + // Get error line number + unsigned long line() const + { + 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() + static std::string format_what(const std::string &msg, + const std::string &file, + unsigned long l) + { + std::stringstream stream; + stream << (file.empty() ? "<unspecified file>" : file.c_str()); + if (l > 0) + stream << '(' << l << ')'; + stream << ": " << msg; + return stream.str(); + } + + }; + +} } + +#endif |