diff options
Diffstat (limited to 'cpp')
-rw-r--r-- | cpp/slice/Ice/Properties.ice | 14 | ||||
-rw-r--r-- | cpp/src/Ice/PluginManagerI.cpp | 9 | ||||
-rw-r--r-- | cpp/src/Ice/PropertiesI.cpp | 11 | ||||
-rw-r--r-- | cpp/src/Ice/PropertiesI.h | 2 | ||||
-rw-r--r-- | cpp/src/IceBox/ServiceManagerI.cpp | 11 |
5 files changed, 29 insertions, 18 deletions
diff --git a/cpp/slice/Ice/Properties.ice b/cpp/slice/Ice/Properties.ice index e44098d075e..9fb78c28d6a 100644 --- a/cpp/slice/Ice/Properties.ice +++ b/cpp/slice/Ice/Properties.ice @@ -18,6 +18,16 @@ module Ice /** * + * A simple collection of properties, represented as a dictionary of + * key/value pairs. Both key and value are [string]s. + * + * @see Properties::getPropertiesForPrefix + * + **/ +local dictionary<string, string> PropertyDict; + +/** + * * A property set to configure &Ice; and applications based on * &Ice;. Properties are key/value pairs, with both keys and values * being strings. By conventions, property keys should have the form @@ -94,10 +104,10 @@ local interface Properties * <replaceable>prefix</replaceable> is an empty string, * then all properties are returned. * - * @return The matching properties, in [key,value] pairs. + * @return The matching property set. * **/ - StringSeq getProperties(string prefix); + PropertyDict getPropertiesForPrefix(string prefix); /** * diff --git a/cpp/src/Ice/PluginManagerI.cpp b/cpp/src/Ice/PluginManagerI.cpp index c9e2f6c25a0..f69c751fae4 100644 --- a/cpp/src/Ice/PluginManagerI.cpp +++ b/cpp/src/Ice/PluginManagerI.cpp @@ -83,11 +83,12 @@ Ice::PluginManagerI::loadPlugins(int& argc, char* argv[]) // const string prefix = "Ice.Plugin."; PropertiesPtr properties = _instance->properties(); - StringSeq plugins = properties->getProperties(prefix); - for (StringSeq::size_type i = 0; i < plugins.size(); i += 2) + PropertyDict plugins = properties->getPropertiesForPrefix(prefix); + PropertyDict::const_iterator p; + for (p = plugins.begin(); p != plugins.end(); ++p) { - string name = plugins[i].substr(prefix.size()); - string value = plugins[i + 1]; + string name = p->first.substr(prefix.size()); + const string& value = p->second; // // Separate the entry point from the arguments. diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp index e8a7a9b8c16..0306455ce54 100644 --- a/cpp/src/Ice/PropertiesI.cpp +++ b/cpp/src/Ice/PropertiesI.cpp @@ -70,19 +70,18 @@ Ice::PropertiesI::getPropertyAsIntWithDefault(const string& key, Int value) } } -StringSeq -Ice::PropertiesI::getProperties(const string& prefix) +PropertyDict +Ice::PropertiesI::getPropertiesForPrefix(const string& prefix) { IceUtil::Mutex::Lock sync(*this); - StringSeq result; + PropertyDict result; map<string, string>::const_iterator p; for (p = _properties.begin(); p != _properties.end(); ++p) { - if (prefix.empty() || p->first.find(prefix) == 0) + if (prefix.empty() || p->first.compare(0, prefix.size(), prefix) == 0) { - result.push_back(p->first); - result.push_back(p->second); + result.insert(*p); } } diff --git a/cpp/src/Ice/PropertiesI.h b/cpp/src/Ice/PropertiesI.h index 4e301f68306..da843b70611 100644 --- a/cpp/src/Ice/PropertiesI.h +++ b/cpp/src/Ice/PropertiesI.h @@ -26,7 +26,7 @@ public: virtual std::string getPropertyWithDefault(const std::string&, const std::string&); virtual Ice::Int getPropertyAsInt(const std::string&); virtual Ice::Int getPropertyAsIntWithDefault(const std::string&, Ice::Int); - virtual StringSeq getProperties(const std::string&); + virtual PropertyDict getPropertiesForPrefix(const std::string&); virtual void setProperty(const std::string&, const std::string&); virtual StringSeq getCommandLineOptions(); virtual StringSeq parseCommandLineOptions(const std::string&, const StringSeq&); diff --git a/cpp/src/IceBox/ServiceManagerI.cpp b/cpp/src/IceBox/ServiceManagerI.cpp index 472c09d13bc..ea1831ee051 100644 --- a/cpp/src/IceBox/ServiceManagerI.cpp +++ b/cpp/src/IceBox/ServiceManagerI.cpp @@ -72,11 +72,12 @@ IceBox::ServiceManagerI::run() // const string prefix = "IceBox.Service."; PropertiesPtr properties = _communicator->getProperties(); - StringSeq services = properties->getProperties(prefix); - for (StringSeq::size_type i = 0; i < services.size(); i += 2) - { - string name = services[i].substr(prefix.size()); - string value = services[i + 1]; + PropertyDict services = properties->getPropertiesForPrefix(prefix); + PropertyDict::const_iterator p; + for (p = services.begin(); p != services.end(); ++p) + { + string name = p->first.substr(prefix.size()); + const string& value = p->second; // // Separate the entry point from the arguments. |