![]() |
|
|||
File indexing completed on 2025-06-30 08:29:06
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 0035 0036 /// Error indicating that translation from given value to the property tree 0037 /// data_type (or vice versa) failed. Derives from ptree_error. 0038 class ptree_bad_data : public ptree_error 0039 { 0040 public: 0041 /// Instantiate a ptree_bad_data instance with the given message and 0042 /// data. 0043 /// @param what The message to associate with this error. 0044 /// @param data The value associated with this error that was the source 0045 /// of the translation failure. 0046 template<class T> ptree_bad_data(const std::string &what, 0047 const T &data); 0048 0049 /// Retrieve the data associated with this error. This is the source 0050 /// value that failed to be translated. You need to explicitly 0051 /// specify its type. 0052 template<class T> T data() const; 0053 private: 0054 boost::any m_data; 0055 }; 0056 0057 0058 /// Error indicating that specified path does not exist. Derives from 0059 /// ptree_error. 0060 class ptree_bad_path : public ptree_error 0061 { 0062 public: 0063 /// Instantiate a ptree_bad_path with the given message and path data. 0064 /// @param what The message to associate with this error. 0065 /// @param path The path that could not be found in the property_tree. 0066 template<class T> ptree_bad_path(const std::string &what, 0067 const T &path); 0068 0069 /// Retrieve the invalid path. You need to explicitly specify the 0070 /// type of path. 0071 template<class T> T path() const; 0072 private: 0073 boost::any m_path; 0074 }; 0075 0076 }} 0077 0078 #include <boost/property_tree/detail/exception_implementation.hpp> 0079 0080 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
![]() ![]() |