[BW]: [NIP] Support for unicode paths to avoid problems while accessing paths containing native characters.

This commit is contained in:
vogel76 2014-01-09 13:29:08 +01:00
parent 08ab455dff
commit 6261a25442
2 changed files with 26 additions and 7 deletions

View file

@ -30,6 +30,8 @@ namespace fc {
~path(); ~path();
path( const boost::filesystem::path& ); path( const boost::filesystem::path& );
path( const fc::string& p ); path( const fc::string& p );
/// Constructor to build path using unicode native characters.
path(const std::wstring& p);
path( const char* ); path( const char* );
path( const path& p ); path( const path& p );
path( path&& p ); path( path&& p );
@ -45,13 +47,16 @@ namespace fc {
operator boost::filesystem::path& (); operator boost::filesystem::path& ();
operator const boost::filesystem::path& ()const; operator const boost::filesystem::path& ()const;
void replace_extension( const fc::path& e ); void replace_extension( const fc::path& e );
fc::path stem()const; fc::path stem()const;
fc::path extension()const; fc::path extension()const;
fc::path filename()const; fc::path filename()const;
fc::path parent_path()const; fc::path parent_path()const;
fc::string string()const; fc::string string()const;
fc::string generic_string()const; fc::string generic_string()const;
std::wstring wstring() const;
std::wstring generic_wstring() const;
/** /**
* @brief replaces '/' with '\' in the result of generic_string() * @brief replaces '/' with '\' in the result of generic_string()

View file

@ -29,6 +29,9 @@ namespace fc {
path::path( const fc::string& p ) path::path( const fc::string& p )
:_p(p.c_str()){} :_p(p.c_str()){}
path::path(const std::wstring& p)
:_p(p) {}
path::path( const path& p ) path::path( const path& p )
:_p(p){} :_p(p){}
@ -67,6 +70,17 @@ namespace fc {
fc::string path::generic_string()const { fc::string path::generic_string()const {
return _p->generic_string(); return _p->generic_string();
} }
std::wstring path::wstring() const
{
return _p->wstring();
}
std::wstring path::generic_wstring() const
{
return _p->generic_wstring();
}
/** /**
* @todo use iterators instead of indexes for * @todo use iterators instead of indexes for
* faster performance * faster performance