]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/boost/filesystem/exception.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / filesystem / exception.hpp
CommitLineData
7c673cae
FG
1// boost/filesystem/exception.hpp -----------------------------------------------------//
2
3// Copyright Beman Dawes 2003
92f5a8d4 4// Copyright Andrey Semashev 2019
7c673cae 5
92f5a8d4
TL
6// Distributed under the Boost Software License, Version 1.0.
7// See http://www.boost.org/LICENSE_1_0.txt
8
9// Library home page: http://www.boost.org/libs/filesystem
10
1e59de90
TL
11#ifndef BOOST_FILESYSTEM_EXCEPTION_HPP
12#define BOOST_FILESYSTEM_EXCEPTION_HPP
92f5a8d4
TL
13
14#include <boost/filesystem/config.hpp>
15#include <boost/filesystem/path.hpp>
16
17#include <string>
18#include <boost/system/error_code.hpp>
19#include <boost/system/system_error.hpp>
20#include <boost/smart_ptr/intrusive_ptr.hpp>
21#include <boost/smart_ptr/intrusive_ref_counter.hpp>
22
1e59de90 23#include <boost/filesystem/detail/header.hpp> // must be the last #include
92f5a8d4
TL
24
25namespace boost {
26namespace filesystem {
27
28//--------------------------------------------------------------------------------------//
29// //
30// class filesystem_error //
31// //
32//--------------------------------------------------------------------------------------//
33
1e59de90
TL
34class BOOST_SYMBOL_VISIBLE filesystem_error :
35 public system::system_error
92f5a8d4 36{
1e59de90 37 // see http://www.boost.org/more/error_handling.html for design rationale
92f5a8d4
TL
38
39public:
1e59de90
TL
40 BOOST_FILESYSTEM_DECL filesystem_error(const char* what_arg, system::error_code ec);
41 BOOST_FILESYSTEM_DECL filesystem_error(std::string const& what_arg, system::error_code ec);
42 BOOST_FILESYSTEM_DECL filesystem_error(const char* what_arg, path const& path1_arg, system::error_code ec);
43 BOOST_FILESYSTEM_DECL filesystem_error(std::string const& what_arg, path const& path1_arg, system::error_code ec);
44 BOOST_FILESYSTEM_DECL filesystem_error(const char* what_arg, path const& path1_arg, path const& path2_arg, system::error_code ec);
45 BOOST_FILESYSTEM_DECL filesystem_error(std::string const& what_arg, path const& path1_arg, path const& path2_arg, system::error_code ec);
92f5a8d4 46
1e59de90
TL
47 BOOST_FILESYSTEM_DECL filesystem_error(filesystem_error const& that);
48 BOOST_FILESYSTEM_DECL filesystem_error& operator=(filesystem_error const& that);
92f5a8d4 49
1e59de90 50 BOOST_FILESYSTEM_DECL ~filesystem_error() BOOST_NOEXCEPT_OR_NOTHROW;
92f5a8d4 51
1e59de90
TL
52 path const& path1() const BOOST_NOEXCEPT
53 {
54 return m_imp_ptr.get() ? m_imp_ptr->m_path1 : get_empty_path();
55 }
56 path const& path2() const BOOST_NOEXCEPT
57 {
58 return m_imp_ptr.get() ? m_imp_ptr->m_path2 : get_empty_path();
59 }
92f5a8d4 60
1e59de90 61 BOOST_FILESYSTEM_DECL const char* what() const BOOST_NOEXCEPT_OR_NOTHROW BOOST_OVERRIDE;
92f5a8d4
TL
62
63private:
1e59de90 64 BOOST_FILESYSTEM_DECL static path const& get_empty_path() BOOST_NOEXCEPT;
92f5a8d4
TL
65
66private:
1e59de90
TL
67 struct impl :
68 public boost::intrusive_ref_counter< impl >
69 {
70 path m_path1; // may be empty()
71 path m_path2; // may be empty()
72 std::string m_what; // not built until needed
73
74 BOOST_DEFAULTED_FUNCTION(impl(), {})
75 explicit impl(path const& path1) :
76 m_path1(path1)
77 {
78 }
79 impl(path const& path1, path const& path2) :
80 m_path1(path1), m_path2(path2)
81 {
82 }
83 };
84 boost::intrusive_ptr< impl > m_imp_ptr;
92f5a8d4
TL
85};
86
87} // namespace filesystem
88} // namespace boost
89
1e59de90 90#include <boost/filesystem/detail/footer.hpp>
92f5a8d4 91
1e59de90 92#endif // BOOST_FILESYSTEM_EXCEPTION_HPP