fs/AllocatedPath.hxx: add FromFS(std::string) method

This commit is contained in:
Denis Krjuchkov 2013-12-03 12:16:53 +06:00
parent 9dd824ba50
commit 6c5828822c

View File

@ -54,6 +54,8 @@ class AllocatedPath {
AllocatedPath(const_pointer _value):value(_value) {}
AllocatedPath(string &&_value):value(_value) {}
public:
/**
* Copy a #AllocatedPath object.
@ -114,6 +116,15 @@ public:
return AllocatedPath(fs);
}
/**
* Convert a C++ string that is already in the filesystem
* character set to a #Path instance.
*/
gcc_pure
static AllocatedPath FromFS(string &&fs) {
return AllocatedPath(std::move(fs));
}
/**
* Convert a UTF-8 C string to a #AllocatedPath instance.
* Returns return a "nulled" instance on error.