diff options
-rw-r--r-- | libbutl/project-name.cxx | 18 | ||||
-rw-r--r-- | libbutl/project-name.mxx | 4 |
2 files changed, 3 insertions, 19 deletions
diff --git a/libbutl/project-name.cxx b/libbutl/project-name.cxx index 4c04e5f..a1767e9 100644 --- a/libbutl/project-name.cxx +++ b/libbutl/project-name.cxx @@ -10,8 +10,7 @@ #include <string> #include <vector> #include <utility> // move() -#include <iterator> // back_inserter -#include <algorithm> // find(), transform() +#include <algorithm> // find() #include <stdexcept> // invalid_argument #endif @@ -103,19 +102,4 @@ namespace butl size_t p (path::traits_type::find_extension (value_)); return p != string::npos ? string (value_, p + 1) : string (); } - - string project_name:: - variable () const - { - using std::string; - - auto sanitize = [] (char c) - { - return (c == '-' || c == '+' || c == '.') ? '_' : c; - }; - - string r; - transform (value_.begin (), value_.end (), back_inserter (r), sanitize); - return r; - } } diff --git a/libbutl/project-name.mxx b/libbutl/project-name.mxx index 65ba2ba..5f5a586 100644 --- a/libbutl/project-name.mxx +++ b/libbutl/project-name.mxx @@ -22,7 +22,7 @@ export module butl.project_name; import std.core; import std.io; #endif -import butl.utility; // casecmp() +import butl.utility; // casecmp(), sanitize_identifier() #else #include <libbutl/utility.mxx> #endif @@ -93,7 +93,7 @@ LIBBUTL_MODEXPORT namespace butl // '.', '-', and '+' are replaced with '_'. // std::string - variable () const; + variable () const {return sanitize_identifier (value_);} // Compare ignoring case. Note that a string is not checked to be a valid // project name. |