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: Chris@16: #ifndef BOOST_PROPERTY_TREE_EXCEPTIONS_HPP_INCLUDED Chris@16: #define BOOST_PROPERTY_TREE_EXCEPTIONS_HPP_INCLUDED Chris@16: Chris@16: #include Chris@16: Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: namespace boost { namespace property_tree Chris@16: { Chris@16: Chris@16: /// Base class for all property tree errors. Derives from Chris@16: /// @c std::runtime_error. Call member function @c what to get human Chris@16: /// readable message associated with the error. Chris@16: class ptree_error : public std::runtime_error Chris@16: { Chris@16: public: Chris@16: /// Instantiate a ptree_error instance with the given message. Chris@16: /// @param what The message to associate with this error. Chris@16: ptree_error(const std::string &what); Chris@16: Chris@16: ~ptree_error() throw(); Chris@16: }; Chris@16: Chris@16: Chris@16: /// Error indicating that translation from given value to the property tree Chris@16: /// data_type (or vice versa) failed. Derives from ptree_error. Chris@16: class ptree_bad_data : public ptree_error Chris@16: { Chris@16: public: Chris@16: /// Instantiate a ptree_bad_data instance with the given message and Chris@16: /// data. Chris@16: /// @param what The message to associate with this error. Chris@16: /// @param data The value associated with this error that was the source Chris@16: /// of the translation failure. Chris@16: template ptree_bad_data(const std::string &what, Chris@16: const T &data); Chris@16: Chris@16: ~ptree_bad_data() throw(); Chris@16: Chris@16: /// Retrieve the data associated with this error. This is the source Chris@16: /// value that failed to be translated. You need to explicitly Chris@16: /// specify its type. Chris@16: template T data() const; Chris@16: private: Chris@16: boost::any m_data; Chris@16: }; Chris@16: Chris@16: Chris@16: /// Error indicating that specified path does not exist. Derives from Chris@16: /// ptree_error. Chris@16: class ptree_bad_path : public ptree_error Chris@16: { Chris@16: public: Chris@16: /// Instantiate a ptree_bad_path with the given message and path data. Chris@16: /// @param what The message to associate with this error. Chris@16: /// @param path The path that could not be found in the property_tree. Chris@16: template ptree_bad_path(const std::string &what, Chris@16: const T &path); Chris@16: Chris@16: ~ptree_bad_path() throw(); Chris@16: Chris@16: /// Retrieve the invalid path. You need to explicitly specify the Chris@16: /// type of path. Chris@16: template T path() const; Chris@16: private: Chris@16: boost::any m_path; Chris@16: }; Chris@16: Chris@16: }} Chris@16: Chris@16: #include Chris@16: Chris@16: #endif