| 44 | } |
| 45 | |
| 46 | bool TUnstrictConfig::SetValue(const TString& path, const TString& value) { |
| 47 | try { |
| 48 | TVector<TString> vPath = SplitString(path, "."); |
| 49 | TVector<TString>::const_iterator dir = vPath.end() - 1; |
| 50 | auto sections = GetSections(GetRootSection(), vPath.begin(), dir, true); |
| 51 | bool result = false; |
| 52 | for (auto&& section : sections) { |
| 53 | Directives& directives = section->GetDirectives(); |
| 54 | Directives::iterator iter = directives.find(*dir); |
| 55 | if (iter == directives.end()) { |
| 56 | Strings.push_back(value); |
| 57 | directives.insert(Directives::value_type(*dir, Strings.back().data())); |
| 58 | result = true; |
| 59 | continue; |
| 60 | }; |
| 61 | if (!TCiString::compare(iter->second, value)) |
| 62 | continue; |
| 63 | Strings.push_back(value); |
| 64 | iter->second = Strings.back().data(); |
| 65 | result = true; |
| 66 | } |
| 67 | return result; |
| 68 | } catch (const yexception& e) { |
| 69 | ythrow yexception() << "Error while parse path " << path << ": " << e.what(); |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | bool TUnstrictConfig::Remove(const TString& path) { |
| 74 | TVector<TString> vPath = SplitString(path, "."); |
no test coverage detected