logic: add storage transformation to merge anonymous types and the respective typedef

* moved storage related classes to data/storage folder
* implemented recording c++ unions as NODE_UNION instead of just using NODE_TYPE
* added transformation to merge anonymous classes/structs/enums/unions and typedef nodes
* added tests for this transformation
* added setting for enabling/disabling this transformation
This commit is contained in:
malte_langkabel
2017-07-18 15:14:43 +02:00
parent e536f20e36
commit cad595a32c
76 changed files with 524 additions and 96 deletions
+20
View File
@@ -110,6 +110,16 @@ namespace utility
return str;
}
std::string substrBeforeFirst(const std::string& str, const std::string& delimiter)
{
size_t pos = str.find(delimiter);
if (pos != std::string::npos)
{
return str.substr(0, pos);
}
return str;
}
std::string substrBeforeLast(const std::string& str, char delimiter)
{
size_t pos = str.rfind(delimiter);
@@ -130,6 +140,16 @@ namespace utility
return str;
}
std::string substrAfter(const std::string& str, const std::string& delimiter)
{
size_t pos = str.find(delimiter);
if (pos != std::string::npos)
{
return str.substr(pos + delimiter.size(), str.size());
}
return str;
}
bool isPrefix(const std::string& prefix, const std::string& text)
{
if (prefix.size() <= text.size())
+2
View File
@@ -30,8 +30,10 @@ namespace utility
std::deque<std::string> tokenize(const std::deque<std::string>& list, const std::string& delimiter);
std::string substrBeforeFirst(const std::string& str, char delimiter);
std::string substrBeforeFirst(const std::string& str, const std::string& delimiter);
std::string substrBeforeLast(const std::string& str, char delimiter);
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);