fs/AllocatedPath: add FromFS() with pointer range

This commit is contained in:
Max Kellermann 2016-04-21 14:20:41 +02:00
parent 11ea72e240
commit 7530770842
1 changed files with 9 additions and 0 deletions

View File

@ -48,6 +48,9 @@ class AllocatedPath {
AllocatedPath(std::nullptr_t):value() {}
explicit AllocatedPath(const_pointer_type _value):value(_value) {}
AllocatedPath(const_pointer_type _begin, const_pointer_type _end)
:value(_begin, _end) {}
AllocatedPath(string &&_value):value(std::move(_value)) {}
static AllocatedPath Build(const_pointer_type a, size_t a_size,
@ -132,6 +135,12 @@ public:
return AllocatedPath(fs);
}
gcc_pure
static AllocatedPath FromFS(const_pointer_type _begin,
const_pointer_type _end) {
return AllocatedPath(_begin, _end);
}
/**
* Convert a C++ string that is already in the filesystem
* character set to a #Path instance.