diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/poco/Util/src/ConfigurationView.cpp | |
parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
download | ydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/poco/Util/src/ConfigurationView.cpp')
-rw-r--r-- | contrib/libs/poco/Util/src/ConfigurationView.cpp | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/contrib/libs/poco/Util/src/ConfigurationView.cpp b/contrib/libs/poco/Util/src/ConfigurationView.cpp index 008a24f489..1231d242c2 100644 --- a/contrib/libs/poco/Util/src/ConfigurationView.cpp +++ b/contrib/libs/poco/Util/src/ConfigurationView.cpp @@ -1,75 +1,75 @@ -// -// ConfigurationView.cpp -// -// Library: Util -// Package: Configuration -// Module: ConfigurationView -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Util/ConfigurationView.h" - - -namespace Poco { -namespace Util { - - -ConfigurationView::ConfigurationView(const std::string& prefix, AbstractConfiguration* pConfig): - _prefix(prefix), - _pConfig(pConfig) -{ - poco_check_ptr (pConfig); - - _pConfig->duplicate(); -} - - -ConfigurationView::~ConfigurationView() -{ - _pConfig->release(); -} - - -bool ConfigurationView::getRaw(const std::string& key, std::string& value) const -{ - std::string translatedKey = translateKey(key); - return _pConfig->getRaw(translatedKey, value) || _pConfig->getRaw(key, value); -} - - -void ConfigurationView::setRaw(const std::string& key, const std::string& value) -{ - std::string translatedKey = translateKey(key); - _pConfig->setRaw(translatedKey, value); -} - - -void ConfigurationView::enumerate(const std::string& key, Keys& range) const -{ - std::string translatedKey = translateKey(key); - _pConfig->enumerate(translatedKey, range); -} - - -void ConfigurationView::removeRaw(const std::string& key) -{ - std::string translatedKey = translateKey(key); - _pConfig->remove(translatedKey); -} - - -std::string ConfigurationView::translateKey(const std::string& key) const -{ - std::string result = _prefix; - if (!result.empty() && !key.empty() && key[0] != '[') result += '.'; - result += key; - return result; -} - - -} } // namespace Poco::Util +// +// ConfigurationView.cpp +// +// Library: Util +// Package: Configuration +// Module: ConfigurationView +// +// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#include "Poco/Util/ConfigurationView.h" + + +namespace Poco { +namespace Util { + + +ConfigurationView::ConfigurationView(const std::string& prefix, AbstractConfiguration* pConfig): + _prefix(prefix), + _pConfig(pConfig) +{ + poco_check_ptr (pConfig); + + _pConfig->duplicate(); +} + + +ConfigurationView::~ConfigurationView() +{ + _pConfig->release(); +} + + +bool ConfigurationView::getRaw(const std::string& key, std::string& value) const +{ + std::string translatedKey = translateKey(key); + return _pConfig->getRaw(translatedKey, value) || _pConfig->getRaw(key, value); +} + + +void ConfigurationView::setRaw(const std::string& key, const std::string& value) +{ + std::string translatedKey = translateKey(key); + _pConfig->setRaw(translatedKey, value); +} + + +void ConfigurationView::enumerate(const std::string& key, Keys& range) const +{ + std::string translatedKey = translateKey(key); + _pConfig->enumerate(translatedKey, range); +} + + +void ConfigurationView::removeRaw(const std::string& key) +{ + std::string translatedKey = translateKey(key); + _pConfig->remove(translatedKey); +} + + +std::string ConfigurationView::translateKey(const std::string& key) const +{ + std::string result = _prefix; + if (!result.empty() && !key.empty() && key[0] != '[') result += '.'; + result += key; + return result; +} + + +} } // namespace Poco::Util |