Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-16 10:07:19

0001 // ----------------------------------------------------------------------------
0002 // Copyright (C) 2002-2006 Marcin Kalicinski
0003 // Copyright (C) 2009 Sebastian Redl
0004 //
0005 // Distributed under the Boost Software License, Version 1.0. 
0006 // (See accompanying file LICENSE_1_0.txt or copy at 
0007 // http://www.boost.org/LICENSE_1_0.txt)
0008 //
0009 // For more information, see www.boost.org
0010 // ----------------------------------------------------------------------------
0011 #ifndef BOOST_PROPERTY_TREE_DETAIL_EXCEPTIONS_IMPLEMENTATION_HPP_INCLUDED
0012 #define BOOST_PROPERTY_TREE_DETAIL_EXCEPTIONS_IMPLEMENTATION_HPP_INCLUDED
0013 
0014 #include <boost/property_tree/exceptions.hpp>
0015 
0016 #include <string>
0017 
0018 namespace boost { namespace property_tree
0019 {
0020 
0021     namespace detail
0022     {
0023 
0024         // Helper for preparing what string in ptree_bad_path exception
0025         template<class P> inline
0026         std::string prepare_bad_path_what(const std::string &what,
0027                                           const P &path)
0028         {
0029             return what + " (" + path.dump() + ")";
0030         }
0031 
0032     }
0033 
0034     ///////////////////////////////////////////////////////////////////////////
0035     // ptree_error
0036 
0037     inline ptree_error::ptree_error(const std::string &w): 
0038         std::runtime_error(w) 
0039     {
0040     }
0041 
0042     ///////////////////////////////////////////////////////////////////////////
0043     // ptree_bad_data
0044 
0045     template<class D> inline
0046     ptree_bad_data::ptree_bad_data(const std::string &w, const D &d):
0047         ptree_error(w), m_data(d)
0048     {
0049     }
0050 
0051     template<class D> inline
0052     D ptree_bad_data::data() const
0053     {
0054         return boost::any_cast<D>(m_data);
0055     }
0056 
0057     ///////////////////////////////////////////////////////////////////////////
0058     // ptree_bad_path
0059 
0060     template<class P> inline
0061     ptree_bad_path::ptree_bad_path(const std::string &w, const P &p):
0062         ptree_error(detail::prepare_bad_path_what(w, p)), m_path(p)
0063     {
0064 
0065     }
0066 
0067     template<class P> inline
0068     P ptree_bad_path::path() const
0069     {
0070         return boost::any_cast<P>(m_path);
0071     }
0072 
0073 }}
0074 
0075 #endif