diff --git a/Hazelnupp.vpp b/Hazelnupp.vpp index 772a7f4..0652e27 100644 Binary files a/Hazelnupp.vpp and b/Hazelnupp.vpp differ diff --git a/Hazelnupp/Hazelnupp.cpp b/Hazelnupp/Hazelnupp.cpp index 0595dbc..2f6a0b2 100644 --- a/Hazelnupp/Hazelnupp.cpp +++ b/Hazelnupp/Hazelnupp.cpp @@ -144,14 +144,14 @@ void Hazelnupp::PopulateRawArgs(const int argc, const char* const* argv) void Hazelnupp::ExpandAbbreviations() { // Abort if no abbreviations - if (abbreviations.size() == 0) + if (parameterAbreviations.size() == 0) return; for (std::string& arg : rawArgs) { // Is arg registered as an abbreviation? - auto abbr = abbreviations.find(arg); - if (abbr != abbreviations.end()) + auto abbr = parameterAbreviations.find(arg); + if (abbr != parameterAbreviations.end()) { // Yes: replace arg with the long form arg = abbr->second; @@ -382,7 +382,7 @@ std::string Hazelnupp::GenerateDocumentation() const // Collect abbreviations // 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? if (paramInfos.find(it.second) == paramInfos.end()) @@ -393,7 +393,7 @@ std::string Hazelnupp::GenerateDocumentation() const } // Collect constraints - for (const auto& it : constraints) + for (const auto& it : parameterConstraints) { // Do we already have that param in the paramInfo set? if (paramInfos.find(it.first) == paramInfos.end()) @@ -461,7 +461,7 @@ std::string Hazelnupp::GenerateDocumentation() const void Hazelnupp::ApplyConstraints() { // Enforce required parameters / default values - for (const auto& pc : constraints) + for (const auto& pc : parameterConstraints) // Parameter in question is not supplied if (!HasParam(pc.second.key)) { @@ -494,12 +494,12 @@ void Hazelnupp::ApplyConstraints() 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) { - constraints.erase(parameter); + parameterConstraints.erase(parameter); 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) { - abbreviations.insert(std::pair(abbrev, target)); + parameterAbreviations.insert(std::pair(abbrev, target)); return; } @@ -528,39 +528,39 @@ std::string Hazelnupp::GetAbbreviation(const std::string& abbrev) const if (!HasAbbreviation(abbrev)) return ""; - return abbreviations.find(abbrev)->second; + return parameterAbreviations.find(abbrev)->second; } 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) { - abbreviations.erase(abbrevation); + parameterAbreviations.erase(abbrevation); return; } void Hazelnupp::ClearAbbreviations() { - abbreviations.clear(); + parameterAbreviations.clear(); return; } -void Hazelnupp::RegisterConstraints(const std::vector& constraints) +void Hazelnupp::RegisterConstraints(const std::vector& parameterConstraints) { - for (const ParamConstraint& pc : constraints) + for (const ParamConstraint& pc : parameterConstraints) { // 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 (constraint != this->constraints.end()) + if (constraint != this->parameterConstraints.end()) constraint->second = pc; // Else, create a new pair else - this->constraints.insert(std::pair( + this->parameterConstraints.insert(std::pair( pc.key, pc )); @@ -571,7 +571,7 @@ void Hazelnupp::RegisterConstraints(const std::vector& constrai void Hazelnupp::ClearConstraints() { - constraints.clear(); + parameterConstraints.clear(); return; } @@ -583,9 +583,9 @@ void Hazelnupp::SetCrashOnFail(bool crashOnFail) 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 &constraint->second; diff --git a/Hazelnupp/Hazelnupp.h b/Hazelnupp/Hazelnupp.h index ca93e02..bd957e0 100644 --- a/Hazelnupp/Hazelnupp.h +++ b/Hazelnupp/Hazelnupp.h @@ -120,10 +120,10 @@ namespace Hazelnp std::unordered_map parameters; //! These are abbreviations. Like, -f for --force. - std::unordered_map abbreviations; + std::unordered_map parameterAbreviations; //! Parameter constraints, mapped to keys - std::unordered_map constraints; + std::unordered_map parameterConstraints; //! Raw argv std::vector rawArgs;