Skip to content

Commit

Permalink
[REFACT] Renamed func: info -> printInfo. Added wrapper: printBriefInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
hasherezade committed Sep 6, 2021
1 parent f5f4659 commit b4e934a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion demo/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ int main(int argc, char* argv[])
DemoParams params;
if (argc < 2) {
params.printBanner();
params.info(false);
params.printInfo(false);
return 0;
}
if (!params.parse(argc, argv)) {
Expand Down
16 changes: 11 additions & 5 deletions paramkit/include/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ namespace paramkit {
\param filter : display only parameters similar to the given string
\param isExtended : display extended info about each parameter
*/
void info(bool hilightMissing=false, const std::string &filter="", bool isExtended =true)
void printInfo(bool hilightMissing=false, const std::string &filter = "", bool isExtended = true)
{
std::cout << "---" << std::endl;
_info(true, hilightMissing, filter, isExtended);
Expand All @@ -133,6 +133,12 @@ namespace paramkit {
std::cout << "---" << std::endl;
}

//! Prints brief info about all the parameters.
void printBriefInfo()
{
printInfo(false, "", false);
}

//! Fills an IntParam defined by its name with the given value. If such parameter does not exist, or is not of the type IntParam, returns false. Otherwise returns true.
/**
\param paramName : a name of the parameter (of the type IntParam) that is to be filled
Expand Down Expand Up @@ -299,7 +305,7 @@ namespace paramkit {
else {
printUnknownParam(param_str);
print_in_color(HILIGHTED_COLOR, "Similar parameters:\n");
this->info(false, param_str, true);
this->printInfo(false, param_str, true);
return false;
}
}
Expand All @@ -308,7 +314,7 @@ namespace paramkit {
}
if (!this->hasRequiredFilled()) {
print_in_color(WARNING_COLOR, "Missing required parameters:\n");
this->info(true, "", true);
this->printInfo(true, "", true);
return false;
}
if (this->countCategory(true) == 0 && countFilled(false) == 0) {
Expand Down Expand Up @@ -408,7 +414,7 @@ namespace paramkit {
{
if (helpArg.empty()) {
this->printBanner();
this->info(false, "", shouldExpand);
this->printInfo(false, "", shouldExpand);
return false;
}
if (helpArg == PARAM_HELP1 || helpArg == PARAM_HELP2) {
Expand All @@ -426,7 +432,7 @@ namespace paramkit {
}
return true;
}
this->info(false, helpArg, shouldExpand);
this->printInfo(false, helpArg, shouldExpand);
return true;
}

Expand Down

0 comments on commit b4e934a

Please sign in to comment.