improved query - added search in specific modlist in LocalModList and QueryAction
parent
bdf849156c
commit
5c4820ef8c
|
@ -224,6 +224,16 @@ LocalModDescription LocalModList::getModDescriptionByName(std::string name) {
|
|||
return emptylmd;
|
||||
}
|
||||
|
||||
LocalModDescription LocalModList::getModDescriptionByNameFrom(std::string name, std::string remoteModlist) {
|
||||
for(unsigned int i = 0; i < _modlist.size(); i++) {
|
||||
if(_modlist[i].getName() == name && _modlist[i].getRemoteModlistName() == remoteModlist) {
|
||||
return _modlist[i];
|
||||
}
|
||||
}
|
||||
LocalModDescription emptylmd;
|
||||
return emptylmd;
|
||||
}
|
||||
|
||||
void LocalModList::resetModDescriptionIterator() {
|
||||
if(_modlistAtEnd) {
|
||||
_modlistAtEnd = false;
|
||||
|
|
|
@ -34,6 +34,10 @@ public:
|
|||
LocalModDescription getModDescriptionByName(std::string name); ///< \brief A function, that searches a mod name and returns its description.
|
||||
///< \param name A mod name.
|
||||
///< \return Description of the mod.
|
||||
LocalModDescription getModDescriptionByNameFrom(std::string name, std::string remoteModlist); ///< \brief A function, that searches a mod name in given remote modlist and returns its description.
|
||||
///< \param name A mod name.
|
||||
///< \param remoteModlist A name of remote modlist to search in.
|
||||
///< \return Description of the mod.
|
||||
void resetModDescriptionIterator(); ///< A function that resets iterator of the modlist.
|
||||
bool modDescriptionsAtEnd(); ///< \brief A function that returns if the modlist iterator has reached its end.
|
||||
///< \return True if modlist iterator is at end, false otherwise.
|
||||
|
|
|
@ -89,7 +89,22 @@ void QueryAction::run() {
|
|||
}
|
||||
} else {
|
||||
for(unsigned int i = 0; i < parameters.size(); i++) {
|
||||
mmm::LocalModDescription lmd = lml.getModDescriptionByName(parameters[i]);
|
||||
mmm::LocalModDescription lmd;
|
||||
std::string modname = "";
|
||||
std::string modlistname = "";
|
||||
for(unsigned int j = 0; j < parameters[i].length(); j++) {
|
||||
if(parameters[i][j] == '/') {
|
||||
modlistname = modname;
|
||||
modname = "";
|
||||
} else {
|
||||
modname += parameters[i][j];
|
||||
}
|
||||
}
|
||||
if(modlistname == "") {
|
||||
lmd = lml.getModDescriptionByName(modname);
|
||||
} else {
|
||||
lmd = lml.getModDescriptionByNameFrom(modname, modlistname);
|
||||
}
|
||||
if(lmd.getName() != "" && lmd.getReleaseNr() > 0 && lmd.getDescription() != "" && lmd.getRemoteModlistName() != "") {
|
||||
std::cout << lmd.getRemoteModlistName() << "/" << lmd.getName() << " (release: " << lmd.getReleaseNr() << ")";
|
||||
if(repoinfook) {
|
||||
|
@ -115,7 +130,11 @@ void QueryAction::run() {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
std::cout << parameters[i] << " not found!" << std::endl;
|
||||
if(modlistname == "") {
|
||||
std::cout << modname << " not found!" << std::endl;
|
||||
} else {
|
||||
std::cout << modname << " not found in " << modlistname << "!" << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue