Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-30 09:35:37

0001 //  boost/filesystem/exception.hpp  -----------------------------------------------------//
0002 
0003 //  Copyright Beman Dawes 2003
0004 //  Copyright Andrey Semashev 2019
0005 
0006 //  Distributed under the Boost Software License, Version 1.0.
0007 //  See http://www.boost.org/LICENSE_1_0.txt
0008 
0009 //  Library home page: http://www.boost.org/libs/filesystem
0010 
0011 #ifndef BOOST_FILESYSTEM_EXCEPTION_HPP
0012 #define BOOST_FILESYSTEM_EXCEPTION_HPP
0013 
0014 #include <boost/filesystem/config.hpp>
0015 #include <boost/filesystem/path.hpp>
0016 
0017 #include <string>
0018 #include <boost/system/error_code.hpp>
0019 #include <boost/system/system_error.hpp>
0020 #include <boost/smart_ptr/intrusive_ptr.hpp>
0021 #include <boost/smart_ptr/intrusive_ref_counter.hpp>
0022 
0023 #include <boost/filesystem/detail/header.hpp> // must be the last #include
0024 
0025 namespace boost {
0026 namespace filesystem {
0027 
0028 //--------------------------------------------------------------------------------------//
0029 //                                                                                      //
0030 //                            class filesystem_error                                    //
0031 //                                                                                      //
0032 //--------------------------------------------------------------------------------------//
0033 
0034 class BOOST_SYMBOL_VISIBLE filesystem_error :
0035     public system::system_error
0036 {
0037     // see http://www.boost.org/more/error_handling.html for design rationale
0038 
0039 public:
0040     BOOST_FILESYSTEM_DECL filesystem_error(const char* what_arg, system::error_code ec);
0041     BOOST_FILESYSTEM_DECL filesystem_error(std::string const& what_arg, system::error_code ec);
0042     BOOST_FILESYSTEM_DECL filesystem_error(const char* what_arg, path const& path1_arg, system::error_code ec);
0043     BOOST_FILESYSTEM_DECL filesystem_error(std::string const& what_arg, path const& path1_arg, system::error_code ec);
0044     BOOST_FILESYSTEM_DECL filesystem_error(const char* what_arg, path const& path1_arg, path const& path2_arg, system::error_code ec);
0045     BOOST_FILESYSTEM_DECL filesystem_error(std::string const& what_arg, path const& path1_arg, path const& path2_arg, system::error_code ec);
0046 
0047     BOOST_FILESYSTEM_DECL filesystem_error(filesystem_error const& that);
0048     BOOST_FILESYSTEM_DECL filesystem_error& operator=(filesystem_error const& that);
0049 
0050     BOOST_FILESYSTEM_DECL ~filesystem_error() BOOST_NOEXCEPT_OR_NOTHROW;
0051 
0052     path const& path1() const BOOST_NOEXCEPT
0053     {
0054         return m_imp_ptr.get() ? m_imp_ptr->m_path1 : get_empty_path();
0055     }
0056     path const& path2() const BOOST_NOEXCEPT
0057     {
0058         return m_imp_ptr.get() ? m_imp_ptr->m_path2 : get_empty_path();
0059     }
0060 
0061     BOOST_FILESYSTEM_DECL const char* what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE;
0062 
0063 private:
0064     BOOST_FILESYSTEM_DECL static path const& get_empty_path() BOOST_NOEXCEPT;
0065 
0066 private:
0067     struct impl :
0068         public boost::intrusive_ref_counter< impl >
0069     {
0070         path m_path1;       // may be empty()
0071         path m_path2;       // may be empty()
0072         std::string m_what; // not built until needed
0073 
0074         BOOST_DEFAULTED_FUNCTION(impl(), {})
0075         explicit impl(path const& path1) :
0076             m_path1(path1)
0077         {
0078         }
0079         impl(path const& path1, path const& path2) :
0080             m_path1(path1), m_path2(path2)
0081         {
0082         }
0083     };
0084     boost::intrusive_ptr< impl > m_imp_ptr;
0085 };
0086 
0087 } // namespace filesystem
0088 } // namespace boost
0089 
0090 #include <boost/filesystem/detail/footer.hpp>
0091 
0092 #endif // BOOST_FILESYSTEM_EXCEPTION_HPP