From 6c5828822c7602090cc55629b9b7e973388baaf3 Mon Sep 17 00:00:00 2001 From: Denis Krjuchkov Date: Tue, 3 Dec 2013 12:16:53 +0600 Subject: fs/AllocatedPath.hxx: add FromFS(std::string) method --- src/fs/AllocatedPath.hxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/fs/AllocatedPath.hxx b/src/fs/AllocatedPath.hxx index 94da284c8..502f30d17 100644 --- a/src/fs/AllocatedPath.hxx +++ b/src/fs/AllocatedPath.hxx @@ -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. -- cgit v1.2.3