Renamed private variables

This commit is contained in:
Leonetienne 2021-06-05 11:58:45 +02:00
parent 9abcd28b44
commit d6c1384991
3 changed files with 23 additions and 23 deletions

Binary file not shown.

View File

@ -144,14 +144,14 @@ void Hazelnupp::PopulateRawArgs(const int argc, const char* const* argv)
void Hazelnupp::ExpandAbbreviations() void Hazelnupp::ExpandAbbreviations()
{ {
// Abort if no abbreviations // Abort if no abbreviations
if (abbreviations.size() == 0) if (parameterAbreviations.size() == 0)
return; return;
for (std::string& arg : rawArgs) for (std::string& arg : rawArgs)
{ {
// Is arg registered as an abbreviation? // Is arg registered as an abbreviation?
auto abbr = abbreviations.find(arg); auto abbr = parameterAbreviations.find(arg);
if (abbr != abbreviations.end()) if (abbr != parameterAbreviations.end())
{ {
// Yes: replace arg with the long form // Yes: replace arg with the long form
arg = abbr->second; arg = abbr->second;
@ -382,7 +382,7 @@ std::string Hazelnupp::GenerateDocumentation() const
// Collect abbreviations // Collect abbreviations
// first value is abbreviation, second is long form // first value is abbreviation, second is long form
for (const auto& it : abbreviations) for (const auto& it : parameterAbreviations)
{ {
// Do we already have that param in the paramInfo set? // Do we already have that param in the paramInfo set?
if (paramInfos.find(it.second) == paramInfos.end()) if (paramInfos.find(it.second) == paramInfos.end())
@ -393,7 +393,7 @@ std::string Hazelnupp::GenerateDocumentation() const
} }
// Collect constraints // Collect constraints
for (const auto& it : constraints) for (const auto& it : parameterConstraints)
{ {
// Do we already have that param in the paramInfo set? // Do we already have that param in the paramInfo set?
if (paramInfos.find(it.first) == paramInfos.end()) if (paramInfos.find(it.first) == paramInfos.end())
@ -461,7 +461,7 @@ std::string Hazelnupp::GenerateDocumentation() const
void Hazelnupp::ApplyConstraints() void Hazelnupp::ApplyConstraints()
{ {
// Enforce required parameters / default values // Enforce required parameters / default values
for (const auto& pc : constraints) for (const auto& pc : parameterConstraints)
// Parameter in question is not supplied // Parameter in question is not supplied
if (!HasParam(pc.second.key)) if (!HasParam(pc.second.key))
{ {
@ -494,12 +494,12 @@ void Hazelnupp::ApplyConstraints()
ParamConstraint Hazelnupp::GetConstraint(const std::string& parameter) const ParamConstraint Hazelnupp::GetConstraint(const std::string& parameter) const
{ {
return constraints.find(parameter)->second; return parameterConstraints.find(parameter)->second;
} }
void Hazelnupp::ClearConstraint(const std::string& parameter) void Hazelnupp::ClearConstraint(const std::string& parameter)
{ {
constraints.erase(parameter); parameterConstraints.erase(parameter);
return; return;
} }
@ -519,7 +519,7 @@ const Value& Hazelnupp::operator[](const std::string& key) const
void Hazelnupp::RegisterAbbreviation(const std::string& abbrev, const std::string& target) void Hazelnupp::RegisterAbbreviation(const std::string& abbrev, const std::string& target)
{ {
abbreviations.insert(std::pair<std::string, std::string>(abbrev, target)); parameterAbreviations.insert(std::pair<std::string, std::string>(abbrev, target));
return; return;
} }
@ -528,39 +528,39 @@ std::string Hazelnupp::GetAbbreviation(const std::string& abbrev) const
if (!HasAbbreviation(abbrev)) if (!HasAbbreviation(abbrev))
return ""; return "";
return abbreviations.find(abbrev)->second; return parameterAbreviations.find(abbrev)->second;
} }
bool Hazelnupp::HasAbbreviation(const std::string& abbrev) const bool Hazelnupp::HasAbbreviation(const std::string& abbrev) const
{ {
return abbreviations.find(abbrev) != abbreviations.end(); return parameterAbreviations.find(abbrev) != parameterAbreviations.end();
} }
void Hazelnupp::ClearAbbreviation(const std::string& abbrevation) void Hazelnupp::ClearAbbreviation(const std::string& abbrevation)
{ {
abbreviations.erase(abbrevation); parameterAbreviations.erase(abbrevation);
return; return;
} }
void Hazelnupp::ClearAbbreviations() void Hazelnupp::ClearAbbreviations()
{ {
abbreviations.clear(); parameterAbreviations.clear();
return; return;
} }
void Hazelnupp::RegisterConstraints(const std::vector<ParamConstraint>& constraints) void Hazelnupp::RegisterConstraints(const std::vector<ParamConstraint>& parameterConstraints)
{ {
for (const ParamConstraint& pc : constraints) for (const ParamConstraint& pc : parameterConstraints)
{ {
// Does this constraint already exist? // Does this constraint already exist?
const auto constraint = this->constraints.find(pc.key); const auto constraint = this->parameterConstraints.find(pc.key);
// If yes, replace it. // If yes, replace it.
if (constraint != this->constraints.end()) if (constraint != this->parameterConstraints.end())
constraint->second = pc; constraint->second = pc;
// Else, create a new pair // Else, create a new pair
else else
this->constraints.insert(std::pair<std::string, ParamConstraint>( this->parameterConstraints.insert(std::pair<std::string, ParamConstraint>(
pc.key, pc.key,
pc pc
)); ));
@ -571,7 +571,7 @@ void Hazelnupp::RegisterConstraints(const std::vector<ParamConstraint>& constrai
void Hazelnupp::ClearConstraints() void Hazelnupp::ClearConstraints()
{ {
constraints.clear(); parameterConstraints.clear();
return; return;
} }
@ -583,9 +583,9 @@ void Hazelnupp::SetCrashOnFail(bool crashOnFail)
const ParamConstraint* Hazelnupp::GetConstraintForKey(const std::string& key) const const ParamConstraint* Hazelnupp::GetConstraintForKey(const std::string& key) const
{ {
const auto constraint = constraints.find(key); const auto constraint = parameterConstraints.find(key);
if (constraint == constraints.end()) if (constraint == parameterConstraints.end())
return nullptr; return nullptr;
return &constraint->second; return &constraint->second;

View File

@ -120,10 +120,10 @@ namespace Hazelnp
std::unordered_map<std::string, Parameter*> parameters; std::unordered_map<std::string, Parameter*> parameters;
//! These are abbreviations. Like, -f for --force. //! These are abbreviations. Like, -f for --force.
std::unordered_map<std::string, std::string> abbreviations; std::unordered_map<std::string, std::string> parameterAbreviations;
//! Parameter constraints, mapped to keys //! Parameter constraints, mapped to keys
std::unordered_map<std::string, ParamConstraint> constraints; std::unordered_map<std::string, ParamConstraint> parameterConstraints;
//! Raw argv //! Raw argv
std::vector<std::string> rawArgs; std::vector<std::string> rawArgs;