26 #include <Ice/Initialize.h>
34 Ice::StringSeq strSeq;
46 armarxIceProperties->parseCommandLineOptions(std::string(), propertySeq);
48 return armarxIceProperties;
58 Ice::StringSeq propertySeq = Ice::argsToStringSeq(argn, argv);
61 armarxIceProperties->parseCommandLineOptions(std::string(), propertySeq);
63 return armarxIceProperties;
68 internalProperties(iceProperties),
77 internalProperties =
source.internalProperties->clone();
78 modified =
source.modified;
79 if (
source.inheritanceSolver)
94 return internalProperties->getProperty(name);
98 const ::std::string& defaultValue) ICE_NOEXCEPT
102 return internalProperties->getPropertyWithDefault(name, defaultValue);
109 return internalProperties->getPropertyAsInt(name);
113 ::
Ice::Int defaultValue) ICE_NOEXCEPT
117 return internalProperties->getPropertyAsIntWithDefault(name, defaultValue);
124 return internalProperties->getPropertyAsList(name);
128 const ::std::string& name, const ::Ice::StringSeq& defaultValue) ICE_NOEXCEPT
132 return internalProperties->getPropertyAsListWithDefault(name, defaultValue);
139 return internalProperties->getPropertiesForPrefix(prefix);
144 internalProperties->setProperty(name,
value);
152 return internalProperties->getCommandLineOptions();
156 const ::Ice::StringSeq& options)
158 Ice::StringSeq optionSeq = internalProperties->parseCommandLineOptions(prefix, options);
168 Ice::StringSeq optionSeq = internalProperties->parseIceCommandLineOptions(options);
178 internalProperties->load(fileName);
186 return internalProperties->clone();
189 void IceProperties::setModified(
bool mod)
191 this->modified = mod;
194 bool IceProperties::isModified()
199 void IceProperties::update()
203 if (inheritanceSolver.get() !=
nullptr)
205 inheritanceSolver->resolveInheritance(internalProperties);
214 return inheritanceSolver;
220 this->inheritanceSolver = solver;
232 extractNamespaces(properties, namespaces);
234 NamespaceMap::const_iterator namespacesIter = namespaces.begin();
236 while (namespacesIter != namespaces.end())
238 resolveNamespaceInheritance(namespacesIter->first, properties);
249 Ice::PropertyDict propertyDict = properties->getPropertiesForPrefix(std::string());
252 Ice::PropertyDict::iterator dictIter = propertyDict.begin();
254 while (dictIter != propertyDict.end())
256 std::string propertyFullName = dictIter->first;
258 unsigned nameDelimiter = propertyFullName.find_last_of(
".");
259 std::string propertyNamespace = propertyFullName.substr(0, nameDelimiter);
260 namespaces[propertyNamespace] =
true;
271 if (properties->getPropertyWithDefault(
272 inheritanceProperty,
"::NOT-SET::").compare(
"::NOT-SET::") == 0)
285 return properties->getProperty(inheritanceProperty);
289 const std::string& namespace_)
291 std::vector<std::string>::const_iterator heritageLineIter = heritageLine.begin();
293 while (heritageLineIter != heritageLine.end())
295 if ((*heritageLineIter).compare(namespace_) == 0)
307 const std::string& namespace_)
309 return propertyName.substr(namespace_.length() + 1);
315 std::vector<std::string> heritageLine;
317 if (hasParent(childNamespace, properties))
319 inherit(childNamespace, getParent(childNamespace, properties), properties, heritageLine);
324 const std::string& parentNamespace,
326 std::vector<std::string> heritageLine)
328 heritageLine.push_back(childNamespace);
331 if (hasParent(parentNamespace, properties))
333 if (isInHeritageLine(heritageLine, parentNamespace))
335 heritageLine.push_back(parentNamespace);
339 inherit(parentNamespace, getParent(parentNamespace, properties), properties, heritageLine);
343 Ice::PropertyDict parentProperties = properties->getPropertiesForPrefix(parentNamespace);
345 Ice::PropertyDict::iterator parentPropIter = parentProperties.begin();
347 while (parentPropIter != parentProperties.end())
353 for (
auto property : properties->getPropertiesForPrefix(childNamespace))
355 std::string propertyVariable =
"{" + stripNamespace(parentPropIter->first, parentNamespace) +
"}";
356 auto index =
property.second.find(propertyVariable);
357 if (
index != std::string::npos)
359 std::string newValue =
property.second.replace(
index, propertyVariable.size(), parentPropIter->second);
360 properties->setProperty(property.first, newValue);
366 std::string newPropertyName = childNamespace +
"." +
367 stripNamespace(parentPropIter->first, parentNamespace);
370 if (properties->getProperty(newPropertyName).empty())
372 properties->setProperty(newPropertyName, parentPropIter->second);