Chris@16: // ---------------------------------------------------------------------------- Chris@16: // Copyright (C) 2002-2006 Marcin Kalicinski Chris@16: // Copyright (C) 2009 Sebastian Redl Chris@16: // Chris@16: // Distributed under the Boost Software License, Version 1.0. Chris@16: // (See accompanying file LICENSE_1_0.txt or copy at Chris@16: // http://www.boost.org/LICENSE_1_0.txt) Chris@16: // Chris@16: // For more information, see www.boost.org Chris@16: // ---------------------------------------------------------------------------- Chris@16: #ifndef BOOST_PROPERTY_TREE_DETAIL_EXCEPTIONS_IMPLEMENTATION_HPP_INCLUDED Chris@16: #define BOOST_PROPERTY_TREE_DETAIL_EXCEPTIONS_IMPLEMENTATION_HPP_INCLUDED Chris@16: Chris@16: namespace boost { namespace property_tree Chris@16: { Chris@16: Chris@16: namespace detail Chris@16: { Chris@16: Chris@16: // Helper for preparing what string in ptree_bad_path exception Chris@16: template inline Chris@16: std::string prepare_bad_path_what(const std::string &what, Chris@16: const P &path) Chris@16: { Chris@16: return what + " (" + path.dump() + ")"; Chris@16: } Chris@16: Chris@16: } Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: // ptree_error Chris@16: Chris@16: inline ptree_error::ptree_error(const std::string &w): Chris@16: std::runtime_error(w) Chris@16: { Chris@16: } Chris@16: Chris@16: inline ptree_error::~ptree_error() throw() Chris@16: { Chris@16: } Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: // ptree_bad_data Chris@16: Chris@16: template inline Chris@16: ptree_bad_data::ptree_bad_data(const std::string &w, const D &d): Chris@16: ptree_error(w), m_data(d) Chris@16: { Chris@16: } Chris@16: Chris@16: inline ptree_bad_data::~ptree_bad_data() throw() Chris@16: { Chris@16: } Chris@16: Chris@16: template inline Chris@16: D ptree_bad_data::data() const Chris@16: { Chris@16: return boost::any_cast(m_data); Chris@16: } Chris@16: Chris@16: /////////////////////////////////////////////////////////////////////////// Chris@16: // ptree_bad_path Chris@16: Chris@16: template inline Chris@16: ptree_bad_path::ptree_bad_path(const std::string &w, const P &p): Chris@16: ptree_error(detail::prepare_bad_path_what(w, p)), m_path(p) Chris@16: { Chris@16: Chris@16: } Chris@16: Chris@16: inline ptree_bad_path::~ptree_bad_path() throw() Chris@16: { Chris@16: } Chris@16: Chris@16: template inline Chris@16: P ptree_bad_path::path() const Chris@16: { Chris@16: return boost::any_cast

(m_path); Chris@16: } Chris@16: Chris@16: }} Chris@16: Chris@16: #endif