3#ifndef ICE_PROPERTIES_H
4#define ICE_PROPERTIES_H
7#include "Ice/BuiltinSequences.h"
8#include "Ice/PropertyDict.h"
9#include "PropertiesF.h"
10#include "StringConverter.h"
35 explicit Properties(std::vector<std::string> optInPrefixes) : _optInPrefixes(std::move(optInPrefixes)) {}
154 void load(std::string_view file);
172 static std::optional<std::pair<std::string, std::string>>
181 PropertyValue() : used(false) {}
183 PropertyValue(std::string v,
bool u) : value(std::move(v)), used(u) {}
188 std::map<std::string, PropertyValue, std::less<>> _properties;
191 std::vector<std::string> _optInPrefixes;
192 mutable std::mutex _mutex;
228#if defined(_WIN32) || defined(ICE_DOXYGEN)
Properties(std::vector< std::string > optInPrefixes)
Constructs an empty property set with a list of opt-in prefixes.
std::string getPropertyWithDefault(std::string_view key, std::string_view value)
Gets a property by key.
StringSeq parseIceCommandLineOptions(const StringSeq &options)
Converts a sequence of command-line options into properties.
std::set< std::string > getUnusedProperties()
Gets the properties that were never read.
Properties(StringSeq &args, const PropertiesPtr &defaults)
Constructs a property from command-line arguments and a default property set.
StringSeq getPropertyAsListWithDefault(std::string_view key, const StringSeq &value)
Gets a property as a list of strings.
std::string getProperty(std::string_view key)
Gets a property by key.
void load(std::string_view file)
Loads properties from a file.
void setProperty(std::string_view key, std::string_view value)
Sets a property.
int getPropertyAsIntWithDefault(std::string_view key, int value)
Gets a property as an integer.
PropertyDict getPropertiesForPrefix(std::string_view prefix)
Gets all properties whose keys begins with prefix.
StringSeq getPropertyAsList(std::string_view key)
Gets a property as a list of strings.
std::string getIceProperty(std::string_view key)
Gets an Ice property by key.
int getIcePropertyAsInt(std::string_view key)
Gets an Ice property as an integer.
StringSeq parseCommandLineOptions(std::string_view prefix, const StringSeq &options)
Converts a sequence of command-line options into properties.
PropertiesPtr clone()
Creates a copy of this property set.
StringSeq getCommandLineOptions()
Gets a sequence of command-line options that is equivalent to this property set.
StringSeq getIcePropertyAsList(std::string_view key)
Gets an Ice property as a list of strings.
int getPropertyAsInt(std::string_view key)
Gets a property as an integer.
Properties(const Properties &source)
Copy constructor.
Properties()=default
Default constructor.
static std::pair< PropertyDict, StringSeq > parseOptions(std::string_view prefix, const StringSeq &options)
Parses a sequence of options into a map of key value pairs starting with a prefix.
std::shared_ptr< Properties > PropertiesPtr
A shared pointer to a Properties.
std::shared_ptr< StringConverter > StringConverterPtr
A shared pointer to a StringConverter.
PropertiesPtr createProperties()
Creates an empty property set.
std::vector< std::string > StringSeq
A sequence of strings.
std::map< std::string, std::string, std::less<> > PropertyDict
A simple collection of properties, represented as a dictionary of key/value pairs.