logic: switched to wstring in include processing

* this allows for non-ascii characters in detected include paths and in processed include directives.
This commit is contained in:
mlangkabel
2018-02-23 18:20:55 +01:00
parent 90efb11775
commit 0df32f239e
6 changed files with 40 additions and 30 deletions
-12
View File
@@ -474,16 +474,4 @@ namespace utility
return str.substr(0, size - 3) + L"...";
}
}
std::string substrBetween(const std::string &str, const std::string &delimiter1, const std::string &delimiter2)
{
size_t found_delimiter1 = str.find(delimiter1);
found_delimiter1 += delimiter1.length();
size_t found_delimiter2 = str.find(delimiter2,found_delimiter1);
if(found_delimiter1 != str.npos && found_delimiter2 != str.npos)
{
return str.substr(found_delimiter1, found_delimiter2-found_delimiter1);
}
return "";
}
}
+17 -1
View File
@@ -47,7 +47,8 @@ namespace utility
std::string substrAfter(const std::string& str, char delimiter);
std::string substrAfter(const std::string& str, const std::string& delimiter);
std::string substrBetween(const std::string& str, const std::string& delimiter1, const std::string& delimiter2);
template <typename StringType>
StringType substrBetween(const StringType& str, const StringType& delimiter1, const StringType& delimiter2);
template <typename StringType>
bool isPrefix(const StringType& prefix, const StringType& text);
@@ -157,6 +158,21 @@ namespace utility
return ss.str();
}
template <typename StringType>
StringType substrBetween(const StringType& str, const StringType& delimiter1, const StringType& delimiter2)
{
size_t found_delimiter1 = str.find(delimiter1);
found_delimiter1 += delimiter1.length();
size_t found_delimiter2 = str.find(delimiter2, found_delimiter1);
if (found_delimiter1 != str.npos && found_delimiter2 != str.npos)
{
return str.substr(found_delimiter1, found_delimiter2 - found_delimiter1);
}
return StringType();
}
template <typename StringType>
bool isPrefix(const StringType& prefix, const StringType& text)
{