mirror of
https://github.com/wiiu-env/launchiine.git
synced 2024-11-22 09:49:17 +01:00
Implemeting filterting of the game list
This commit is contained in:
parent
6e041490d6
commit
25a0aa54e7
@ -177,10 +177,9 @@ void GameList::updateTitleInfo() {
|
|||||||
void GameList::internalFilterList(std::vector<gameInfo*> &fullList) {
|
void GameList::internalFilterList(std::vector<gameInfo*> &fullList) {
|
||||||
for (uint32_t i = 0; i < fullList.size(); ++i) {
|
for (uint32_t i = 0; i < fullList.size(); ++i) {
|
||||||
gameInfo *header = fullList[i];
|
gameInfo *header = fullList[i];
|
||||||
|
if (StringTools::findStringIC(header->name,gameFilter)) {
|
||||||
//! TODO: do filtering as needed
|
filteredList.push_back(header);
|
||||||
|
}
|
||||||
filteredList.push_back(header);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,3 +209,13 @@ std::vector<std::string> StringTools::stringSplit(const std::string & inValue, c
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool StringTools::findStringIC(const std::string & strHaystack, const std::string & strNeedle)
|
||||||
|
{
|
||||||
|
auto it = std::search(
|
||||||
|
strHaystack.begin(), strHaystack.end(),
|
||||||
|
strNeedle.begin(), strNeedle.end(),
|
||||||
|
[](char ch1, char ch2) { return std::toupper(ch1) == std::toupper(ch2); }
|
||||||
|
);
|
||||||
|
return (it != strHaystack.end() );
|
||||||
|
}
|
||||||
|
@ -29,6 +29,8 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <wut_types.h>
|
#include <wut_types.h>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cctype>
|
||||||
|
|
||||||
class StringTools {
|
class StringTools {
|
||||||
public:
|
public:
|
||||||
@ -74,6 +76,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static std::vector<std::string> stringSplit(const std::string & value, const std::string & splitter);
|
static std::vector<std::string> stringSplit(const std::string & value, const std::string & splitter);
|
||||||
|
|
||||||
|
// https://stackoverflow.com/a/19839371
|
||||||
|
static bool findStringIC(const std::string & strHaystack, const std::string & strNeedle);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __STRING_TOOLS_H */
|
#endif /* __STRING_TOOLS_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user