BitShares-Core  4.0.0
BitShares blockchain implementation and command-line interface software
Public Member Functions | Static Public Attributes | Friends | List of all members
fc::path Class Reference

wraps boost::filesystem::path to provide platform independent path manipulation. More...

#include <filesystem.hpp>

Public Member Functions

 path ()
 
 ~path ()
 
 path (const boost::filesystem::path &)
 
 path (const std::string &p)
 
 path (const std::wstring &p)
 Constructor to build path using unicode native characters. More...
 
 path (const char *)
 
 path (const path &p)
 
 path (path &&p)
 
pathoperator= (const path &)
 
pathoperator= (path &&)
 
pathoperator/= (const fc::path &)
 
void replace_extension (const fc::path &e)
 
fc::path stem () const
 
fc::path extension () const
 
fc::path filename () const
 
fc::path parent_path () const
 
std::string string () const
 
std::string generic_string () const
 
std::string preferred_string () const
 
std::wstring wstring () const
 
std::wstring generic_wstring () const
 
std::wstring preferred_wstring () const
 
std::string to_native_ansi_path () const
 
std::string windows_string () const
 replaces '/' with '\' in the result of generic_string() More...
 
bool is_relative () const
 
bool is_absolute () const
 

Static Public Attributes

static char separator_char = static_cast<char>(boost::filesystem::path("/").make_preferred().native()[0])
 

Friends

path operator/ (const fc::path &p, const fc::path &)
 
bool operator== (const fc::path &p, const fc::path &)
 
bool operator!= (const fc::path &p, const fc::path &)
 
bool operator< (const fc::path &p, const fc::path &)
 

Detailed Description

wraps boost::filesystem::path to provide platform independent path manipulation.

Most calls are simply a passthrough to boost::filesystem::path, however exceptions are wrapped in an fc::error_report and the additional helper method fc::path::windows_string(), can be used to calculate paths intended for systems different than the host.

Note
Serializes to a fc::value() as the result of generic_string()

Definition at line 28 of file filesystem.hpp.

Constructor & Destructor Documentation

fc::path::path ( )

Definition at line 47 of file filesystem.cpp.

fc::path::~path ( )

Definition at line 48 of file filesystem.cpp.

fc::path::path ( const boost::filesystem::path &  p)

Definition at line 49 of file filesystem.cpp.

fc::path::path ( const std::string &  p)

Definition at line 54 of file filesystem.cpp.

fc::path::path ( const std::wstring &  p)

Constructor to build path using unicode native characters.

Definition at line 57 of file filesystem.cpp.

fc::path::path ( const char *  p)

Definition at line 52 of file filesystem.cpp.

fc::path::path ( const path p)

Definition at line 60 of file filesystem.cpp.

fc::path::path ( path &&  p)

Definition at line 63 of file filesystem.cpp.

Member Function Documentation

fc::path fc::path::extension ( ) const

Definition at line 157 of file filesystem.cpp.

fc::path fc::path::filename ( ) const

Definition at line 151 of file filesystem.cpp.

std::string fc::path::generic_string ( ) const

Definition at line 95 of file filesystem.cpp.

std::wstring fc::path::generic_wstring ( ) const

Definition at line 109 of file filesystem.cpp.

bool fc::path::is_absolute ( ) const

Definition at line 167 of file filesystem.cpp.

bool fc::path::is_relative ( ) const

Definition at line 166 of file filesystem.cpp.

path & fc::path::operator/= ( const fc::path p)

Definition at line 79 of file filesystem.cpp.

path & fc::path::operator= ( const path p)

Definition at line 66 of file filesystem.cpp.

path & fc::path::operator= ( path &&  p)

Definition at line 70 of file filesystem.cpp.

fc::path fc::path::parent_path ( ) const

Definition at line 163 of file filesystem.cpp.

std::string fc::path::preferred_string ( ) const

On windows, returns a path where all path separators are '\' suitable for displaying to users. On other platforms, it does the same as generic_string()

Definition at line 99 of file filesystem.cpp.

std::wstring fc::path::preferred_wstring ( ) const

Definition at line 114 of file filesystem.cpp.

void fc::path::replace_extension ( const fc::path e)

Definition at line 154 of file filesystem.cpp.

fc::path fc::path::stem ( ) const

Definition at line 160 of file filesystem.cpp.

std::string fc::path::string ( ) const

Definition at line 148 of file filesystem.cpp.

std::string fc::path::to_native_ansi_path ( ) const

Retrieves native string path representation and next converts it into ANSI UTF-8 representation. It is needed since not all parts of fc library accept unicode paths (fc::file_mapping).

Definition at line 119 of file filesystem.cpp.

std::string fc::path::windows_string ( ) const

replaces '/' with '\' in the result of generic_string()

Note
not part of boost::filesystem::path
Todo:
use iterators instead of indexes for faster performance

Definition at line 142 of file filesystem.cpp.

std::wstring fc::path::wstring ( ) const

Definition at line 104 of file filesystem.cpp.

Friends And Related Function Documentation

bool operator!= ( const fc::path p,
const fc::path r 
)
friend

Definition at line 77 of file filesystem.cpp.

path operator/ ( const fc::path p,
const fc::path o 
)
friend

Definition at line 83 of file filesystem.cpp.

bool operator< ( const fc::path p,
const fc::path r 
)
friend

Definition at line 75 of file filesystem.cpp.

bool operator== ( const fc::path p,
const fc::path r 
)
friend

Definition at line 76 of file filesystem.cpp.

Member Data Documentation

char fc::path::separator_char = static_cast<char>(boost::filesystem::path("/").make_preferred().native()[0])
static

Definition at line 84 of file filesystem.hpp.


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