93 lines
3.6 KiB
C++
93 lines
3.6 KiB
C++
// ActivBoost/filesystem/exception.hpp -----------------------------------------------------//
|
|
|
|
// Copyright Beman Dawes 2003
|
|
// Copyright Andrey Semashev 2019
|
|
|
|
// Distributed under the Boost Software License, Version 1.0.
|
|
// See http://www.boost.org/LICENSE_1_0.txt
|
|
|
|
// Library home page: http://www.boost.org/libs/filesystem
|
|
|
|
#ifndef ACTIV_BOOST_FILESYSTEM_EXCEPTION_HPP
|
|
#define ACTIV_BOOST_FILESYSTEM_EXCEPTION_HPP
|
|
|
|
#include <ActivBoost/filesystem/config.hpp>
|
|
#include <ActivBoost/filesystem/path.hpp>
|
|
|
|
#include <string>
|
|
#include <ActivBoost/system/error_code.hpp>
|
|
#include <ActivBoost/system/system_error.hpp>
|
|
#include <ActivBoost/smart_ptr/intrusive_ptr.hpp>
|
|
#include <ActivBoost/smart_ptr/intrusive_ref_counter.hpp>
|
|
|
|
#include <ActivBoost/filesystem/detail/header.hpp> // must be the last #include
|
|
|
|
namespace Boost {
|
|
namespace filesystem {
|
|
|
|
//--------------------------------------------------------------------------------------//
|
|
// //
|
|
// class filesystem_error //
|
|
// //
|
|
//--------------------------------------------------------------------------------------//
|
|
|
|
class ACTIV_BOOST_SYMBOL_VISIBLE filesystem_error :
|
|
public system::system_error
|
|
{
|
|
// see http://www.boost.org/more/error_handling.html for design rationale
|
|
|
|
public:
|
|
ACTIV_BOOST_FILESYSTEM_DECL filesystem_error(const char* what_arg, system::error_code ec);
|
|
ACTIV_BOOST_FILESYSTEM_DECL filesystem_error(std::string const& what_arg, system::error_code ec);
|
|
ACTIV_BOOST_FILESYSTEM_DECL filesystem_error(const char* what_arg, path const& path1_arg, system::error_code ec);
|
|
ACTIV_BOOST_FILESYSTEM_DECL filesystem_error(std::string const& what_arg, path const& path1_arg, system::error_code ec);
|
|
ACTIV_BOOST_FILESYSTEM_DECL filesystem_error(const char* what_arg, path const& path1_arg, path const& path2_arg, system::error_code ec);
|
|
ACTIV_BOOST_FILESYSTEM_DECL filesystem_error(std::string const& what_arg, path const& path1_arg, path const& path2_arg, system::error_code ec);
|
|
|
|
ACTIV_BOOST_FILESYSTEM_DECL filesystem_error(filesystem_error const& that);
|
|
ACTIV_BOOST_FILESYSTEM_DECL filesystem_error& operator=(filesystem_error const& that);
|
|
|
|
ACTIV_BOOST_FILESYSTEM_DECL ~filesystem_error() ACTIV_BOOST_NOEXCEPT_OR_NOTHROW;
|
|
|
|
path const& path1() const ACTIV_BOOST_NOEXCEPT
|
|
{
|
|
return m_imp_ptr.get() ? m_imp_ptr->m_path1 : get_empty_path();
|
|
}
|
|
path const& path2() const ACTIV_BOOST_NOEXCEPT
|
|
{
|
|
return m_imp_ptr.get() ? m_imp_ptr->m_path2 : get_empty_path();
|
|
}
|
|
|
|
ACTIV_BOOST_FILESYSTEM_DECL const char* what() const ACTIV_BOOST_NOEXCEPT_OR_NOTHROW ACTIV_BOOST_OVERRIDE;
|
|
|
|
private:
|
|
ACTIV_BOOST_FILESYSTEM_DECL static path const& get_empty_path() ACTIV_BOOST_NOEXCEPT;
|
|
|
|
private:
|
|
struct impl :
|
|
public Boost::intrusive_ref_counter< impl >
|
|
{
|
|
path m_path1; // may be empty()
|
|
path m_path2; // may be empty()
|
|
std::string m_what; // not built until needed
|
|
|
|
ACTIV_BOOST_DEFAULTED_FUNCTION(impl(), {})
|
|
explicit impl(path const& path1) :
|
|
m_path1(path1)
|
|
{
|
|
}
|
|
impl(path const& path1, path const& path2) :
|
|
m_path1(path1), m_path2(path2)
|
|
{
|
|
}
|
|
};
|
|
Boost::intrusive_ptr< impl > m_imp_ptr;
|
|
};
|
|
|
|
} // namespace filesystem
|
|
} // namespace Boost
|
|
|
|
#include <ActivBoost/filesystem/detail/footer.hpp>
|
|
|
|
#endif // ACTIV_BOOST_FILESYSTEM_EXCEPTION_HPP
|