|
||||
File indexing completed on 2025-01-18 09:50:18
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 0012 #ifndef BOOST_PROPERTY_TREE_EXCEPTIONS_HPP_INCLUDED 0013 #define BOOST_PROPERTY_TREE_EXCEPTIONS_HPP_INCLUDED 0014 0015 #include <boost/property_tree/ptree_fwd.hpp> 0016 0017 #include <boost/any.hpp> 0018 #include <stdexcept> 0019 #include <string> 0020 0021 namespace boost { namespace property_tree 0022 { 0023 0024 /// Base class for all property tree errors. Derives from 0025 /// @c std::runtime_error. Call member function @c what to get human 0026 /// readable message associated with the error. 0027 class ptree_error : public std::runtime_error 0028 { 0029 public: 0030 /// Instantiate a ptree_error instance with the given message. 0031 /// @param what The message to associate with this error. 0032 ptree_error(const std::string &what); 0033 0034 ~ptree_error() throw() BOOST_OVERRIDE; 0035 }; 0036 0037 0038 /// Error indicating that translation from given value to the property tree 0039 /// data_type (or vice versa) failed. Derives from ptree_error. 0040 class ptree_bad_data : public ptree_error 0041 { 0042 public: 0043 /// Instantiate a ptree_bad_data instance with the given message and 0044 /// data. 0045 /// @param what The message to associate with this error. 0046 /// @param data The value associated with this error that was the source 0047 /// of the translation failure. 0048 template<class T> ptree_bad_data(const std::string &what, 0049 const T &data); 0050 0051 ~ptree_bad_data() throw() BOOST_OVERRIDE; 0052 0053 /// Retrieve the data associated with this error. This is the source 0054 /// value that failed to be translated. You need to explicitly 0055 /// specify its type. 0056 template<class T> T data() const; 0057 private: 0058 boost::any m_data; 0059 }; 0060 0061 0062 /// Error indicating that specified path does not exist. Derives from 0063 /// ptree_error. 0064 class ptree_bad_path : public ptree_error 0065 { 0066 public: 0067 /// Instantiate a ptree_bad_path with the given message and path data. 0068 /// @param what The message to associate with this error. 0069 /// @param path The path that could not be found in the property_tree. 0070 template<class T> ptree_bad_path(const std::string &what, 0071 const T &path); 0072 0073 ~ptree_bad_path() throw() BOOST_OVERRIDE; 0074 0075 /// Retrieve the invalid path. You need to explicitly specify the 0076 /// type of path. 0077 template<class T> T path() const; 0078 private: 0079 boost::any m_path; 0080 }; 0081 0082 }} 0083 0084 #include <boost/property_tree/detail/exception_implementation.hpp> 0085 0086 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |