logic: Fixed issues in tutorial
* increased gap in code_tutorial_3.h so that next comment is not already visible * Fixed SearchMatch sorting to not loose matches with same name but different namespace
This commit is contained in:
@@ -8,15 +8,15 @@
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// 6 - SNIPPETS AND FILES
|
||||
// It looks like this function is called in two different places inside the
|
||||
// same file. When two different snippets are located in the same file they
|
||||
// share a single file box. The line numbers to the left indicate where each of
|
||||
// It looks like this function is called in two different places inside the
|
||||
// same file. When two different snippets are located in the same file they
|
||||
// share a single file box. The line numbers to the left indicate where each of
|
||||
// these snippets is located inside the file.
|
||||
//
|
||||
// 7 - MERGING SNIPPETS
|
||||
// The top line of each snippet shows the name of its own parent's scope.
|
||||
// If you want to show the lines in between the two snippets below you can
|
||||
// either expand the upper snippet's scope to show the whole file or you can
|
||||
// If you want to show the lines in between the two snippets below you can
|
||||
// either expand the upper snippet's scope to show the whole file or you can
|
||||
// tell the lower snippet to reveal its scope.
|
||||
// Try one of these approaches now.
|
||||
//
|
||||
@@ -27,6 +27,7 @@ void function_with_snippets()
|
||||
unrelated_but_very_important();
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// 8 - YOU FOUND THE HIDDEN COMMENT
|
||||
@@ -45,8 +46,8 @@ void function_with_snippets()
|
||||
// to the central hub.
|
||||
//
|
||||
// P.S.
|
||||
// You can also click the file name above (i guess you need to scroll up a
|
||||
// little bit) to activate the file's node in case you want to explore your
|
||||
// You can also click the file name above (i guess you need to scroll up a
|
||||
// little bit) to activate the file's node in case you want to explore your
|
||||
// include hierarchy.
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
@@ -117,31 +117,39 @@ bool SearchMatch::operator<(const SearchMatch& other) const
|
||||
return false;
|
||||
}
|
||||
|
||||
const std::string* str = &text;
|
||||
const std::string* otherStr = &other.text;
|
||||
if (*str == *otherStr)
|
||||
{
|
||||
str = &name;
|
||||
otherStr = &other.name;
|
||||
}
|
||||
|
||||
// text size
|
||||
if (text.size() < other.text.size())
|
||||
if (str->size() < otherStr->size())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (text.size() > other.text.size())
|
||||
else if (str->size() > otherStr->size())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// lower case
|
||||
for (size_t i = 0; i < text.size(); i++)
|
||||
for (size_t i = 0; i < str->size(); i++)
|
||||
{
|
||||
if (tolower(text[i]) != tolower(other.text[i]))
|
||||
if (tolower(str->at(i)) != tolower(otherStr->at(i)))
|
||||
{
|
||||
return tolower(text[i]) < tolower(other.text[i]);
|
||||
return tolower(str->at(i)) < tolower(otherStr->at(i));
|
||||
}
|
||||
else
|
||||
{
|
||||
// alphabetical
|
||||
if (text[i] < other.text[i])
|
||||
if (str->at(i) < otherStr->at(i))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if (text[i] > other.text[i])
|
||||
else if (str->at(i) > otherStr->at(i))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user