1 #ifndef SILICIUM_ABSOLUTE_PATH_HPP
2 #define SILICIUM_ABSOLUTE_PATH_HPP
11 #define SILICIUM_HAS_ABSOLUTE_PATH_OPERATIONS SILICIUM_HAS_EXCEPTIONS
13 #if SILICIUM_HAS_ABSOLUTE_PATH_OPERATIONS
14 # include <boost/filesystem/operations.hpp>
31 : m_value(
std::
move(other.m_value))
36 : m_value(other.m_value)
48 m_value = other.m_value;
54 m_value.
swap(other.m_value);
58 boost::filesystem::path
69 boost::filesystem::path
const &
79 char_type
const *
c_str() const BOOST_NOEXCEPT
81 return m_value.
c_str();
97 bool empty() const BOOST_NOEXCEPT
105 if (maybe_absolute.is_absolute())
115 return create(boost::filesystem::path(maybe_absolute.c_str()));
121 return create(boost::filesystem::path(maybe_absolute));
128 return create(boost::filesystem::path(maybe_absolute));
160 in.setstate(std::ios::failbit);
167 template <
class ComparableToPath>
174 template <
class ComparableToPath>
184 return right == left.
c_str();
190 return left == right.
c_str();
199 template <
class ComparableToPath>
203 return !(left == right);
206 template <
class ComparableToPath>
210 return !(left == right);
238 if (boosted.has_parent_path())
254 template <std::
size_t N>
258 return front /
relative_path(boost::filesystem::path(&literal[0]));
262 template <std::
size_t N>
264 inline absolute_path
operator / (absolute_path
const &front,
char const (&literal)[N])
266 return front / relative_path(boost::filesystem::path(&literal[0]));
270 #if SILICIUM_HAS_ABSOLUTE_PATH_OPERATIONS
280 boost::system::error_code ec;
288 boost::system::error_code ec;
296 boost::system::error_code ec;
313 boost::filesystem::directory_iterator i(directories.
to_boost_path(), error);
318 for (; i != boost::filesystem::directory_iterator{}; )
337 boost::system::error_code ec;
338 boost::filesystem::file_status status = boost::filesystem::status(file.
to_boost_path(), ec);
339 if (status.type() == boost::filesystem::file_not_found)
Definition: c_string.hpp:10
static SILICIUM_USE_RESULT optional< absolute_path > create(noexcept_string const &maybe_absolute)
Definition: absolute_path.hpp:113
SILICIUM_USE_RESULT bool empty() const BOOST_NOEXCEPT
Definition: absolute_path.hpp:97
SILICIUM_USE_RESULT optional< absolute_path > parent(absolute_path const &whole)
Definition: absolute_path.hpp:234
std::remove_reference< T >::type && move(T &&ref)
Definition: move.hpp:10
SILICIUM_USE_RESULT boost::system::error_code remove_file(absolute_path const &name)
Definition: absolute_path.hpp:278
Definition: absolute_path.hpp:21
SILICIUM_USE_RESULT error_or< bool > file_exists(absolute_path const &file)
Definition: absolute_path.hpp:335
SILICIUM_USE_RESULT boost::system::error_code create_directories(absolute_path const &directories)
Definition: absolute_path.hpp:286
SILICIUM_USE_RESULT relative_path leaf(absolute_path const &whole)
Definition: absolute_path.hpp:227
BOOST_STATIC_ASSERT(Si::is_handle< absolute_path >::value)
std::ostream & operator<<(std::ostream &out, absolute_path const &p)
Definition: absolute_path.hpp:144
void swap(absolute_path &other) BOOST_NOEXCEPT
Definition: absolute_path.hpp:52
char_type const * c_str() const BOOST_NOEXCEPT
Definition: path.hpp:129
std::istream & operator>>(std::istream &in, absolute_path &p)
Definition: absolute_path.hpp:149
Definition: absolute_path.hpp:352
Definition: absolute_path.hpp:19
absolute_path & operator=(absolute_path &&other) BOOST_NOEXCEPT
Definition: absolute_path.hpp:40
Definition: optional.hpp:39
boost::container::string noexcept_string
Definition: noexcept_string.hpp:26
static SILICIUM_USE_RESULT optional< absolute_path > create(char const *maybe_absolute)
Definition: absolute_path.hpp:119
noexcept_string const & underlying() const BOOST_NOEXCEPT
Definition: path.hpp:124
SILICIUM_USE_RESULT boost::filesystem::path to_boost_path() const
Definition: absolute_path.hpp:62
boost::filesystem::path to_boost_path() const
Definition: path.hpp:110
path::underlying_type underlying_type
Definition: absolute_path.hpp:24
SILICIUM_USE_RESULT absolute_path operator/(absolute_path const &front, relative_path const &back)
Definition: absolute_path.hpp:246
SILICIUM_USE_RESULT bool operator==(absolute_path const &left, ComparableToPath const &right)
Definition: absolute_path.hpp:169
SILICIUM_USE_RESULT char_type const * c_str() const BOOST_NOEXCEPT
Definition: absolute_path.hpp:79
static SILICIUM_USE_RESULT optional< absolute_path > create(boost::filesystem::path const &maybe_absolute)
Definition: absolute_path.hpp:103
SILICIUM_USE_RESULT bool operator<(absolute_path const &left, absolute_path const &right)
Definition: absolute_path.hpp:214
os_c_string native_path_string
Definition: c_string.hpp:70
absolute_path(absolute_path const &other)
Definition: absolute_path.hpp:35
noexcept_string underlying_type
Definition: path.hpp:20
absolute_path() BOOST_NOEXCEPT
Definition: absolute_path.hpp:26
SILICIUM_USE_RESULT boost::system::error_code recreate_directories(absolute_path const &directories)
Definition: absolute_path.hpp:306
SILICIUM_USE_RESULT boost::filesystem::path to_boost_path() const
Definition: relative_path.hpp:94
void combine(relative_path const &back)
Definition: absolute_path.hpp:90
SILICIUM_USE_RESULT absolute_path get_current_working_directory()
Definition: absolute_path.hpp:272
Definition: error_or.hpp:48
SILICIUM_USE_RESULT native_path_string safe_c_str() const BOOST_NOEXCEPT
Definition: absolute_path.hpp:85
SILICIUM_USE_RESULT noexcept_string const & underlying() const BOOST_NOEXCEPT
Definition: absolute_path.hpp:73
native_path_char char_type
Definition: absolute_path.hpp:23
Definition: is_handle.hpp:21
SILICIUM_USE_RESULT std::size_t hash_value(absolute_path const &value)
Definition: absolute_path.hpp:220
SILICIUM_USE_RESULT bool operator!=(absolute_path const &left, ComparableToPath const &right)
Definition: absolute_path.hpp:201
char native_path_char
Definition: path_char.hpp:14
SILICIUM_USE_RESULT error_or< boost::uint64_t > remove_all(absolute_path const &directories)
Definition: absolute_path.hpp:294
void swap(path &other) BOOST_NOEXCEPT
Definition: path.hpp:101
Definition: relative_path.hpp:10
SILICIUM_USE_RESULT std::size_t operator()(Si::absolute_path const &value) const
Definition: absolute_path.hpp:358
absolute_path(absolute_path &&other) BOOST_NOEXCEPT
Definition: absolute_path.hpp:30
#define SILICIUM_USE_RESULT
Definition: config.hpp:147