mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-29 04:17:55 +01:00
Poco::Util::LayeredConfiguration: added support for labelling configurations and finding them by their label
This commit is contained in:
@@ -43,24 +43,48 @@ void LayeredConfiguration::add(AbstractConfiguration* pConfig)
|
||||
}
|
||||
|
||||
|
||||
void LayeredConfiguration::add(AbstractConfiguration* pConfig, const std::string& label)
|
||||
{
|
||||
add(pConfig, label, highest(), false, true);
|
||||
}
|
||||
|
||||
|
||||
void LayeredConfiguration::add(AbstractConfiguration* pConfig, bool shared)
|
||||
{
|
||||
add(pConfig, highest(), false, shared);
|
||||
}
|
||||
|
||||
|
||||
void LayeredConfiguration::add(AbstractConfiguration* pConfig, const std::string& label, bool shared)
|
||||
{
|
||||
add(pConfig, label, highest(), false, shared);
|
||||
}
|
||||
|
||||
|
||||
void LayeredConfiguration::add(AbstractConfiguration* pConfig, int priority)
|
||||
{
|
||||
add(pConfig, priority, false, true);
|
||||
}
|
||||
|
||||
|
||||
void LayeredConfiguration::add(AbstractConfiguration* pConfig, const std::string& label, int priority)
|
||||
{
|
||||
add(pConfig, label, priority, false, true);
|
||||
}
|
||||
|
||||
|
||||
void LayeredConfiguration::add(AbstractConfiguration* pConfig, int priority, bool shared)
|
||||
{
|
||||
add(pConfig, priority, false, shared);
|
||||
}
|
||||
|
||||
|
||||
void LayeredConfiguration::add(AbstractConfiguration* pConfig, const std::string& label, int priority, bool shared)
|
||||
{
|
||||
add(pConfig, label, priority, false, shared);
|
||||
}
|
||||
|
||||
|
||||
void LayeredConfiguration::addFront(AbstractConfiguration* pConfig)
|
||||
{
|
||||
add(pConfig, lowest(), false, true);
|
||||
@@ -86,11 +110,18 @@ void LayeredConfiguration::addWriteable(AbstractConfiguration* pConfig, int prio
|
||||
|
||||
|
||||
void LayeredConfiguration::add(AbstractConfiguration* pConfig, int priority, bool writeable, bool shared)
|
||||
{
|
||||
add(pConfig, std::string(), priority, writeable, shared);
|
||||
}
|
||||
|
||||
|
||||
void LayeredConfiguration::add(AbstractConfiguration* pConfig, const std::string& label, int priority, bool writeable, bool shared)
|
||||
{
|
||||
ConfigItem item;
|
||||
item.pConfig = ConfigPtr(pConfig, shared);
|
||||
item.priority = priority;
|
||||
item.writeable = writeable;
|
||||
item.label = label;
|
||||
|
||||
ConfigList::iterator it = _configs.begin();
|
||||
while (it != _configs.end() && it->priority < priority)
|
||||
@@ -113,6 +144,19 @@ void LayeredConfiguration::removeConfiguration(AbstractConfiguration* pConfig)
|
||||
}
|
||||
|
||||
|
||||
LayeredConfiguration::ConfigPtr LayeredConfiguration::find(const std::string& label) const
|
||||
{
|
||||
for (ConfigList::const_iterator it = _configs.begin(); it != _configs.end(); ++it)
|
||||
{
|
||||
if (it->label == label)
|
||||
{
|
||||
return it->pConfig;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool LayeredConfiguration::getRaw(const std::string& key, std::string& value) const
|
||||
{
|
||||
for (ConfigList::const_iterator it = _configs.begin(); it != _configs.end(); ++it)
|
||||
|
||||
Reference in New Issue
Block a user