logic: replace template arguments with .. in non-indexed nodes to reduce clutter in search results

This commit is contained in:
Eberhard Graether
2017-09-05 22:35:54 +02:00
parent 919e3ad0cb
commit ea08c8c730
4 changed files with 56 additions and 7 deletions
+4 -2
View File
@@ -1,6 +1,10 @@
#ifndef TRACING_H
#define TRACING_H
// #define TRACING_ENABLED
#include <mutex>
#include <stack>
#include <thread>
@@ -67,8 +71,6 @@ private:
};
// #define TRACING_ENABLED
#ifdef TRACING_ENABLED
#define TRACE(__name__) \
ScopedTrace __trace__(std::string(__name__), __FILE__, __LINE__, __FUNCTION__)
+32
View File
@@ -215,6 +215,38 @@ namespace utility
return str;
}
std::string replaceBetween(const std::string& str, char startDelimiter, char endDelimiter, const std::string& to)
{
size_t startPos = str.find(startDelimiter);
if (startPos == std::string::npos)
{
return str;
}
size_t depth = 1;
for (size_t pos = startPos + 1; pos < str.size(); pos++)
{
if (str[pos] == endDelimiter && depth)
{
depth--;
if (depth == 0)
{
std::string end = replaceBetween(str.substr(pos + 1), startDelimiter, endDelimiter, to);
return str.substr(0, startPos) + startDelimiter + to + endDelimiter + end;
}
}
if (str[pos] == startDelimiter)
{
depth++;
}
}
return str;
}
std::string insertLineBreaksAtBlankSpaces(const std::string& s, size_t maxLineLength)
{
const std::vector<std::string> atoms = splitToVector(s, " ");
+1
View File
@@ -45,6 +45,7 @@ namespace utility
bool equalsCaseInsensitive(const std::string& a, const std::string& b);
std::string replace(std::string str, const std::string& from, const std::string& to);
std::string replaceBetween(const std::string& str, char startDelimiter, char endDelimiter, const std::string& to);
std::string insertLineBreaksAtBlankSpaces(const std::string& s, size_t maxLineLength);
std::string breakSignature(