MCPcopy Create free account
hub / github.com/catboost/catboost / Validate

Method Validate

library/cpp/getopt/small/last_getopt_opts.cpp:189–219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187 }
188
189 void TOpts::Validate() const {
190 for (TOptsVector::const_iterator i = Opts_.begin(); i != Opts_.end(); ++i) {
191 TOpt* opt = i->Get();
192 const TOpt::TShortNames& shortNames = opt->GetShortNames();
193 for (auto c : shortNames) {
194 for (TOptsVector::const_iterator j = i + 1; j != Opts_.end(); ++j) {
195 TOpt* nextOpt = j->Get();
196 if (nextOpt->CharIs(c))
197 ythrow TConfException() << "option "
198 << NPrivate::OptToString(c)
199 << " is defined more than once";
200 }
201 }
202 const TOpt::TLongNames& longNames = opt->GetLongNames();
203 for (const auto& longName : longNames) {
204 for (TOptsVector::const_iterator j = i + 1; j != Opts_.end(); ++j) {
205 TOpt* nextOpt = j->Get();
206 if (nextOpt->NameIs(longName))
207 ythrow TConfException() << "option "
208 << NPrivate::OptToString(longName)
209 << " is defined more than once";
210 }
211 }
212 }
213 if (FreeArgsMax_ < FreeArgsMin_) {
214 ythrow TConfException() << "FreeArgsMax must be >= FreeArgsMin";
215 }
216 if (!FreeArgSpecs_.empty() && GetTrailingArgsIndex() > FreeArgsMax_) {
217 ythrow TConfException() << "Described args count is greater than FreeArgsMax. Either increase FreeArgsMax or remove unreachable descriptions";
218 }
219 }
220
221 TOpt& TOpts::AddOption(const TOpt& option) {
222 if (option.GetShortNames().empty() && option.GetLongNames().empty())

Callers 1

InitMethod · 0.45

Calls 8

TConfExceptionClass · 0.85
OptToStringFunction · 0.85
CharIsMethod · 0.80
NameIsMethod · 0.80
beginMethod · 0.45
endMethod · 0.45
GetMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected