Ice 3.8
C++ API Reference
Loading...
Searching...
No Matches
Ice::Properties Class Referencefinal

Represents a set of properties used to configure Ice and Ice-based applications. More...

#include <Ice/Ice.h>

Public Member Functions

 Properties ()=default
 Default constructor.
 Properties (const Properties &source)
 Copy constructor.
 Properties (std::vector< std::string > optInPrefixes)
 Constructs an empty property set with a list of opt-in prefixes.
 Properties (StringSeq &args, const PropertiesPtr &defaults)
 Constructs a property from command-line arguments and a default property set.
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.
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 getIcePropertyAsList (std::string_view key)
 Gets an Ice property as a list of strings.
PropertyDict getPropertiesForPrefix (std::string_view prefix)
 Gets all properties whose keys begins with prefix.
std::string getProperty (std::string_view key)
 Gets a property by key.
int getPropertyAsInt (std::string_view key)
 Gets a property as an integer.
int getPropertyAsIntWithDefault (std::string_view key, int value)
 Gets a property as an integer.
StringSeq getPropertyAsList (std::string_view key)
 Gets a property as a list of strings.
StringSeq getPropertyAsListWithDefault (std::string_view key, const StringSeq &value)
 Gets a property as a list of strings.
std::string getPropertyWithDefault (std::string_view key, std::string_view value)
 Gets a property by key.
std::set< std::string > getUnusedProperties ()
 Gets the properties that were never read.
void load (std::string_view file)
 Loads properties from a file.
Propertiesoperator= (const Properties &rhs)=delete
StringSeq parseCommandLineOptions (std::string_view prefix, const StringSeq &options)
 Converts a sequence of command-line options into properties.
StringSeq parseIceCommandLineOptions (const StringSeq &options)
 Converts a sequence of command-line options into properties.
void setProperty (std::string_view key, std::string_view value)
 Sets a property.

Static Public Member Functions

static std::pair< PropertyDict, StringSeqparseOptions (std::string_view prefix, const StringSeq &options)
 Parses a sequence of options into a map of key value pairs starting with a prefix.

Detailed Description

Represents a set of properties used to configure Ice and Ice-based applications.

A property is a key/value pair, where both the key and the value are strings. By convention, property keys should have the form application-name>[.category[.sub-category]].name.

Remarks
This class is thread-safe: multiple threads can safely read and write the properties without their own synchronization.

Definition at line 25 of file Properties.h.


The documentation for this class was generated from the following file: