nomlib
Loading...
Searching...
No Matches
nom::filesystem::path Class Reference

A C++14 reimplementation of the path abstraction described in ISO/IEC TS 18822:2015 (N4100) / Boost.Filesystem. More...

#include <filesystem.hpp>

Classes

class  iterator

Public Types

using value_type = char
using string_type = std::string

Public Member Functions

 path (const path &other)
 path (path &&other) noexcept
 path (const string_type &source)
 path (const char *source)
path & operator= (const path &other)
path & operator= (path &&other) noexcept
path & operator= (const string_type &source)
path & operator= (const char *source)
path & assign (const string_type &source)
path & operator/= (const path &other)
path & operator/= (const string_type &source)
path & operator/= (const char *source)
path & operator+= (const path &other)
path & operator+= (const string_type &source)
path & operator+= (const char *source)
void clear () noexcept
path & make_preferred ()
 Convert any directory separators to the platform's preferred separator in-place and return this path.
path lexically_normal () const
 Return a normalized copy of this path.
const string_type & native () const
 Return the path in the platform's native format.
const value_type * c_str () const
 Return a NUL-terminated C-string in native format.
string_type string () const
 Convenience alias for native().
string_type generic_string () const
 For nomlib, generic and native strings are interchangeable.
iterator begin () const
iterator end () const
Decomposition
path root_name () const
path root_directory () const
path root_path () const
path relative_path () const
path parent_path () const
path filename () const
path stem () const
path extension () const
Queries
bool has_root_name () const
bool has_root_directory () const
bool has_root_path () const
bool has_relative_path () const
bool has_parent_path () const
bool has_filename () const
bool has_stem () const
bool has_extension () const
bool is_absolute () const
bool is_relative () const
bool empty () const

Static Public Attributes

static const value_type preferred_separator

Private Member Functions

void parse (const string_type &source)
void normalize ()
void invalidate_cache () const
void rebuild_cache () const
std::vector< path > path_elements () const
 Break the path into its iteration elements (root-name, root-directory, and each path component).

Private Attributes

string_type native_pathname_
bool dirty_
string_type root_name_
bool has_root_directory_
bool absolute_
std::vector< string_type > components_
bool has_trailing_separator_

UTF-8 / UTF-16 / Wide string conversions

using u8string_type = std::string
using u16string_type = std::u16string
 path (const u16string_type &source)
 path (const std::wstring &source)
path & operator= (const u16string_type &source)
path & operator= (const std::wstring &source)
path & assign (const u16string_type &source)
path & assign (const std::wstring &source)
u8string_type u8string () const
 Return the path encoded as UTF-8.
u16string_type u16string () const
 Return the path encoded as UTF-16.
std::wstring wstring () const
 Return the path as a wide-character string.
u8string_type generic_u8string () const
 Generic-string alias for u8string().
u16string_type generic_u16string () const
 Generic-string alias for u16string().
std::wstring generic_wstring () const
 Generic-string alias for wstring().

Detailed Description

A C++14 reimplementation of the path abstraction described in ISO/IEC TS 18822:2015 (N4100) / Boost.Filesystem.

Objects of this class represent a path syntactically; they do not require the path to exist on the filesystem. Operations are modeled on the generic pathname grammar, with platform-specific adjustments for Windows root-names and preferred separators.

Definition at line 53 of file filesystem.hpp.

Member Typedef Documentation

◆ string_type

using nom::filesystem::path::string_type = std::string

Definition at line 57 of file filesystem.hpp.

◆ u16string_type

using nom::filesystem::path::u16string_type = std::u16string

Definition at line 146 of file filesystem.hpp.

◆ u8string_type

using nom::filesystem::path::u8string_type = std::string

Definition at line 145 of file filesystem.hpp.

◆ value_type

using nom::filesystem::path::value_type = char

Definition at line 56 of file filesystem.hpp.

Member Function Documentation

◆ lexically_normal()

path nom::filesystem::path::lexically_normal ( ) const

Return a normalized copy of this path.

Collapses redundant separators, removes '.' components, and applies '..' components lexically. The result does not consult the filesystem.

Member Data Documentation

◆ absolute_

bool nom::filesystem::path::absolute_
private

Definition at line 220 of file filesystem.hpp.

◆ components_

std::vector<string_type> nom::filesystem::path::components_
private

Definition at line 221 of file filesystem.hpp.

◆ dirty_

bool nom::filesystem::path::dirty_
mutableprivate

Definition at line 216 of file filesystem.hpp.

◆ has_root_directory_

bool nom::filesystem::path::has_root_directory_
private

Definition at line 219 of file filesystem.hpp.

◆ has_trailing_separator_

bool nom::filesystem::path::has_trailing_separator_
private

Definition at line 222 of file filesystem.hpp.

◆ native_pathname_

string_type nom::filesystem::path::native_pathname_
mutableprivate

Definition at line 215 of file filesystem.hpp.

◆ preferred_separator

const value_type nom::filesystem::path::preferred_separator
static

Definition at line 62 of file filesystem.hpp.

◆ root_name_

string_type nom::filesystem::path::root_name_
private

Definition at line 218 of file filesystem.hpp.


The documentation for this class was generated from the following file: