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

Method ProcessPathUnit

library/cpp/yconf/patcher/unstrict_config.cpp:113–137  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

111}
112
113TUnstrictConfig::TPathUnit TUnstrictConfig::ProcessPathUnit(const TString& element) const {
114 size_t indexBeginPos = element.find('[');
115 if (indexBeginPos == TString::npos) {
116 return TPathUnit(element, 0);
117 }
118
119 size_t indexEndPos = element.find(']', indexBeginPos);
120 if (indexEndPos == TString::npos) {
121 ythrow yexception() << "Syntax error: ] symbol expected: " << element;
122 }
123
124 const TCiString name(element.data(), indexBeginPos);
125 const TStringBuf range(element.data() + indexBeginPos + 1, indexEndPos - indexBeginPos - 1);
126 if (range.find(':') == range.npos) {
127 const size_t index = FromString<size_t>(range);
128 return TPathUnit(name, index);
129 } else {
130 const size_t startIndex = FromStringWithDefaultForEmpty<size_t>(range.Before(':'), 0);
131 const size_t endIndex = FromStringWithDefaultForEmpty<size_t>(range.After(':'), Max<size_t>());
132 if (startIndex > endIndex) {
133 ythrow yexception() << "Incorrect range " << range;
134 }
135 return TPathUnit(name, startIndex, endIndex);
136 }
137}
138
139const TYandexConfig::Section* TUnstrictConfig::GetSection(const TYandexConfig::Section* section, const TVector<TString>::const_iterator& begin, const TVector<TString>::const_iterator& end) const {
140 auto sections = GetSections(section, begin, end);

Callers

nothing calls this directly

Calls 5

TPathUnitClass · 0.85
BeforeMethod · 0.80
AfterMethod · 0.80
findMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected