WPILibC++ 2023.4.3
filesystem.hpp File Reference
#include <sys/param.h>
#include <dirent.h>
#include <fcntl.h>
#include <limits.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/statvfs.h>
#include <langinfo.h>
#include <algorithm>
#include <cctype>
#include <chrono>
#include <clocale>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <functional>
#include <memory>
#include <stack>
#include <stdexcept>
#include <string>
#include <system_error>
#include <type_traits>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

class  ghc::filesystem::not_implemented_exception
 
class  ghc::filesystem::path_helper_base< char_type >
 
class  ghc::filesystem::path
 
struct  ghc::filesystem::path::_is_basic_string< T >
 
struct  ghc::filesystem::path::_is_basic_string< std::basic_string< CharT, Traits, Alloc > >
 
struct  ghc::filesystem::path::_is_basic_string< std::basic_string< CharT, std::char_traits< CharT >, std::allocator< CharT > > >
 
class  ghc::filesystem::filesystem_error
 
struct  ghc::filesystem::space_info
 
class  ghc::filesystem::file_status
 
class  ghc::filesystem::directory_entry
 
class  ghc::filesystem::directory_iterator
 
class  ghc::filesystem::directory_iterator::proxy
 
class  ghc::filesystem::recursive_directory_iterator
 
class  ghc::filesystem::basic_filebuf< charT, traits >
 
class  ghc::filesystem::basic_ifstream< charT, traits >
 
class  ghc::filesystem::basic_ofstream< charT, traits >
 
class  ghc::filesystem::basic_fstream< charT, traits >
 
class  ghc::filesystem::u8arguments
 
class  ghc::filesystem::directory_iterator::impl
 

Namespaces

namespace  ghc
 
namespace  ghc::filesystem
 
namespace  ghc::filesystem::detail
 

Macros

#define GHC_OS_DETECTED
 
#define GHC_EXPAND_IMPL
 
#define GHC_INLINE   inline
 
#define GHC_FS_API
 
#define GHC_FS_API_CLASS
 
#define LWG_2682_BEHAVIOUR
 
#define LWG_2936_BEHAVIOUR
 
#define LWG_2937_BEHAVIOUR
 
#define GHC_WIN_AUTO_PREFIX_LONG_PATH
 
#define GHC_FILESYSTEM_VERSION   10506L
 
#define GHC_NATIVEWP(p)   p.wstring().c_str()
 
#define GHC_PLATFORM_LITERAL(str)   str
 
#define UTIME_OMIT   ((1l << 30) - 2l)
 

Typedefs

using ghc::filesystem::file_time_type = std::chrono::time_point< std::chrono::system_clock >
 
typedef basic_filebuf< char > ghc::filesystem::filebuf
 
typedef basic_filebuf< wchar_t > ghc::filesystem::wfilebuf
 
typedef basic_ifstream< char > ghc::filesystem::ifstream
 
typedef basic_ifstream< wchar_t > ghc::filesystem::wifstream
 
typedef basic_ofstream< char > ghc::filesystem::ofstream
 
typedef basic_ofstream< wchar_t > ghc::filesystem::wofstream
 
typedef basic_fstream< char > ghc::filesystem::fstream
 
typedef basic_fstream< wchar_t > ghc::filesystem::wfstream
 
template<typename Enum >
using ghc::filesystem::detail::EnableBitmask = typename std::enable_if< std::is_same< Enum, perms >::value||std::is_same< Enum, perm_options >::value||std::is_same< Enum, copy_options >::value||std::is_same< Enum, directory_options >::value, Enum >::type
 

Enumerations

enum class  ghc::filesystem::file_type {
  ghc::filesystem::none , ghc::filesystem::not_found , ghc::filesystem::regular , ghc::filesystem::directory ,
  ghc::filesystem::symlink , ghc::filesystem::block , ghc::filesystem::character , ghc::filesystem::fifo ,
  ghc::filesystem::socket , ghc::filesystem::unknown
}
 
enum class  ghc::filesystem::perms : uint16_t {
  ghc::filesystem::none = 0 , ghc::filesystem::owner_read = 0400 , ghc::filesystem::owner_write = 0200 , ghc::filesystem::owner_exec = 0100 ,
  ghc::filesystem::owner_all = 0700 , ghc::filesystem::group_read = 040 , ghc::filesystem::group_write = 020 , ghc::filesystem::group_exec = 010 ,
  ghc::filesystem::group_all = 070 , ghc::filesystem::others_read = 04 , ghc::filesystem::others_write = 02 , ghc::filesystem::others_exec = 01 ,
  ghc::filesystem::others_all = 07 , ghc::filesystem::all = 0777 , ghc::filesystem::set_uid = 04000 , ghc::filesystem::set_gid = 02000 ,
  ghc::filesystem::sticky_bit = 01000 , ghc::filesystem::mask = 07777 , ghc::filesystem::unknown = 0xffff
}
 
enum class  ghc::filesystem::perm_options : uint16_t { ghc::filesystem::replace = 3 , ghc::filesystem::add = 1 , ghc::filesystem::remove = 2 , ghc::filesystem::nofollow = 4 }
 
enum class  ghc::filesystem::copy_options : uint16_t {
  ghc::filesystem::none = 0 , ghc::filesystem::skip_existing = 1 , ghc::filesystem::overwrite_existing = 2 , ghc::filesystem::update_existing = 4 ,
  ghc::filesystem::recursive = 8 , ghc::filesystem::copy_symlinks = 0x10 , ghc::filesystem::skip_symlinks = 0x20 , ghc::filesystem::directories_only = 0x40 ,
  ghc::filesystem::create_symlinks = 0x80 , ghc::filesystem::create_hard_links = 0x100
}
 
enum class  ghc::filesystem::directory_options : uint16_t { ghc::filesystem::none = 0 , ghc::filesystem::follow_directory_symlink = 1 , ghc::filesystem::skip_permission_denied = 2 }
 
enum  ghc::filesystem::detail::utf8_states_t { ghc::filesystem::detail::S_STRT = 0 , ghc::filesystem::detail::S_RJCT = 8 }
 
enum class  ghc::filesystem::detail::portable_error {
  ghc::filesystem::detail::none = 0 , ghc::filesystem::detail::exists , ghc::filesystem::detail::not_found , ghc::filesystem::detail::not_supported ,
  ghc::filesystem::detail::not_implemented , ghc::filesystem::detail::invalid_argument , ghc::filesystem::detail::is_a_directory
}
 

Functions

GHC_FS_API void ghc::filesystem::swap (path &lhs, path &rhs) noexcept
 
GHC_FS_API size_t ghc::filesystem::hash_value (const path &p) noexcept
 
GHC_FS_API bool ghc::filesystem::operator== (const path &lhs, const path &rhs) noexcept
 
GHC_FS_API bool ghc::filesystem::operator!= (const path &lhs, const path &rhs) noexcept
 
GHC_FS_API bool ghc::filesystem::operator< (const path &lhs, const path &rhs) noexcept
 
GHC_FS_API bool ghc::filesystem::operator<= (const path &lhs, const path &rhs) noexcept
 
GHC_FS_API bool ghc::filesystem::operator> (const path &lhs, const path &rhs) noexcept
 
GHC_FS_API bool ghc::filesystem::operator>= (const path &lhs, const path &rhs) noexcept
 
GHC_FS_API path ghc::filesystem::operator/ (const path &lhs, const path &rhs)
 
template<class charT , class traits >
std::basic_ostream< charT, traits > & ghc::filesystem::operator<< (std::basic_ostream< charT, traits > &os, const path &p)
 
template<class charT , class traits >
std::basic_istream< charT, traits > & ghc::filesystem::operator>> (std::basic_istream< charT, traits > &is, path &p)
 
template<class Source , typename = path::path_from_string<Source>>
path ghc::filesystem::u8path (const Source &source)
 
template<class InputIterator >
path ghc::filesystem::u8path (InputIterator first, InputIterator last)
 
GHC_FS_API directory_iterator ghc::filesystem::begin (directory_iterator iter) noexcept
 
GHC_FS_API directory_iterator ghc::filesystem::end (const directory_iterator &) noexcept
 
GHC_FS_API recursive_directory_iterator ghc::filesystem::begin (recursive_directory_iterator iter) noexcept
 
GHC_FS_API recursive_directory_iterator ghc::filesystem::end (const recursive_directory_iterator &) noexcept
 
GHC_FS_API path ghc::filesystem::absolute (const path &p, std::error_code &ec)
 
GHC_FS_API path ghc::filesystem::canonical (const path &p, std::error_code &ec)
 
GHC_FS_API void ghc::filesystem::copy (const path &from, const path &to, std::error_code &ec) noexcept
 
GHC_FS_API void ghc::filesystem::copy (const path &from, const path &to, copy_options options, std::error_code &ec) noexcept
 
GHC_FS_API bool ghc::filesystem::copy_file (const path &from, const path &to, std::error_code &ec) noexcept
 
GHC_FS_API bool ghc::filesystem::copy_file (const path &from, const path &to, copy_options option, std::error_code &ec) noexcept
 
GHC_FS_API void ghc::filesystem::copy_symlink (const path &existing_symlink, const path &new_symlink, std::error_code &ec) noexcept
 
GHC_FS_API bool ghc::filesystem::create_directories (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API bool ghc::filesystem::create_directory (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API bool ghc::filesystem::create_directory (const path &p, const path &attributes, std::error_code &ec) noexcept
 
GHC_FS_API void ghc::filesystem::create_directory_symlink (const path &to, const path &new_symlink, std::error_code &ec) noexcept
 
GHC_FS_API void ghc::filesystem::create_symlink (const path &to, const path &new_symlink, std::error_code &ec) noexcept
 
GHC_FS_API path ghc::filesystem::current_path (std::error_code &ec)
 
GHC_FS_API void ghc::filesystem::current_path (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API bool ghc::filesystem::exists (file_status s) noexcept
 
GHC_FS_API bool ghc::filesystem::exists (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API bool ghc::filesystem::equivalent (const path &p1, const path &p2, std::error_code &ec) noexcept
 
GHC_FS_API uintmax_t ghc::filesystem::file_size (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API bool ghc::filesystem::is_block_file (file_status s) noexcept
 
GHC_FS_API bool ghc::filesystem::is_block_file (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API bool ghc::filesystem::is_character_file (file_status s) noexcept
 
GHC_FS_API bool ghc::filesystem::is_character_file (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API bool ghc::filesystem::is_directory (file_status s) noexcept
 
GHC_FS_API bool ghc::filesystem::is_directory (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API bool ghc::filesystem::is_empty (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API bool ghc::filesystem::is_fifo (file_status s) noexcept
 
GHC_FS_API bool ghc::filesystem::is_fifo (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API bool ghc::filesystem::is_other (file_status s) noexcept
 
GHC_FS_API bool ghc::filesystem::is_other (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API bool ghc::filesystem::is_regular_file (file_status s) noexcept
 
GHC_FS_API bool ghc::filesystem::is_regular_file (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API bool ghc::filesystem::is_socket (file_status s) noexcept
 
GHC_FS_API bool ghc::filesystem::is_socket (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API bool ghc::filesystem::is_symlink (file_status s) noexcept
 
GHC_FS_API bool ghc::filesystem::is_symlink (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API file_time_type ghc::filesystem::last_write_time (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API void ghc::filesystem::last_write_time (const path &p, file_time_type new_time, std::error_code &ec) noexcept
 
GHC_FS_API void ghc::filesystem::permissions (const path &p, perms prms, std::error_code &ec) noexcept
 
GHC_FS_API void ghc::filesystem::permissions (const path &p, perms prms, perm_options opts, std::error_code &ec) noexcept
 
GHC_FS_API path ghc::filesystem::proximate (const path &p, std::error_code &ec)
 
GHC_FS_API path ghc::filesystem::proximate (const path &p, const path &base, std::error_code &ec)
 
GHC_FS_API path ghc::filesystem::read_symlink (const path &p, std::error_code &ec)
 
GHC_FS_API path ghc::filesystem::relative (const path &p, std::error_code &ec)
 
GHC_FS_API path ghc::filesystem::relative (const path &p, const path &base, std::error_code &ec)
 
GHC_FS_API bool ghc::filesystem::remove (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API uintmax_t ghc::filesystem::remove_all (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API void ghc::filesystem::rename (const path &from, const path &to, std::error_code &ec) noexcept
 
GHC_FS_API void ghc::filesystem::resize_file (const path &p, uintmax_t size, std::error_code &ec) noexcept
 
GHC_FS_API space_info ghc::filesystem::space (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API file_status ghc::filesystem::status (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API bool ghc::filesystem::status_known (file_status s) noexcept
 
GHC_FS_API file_status ghc::filesystem::symlink_status (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API path ghc::filesystem::temp_directory_path (std::error_code &ec) noexcept
 
GHC_FS_API path ghc::filesystem::weakly_canonical (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API void ghc::filesystem::create_hard_link (const path &to, const path &new_hard_link, std::error_code &ec) noexcept
 
GHC_FS_API uintmax_t ghc::filesystem::hard_link_count (const path &p, std::error_code &ec) noexcept
 
GHC_FS_API void ghc::filesystem::detail::appendUTF8 (std::string &str, uint32_t unicode)
 
GHC_FS_API bool ghc::filesystem::detail::is_surrogate (uint32_t c)
 
GHC_FS_API bool ghc::filesystem::detail::is_high_surrogate (uint32_t c)
 
GHC_FS_API bool ghc::filesystem::detail::is_low_surrogate (uint32_t c)
 
GHC_FS_API unsigned ghc::filesystem::detail::consumeUtf8Fragment (const unsigned state, const uint8_t fragment, uint32_t &codepoint)
 
GHC_FS_API std::error_code ghc::filesystem::detail::make_error_code (portable_error err)
 
GHC_FS_API std::error_code ghc::filesystem::detail::make_system_error (int err=0)
 
template<typename Enum >
constexpr detail::EnableBitmask< Enum > ghc::filesystem::operator& (Enum X, Enum Y)
 
template<typename Enum >
constexpr detail::EnableBitmask< Enum > ghc::filesystem::operator| (Enum X, Enum Y)
 
template<typename Enum >
constexpr detail::EnableBitmask< Enum > ghc::filesystem::operator^ (Enum X, Enum Y)
 
template<typename Enum >
constexpr detail::EnableBitmask< Enum > ghc::filesystem::operator~ (Enum X)
 
template<typename Enum >
detail::EnableBitmask< Enum > & ghc::filesystem::operator&= (Enum &X, Enum Y)
 
template<typename Enum >
detail::EnableBitmask< Enum > & ghc::filesystem::operator|= (Enum &X, Enum Y)
 
template<typename Enum >
detail::EnableBitmask< Enum > & ghc::filesystem::operator^= (Enum &X, Enum Y)
 
GHC_INLINE bool ghc::filesystem::detail::in_range (uint32_t c, uint32_t lo, uint32_t hi)
 
GHC_INLINE bool ghc::filesystem::detail::validUtf8 (const std::string &utf8String)
 
template<class StringType , class Utf8String , typename std::enable_if< path::_is_basic_string< Utf8String >::value &&(sizeof(typename Utf8String::value_type)==1) &&(sizeof(typename StringType::value_type)==1)>::type * = nullptr>
StringType ghc::filesystem::detail::fromUtf8 (const Utf8String &utf8String, const typename StringType::allocator_type &alloc=typename StringType::allocator_type())
 
template<class StringType , typename charT , std::size_t N>
StringType ghc::filesystem::detail::fromUtf8 (const charT(&utf8String)[N])
 
template<typename strT , typename std::enable_if< path::_is_basic_string< strT >::value &&(sizeof(typename strT::value_type)==1), int >::type size = 1>
std::string ghc::filesystem::detail::toUtf8 (const strT &unicodeString)
 
template<typename charT >
std::string ghc::filesystem::detail::toUtf8 (const charT *unicodeString)
 
template<typename strT , typename std::enable_if< path::_is_basic_string< strT >::value, bool >::type = true>
GHC_INLINE bool ghc::filesystem::detail::startsWith (const strT &what, const strT &with)
 
template<typename strT , typename std::enable_if< path::_is_basic_string< strT >::value, bool >::type = true>
GHC_INLINE bool ghc::filesystem::detail::endsWith (const strT &what, const strT &with)
 
GHC_INLINE bool ghc::filesystem::detail::equals_simple_insensitive (const path::value_type *str1, const path::value_type *str2)
 
GHC_INLINE int ghc::filesystem::detail::compare_simple_insensitive (const path::value_type *str1, size_t len1, const path::value_type *str2, size_t len2)
 
GHC_INLINE const char * ghc::filesystem::detail::strerror_adapter (char *gnu, char *)
 
GHC_INLINE const char * ghc::filesystem::detail::strerror_adapter (int posix, char *buffer)
 
template<typename ErrorNumber >
GHC_INLINE std::string ghc::filesystem::detail::systemErrorText (ErrorNumber code=0)
 
GHC_INLINE void ghc::filesystem::detail::create_symlink (const path &target_name, const path &new_symlink, bool, std::error_code &ec)
 
GHC_INLINE void ghc::filesystem::detail::create_hardlink (const path &target_name, const path &new_hardlink, std::error_code &ec)
 
template<typename T >
GHC_INLINE file_status ghc::filesystem::detail::file_status_from_st_mode (T mode)
 
GHC_INLINE path ghc::filesystem::detail::resolveSymlink (const path &p, std::error_code &ec)
 
GHC_INLINE bool ghc::filesystem::detail::is_not_found_error (std::error_code &ec)
 
GHC_INLINE file_status ghc::filesystem::detail::symlink_status_ex (const path &p, std::error_code &ec, uintmax_t *sz=nullptr, uintmax_t *nhl=nullptr, time_t *lwt=nullptr) noexcept
 
GHC_INLINE file_status ghc::filesystem::detail::status_ex (const path &p, std::error_code &ec, file_status *sls=nullptr, uintmax_t *sz=nullptr, uintmax_t *nhl=nullptr, time_t *lwt=nullptr, int recurse_count=0) noexcept
 

Macro Definition Documentation

◆ GHC_EXPAND_IMPL

#define GHC_EXPAND_IMPL

◆ GHC_FILESYSTEM_VERSION

#define GHC_FILESYSTEM_VERSION   10506L

◆ GHC_FS_API

#define GHC_FS_API

◆ GHC_FS_API_CLASS

#define GHC_FS_API_CLASS

◆ GHC_INLINE

#define GHC_INLINE   inline

◆ GHC_NATIVEWP

#define GHC_NATIVEWP (   p)    p.wstring().c_str()

◆ GHC_OS_DETECTED

#define GHC_OS_DETECTED

◆ GHC_PLATFORM_LITERAL

#define GHC_PLATFORM_LITERAL (   str)    str

◆ GHC_WIN_AUTO_PREFIX_LONG_PATH

#define GHC_WIN_AUTO_PREFIX_LONG_PATH

◆ LWG_2682_BEHAVIOUR

#define LWG_2682_BEHAVIOUR

◆ LWG_2936_BEHAVIOUR

#define LWG_2936_BEHAVIOUR

◆ LWG_2937_BEHAVIOUR

#define LWG_2937_BEHAVIOUR

◆ UTIME_OMIT

#define UTIME_OMIT   ((1l << 30) - 2l)