Documentation for Ice 3.4. The latest release is Ice 3.7. Refer to the space directory for other releases.


Ice::Properties

Overview

local interface Properties

A property set used to configure Ice and Ice applications. Properties are key/value pairs, with both keys and values being strings. By convention, property keys should have the form application-name[.category[.sub-category]].name.

Used By

Operation Index

getProperty — Get a property by key.
getPropertyWithDefault — Get a property by key.
getPropertyAsInt — Get a property as an integer.
getPropertyAsIntWithDefault — Get a property as an integer.
getPropertyAsList — Get a property as a list of strings.
getPropertyAsListWithDefault — Get a property as a list of strings.
getPropertiesForPrefix — Get all properties whose keys begins with prefix.
setProperty — Set a property.
getCommandLineOptions — Get a sequence of command-line options that is equivalent to this property set.
parseCommandLineOptions — Convert a sequence of command-line options into properties.
parseIceCommandLineOptions — Convert a sequence of command-line options into properties.
load — Load properties from a file.
clone — Create a copy of this property set.

Operations

string getProperty(string key)

Get a property by key. If the property is not set, an empty string is returned.

Parameters

key — The property key.

Return Value

The property value.

See Also

string getPropertyWithDefault(string key, string value)

Get a property by key. If the property is not set, the given default value is returned.

Parameters

key — The property key.
value — The default value to use if the property does not exist.

Return Value

The property value or the default value.

See Also

int getPropertyAsInt(string key)

Get a property as an integer. If the property is not set, 0 is returned.

Parameters

key — The property key.

Return Value

The property value interpreted as an integer.

See Also

int getPropertyAsIntWithDefault(string key, int value)

Get a property as an integer. If the property is not set, the given default value is returned.

Parameters

key — The property key.
value — The default value to use if the property does not exist.

Return Value

The property value interpreted as an integer, or the default value.

See Also

Ice::StringSeq getPropertyAsList(string key)

Get a property as a list of strings. If the property is not set, an empty list is returned. The strings in the list can contain whitespace if they are enclosed in single or double quotes. If quotes are mismatched, an empty list is returned. Within single quotes or double-quotes, you can escape the quote in question with
, e.g. O'Reilly can be written as O'Reilly, "O'Reilly" or 'O
'Reilly'.

Parameters

key — The property key.

Return Value

The property value interpreted as a list of strings.

See Also

Ice::StringSeq getPropertyAsListWithDefault(string key, Ice::StringSeq value)

Get a property as a list of strings. If the property is not set, the default list is returned. The strings in the list can contain whitespace if they are enclosed in single or double quotes. If quotes are mismatched, the default list is returned. Within single quotes or double-quotes, you can escape the quote in question with
, e.g. O'Reilly can be written as O'Reilly, "O'Reilly" or 'O
'Reilly'.

Parameters

key — The property key.
value — The default value to use if the property is not set.

Return Value

The property value interpreted as list of strings, or the default value.

See Also

Ice::PropertyDict getPropertiesForPrefix(string prefix)

Get all properties whose keys begins with prefix. If prefix is an empty string, then all properties are returned.

Parameters

prefix — The prefix to search for (empty string if none).

Return Value

The matching property set.

void setProperty(string key, string value)

Set a property. To unset a property, set it to the empty string.

Parameters

key — The property key.
value — The property value.

See Also

Ice::StringSeq getCommandLineOptions()

Get a sequence of command-line options that is equivalent to this property set. Each element of the returned sequence is a command-line option of the form --key=value.

Return Value

The command line options for this property set.

Ice::StringSeq parseCommandLineOptions(string prefix, Ice::StringSeq options)

Convert a sequence of command-line options into properties. All options that begin with --prefix. are converted into properties. If the prefix is empty, all options that begin with -- are converted to properties.

Parameters

prefix — The property prefix, or an empty string to convert all options starting with --.
options — The command-line options.

Return Value

The command-line options that do not start with the specified prefix, in their original order.

Ice::StringSeq parseIceCommandLineOptions(Ice::StringSeq options)

Convert a sequence of command-line options into properties. All options that begin with one of the following prefixes are converted into properties: --Ice, --IceBox, --IceGrid, --IcePatch2, --IceSSL, --IceStorm, --Freeze, and --Glacier2.

Parameters

options — The command-line options.

Return Value

The command-line options that do not start with one of the listed prefixes, in their original order.

void load(string file)

Load properties from a file.

Parameters

file — The property file.

Ice::Properties clone()

Create a copy of this property set.

Return Value

A copy of this property set.


  • No labels