16 using namespace HCE::exception;
31 std::vector<WordPos> ret;
32 std::map<unsigned int, WordPos> resultingMap;
33 std::map<unsigned int, WordPos>::iterator resultingMapIt;
34 if(wordOffsetMaps.size() > 0)
36 resultingMap = wordOffsetMaps[0];
37 for(
unsigned int i = 1; i < wordOffsetMaps.size(); i++)
39 for(
auto it = wordOffsetMaps[i].begin(); it != wordOffsetMaps[i].end(); ++it)
41 if(it->first != it->second.beginOffset)
45 if((resultingMapIt = resultingMap.find(it->first)) != resultingMap.end())
47 if(resultingMapIt->second.endOffset < it->second.endOffset)
49 resultingMapIt->second.endOffset = it->second.endOffset;
54 resultingMap.insert(std::pair<unsigned int, WordPos>(it->first, it->second));
68 if(!resultingMap.empty())
70 ret.push_back(resultingMap.begin()->second);
71 unsigned int retIndex = 1;
72 auto it = resultingMap.begin();
74 for(; it != resultingMap.end(); ++it)
76 if(it->second.beginOffset <= ret[retIndex - 1].endOffset)
78 if(it->second.endOffset > ret[retIndex - 1].endOffset)
80 ret[retIndex - 1].endOffset = it->second.endOffset;
85 ret.push_back(it->second);
107 std::vector<std::map<unsigned int, WordPos> > wordOffsetMaps;
108 for(
unsigned int i = 0; i < vecSearchStrings.size(); i++)
110 if(vecSearchStrings[i].empty())
116 std::string exceptionString =
"Here no highlight Algorithm for [" + std::to_string(i) +
"] Search string";
119 std::map<unsigned int, WordPos> wordOffsetMap;
121 wordOffsetMaps.push_back(wordOffsetMap);