Properties Class Reference

## Public Member Functions

| Properties ()
| Create new instance. More...
| ~Properties ()
| Destructor. More...
void | load (InputStreamPtr inStream)
| Reads a property list (key and element pairs) from the input stream. More...
LogString | setProperty (const LogString &key, const LogString &value)
| Calls Properties::put. More...
LogString | put (const LogString &key, const LogString &value)
| Puts a property value into the collection. More...
LogString | getProperty (const LogString &key) const
| Calls Properties::get. More...
LogString | get (const LogString &key) const
| Gets a property value. More...
std::vector< LogString > | propertyNames () const
| Returns an enumeration of all the keys in this property list, including distinct keys in the default property list if a key of the same name has not already been found from the main properties list. More...

## Constructor & Destructor Documentation

Properties | ( |  | ) |

Create new instance.

~Properties | ( |  | ) |

Destructor.

## Member Function Documentation

LogString get | ( | const LogString & | key | ) | const

Gets a property value.

Parameters

  key | the property key.

Returns
  the value in this property list with the specified key value or empty string.

LogString getProperty | ( | const LogString & | key | ) | const

Calls Properties::get.

Parameters

  key | the property key.

Returns
  the value in this property list with the specified key value or empty string.

void load | ( | InputStreamPtr | inStream | ) |

Reads a property list (key and element pairs) from the input stream.

                        The stream is assumed to be using the ISO 8859-1 character encoding.

                        <p>Every property occupies one line of the input stream.
                        Each line is terminated by a line terminator (<code>\\n</code> or
                        <code>\\r</code> or <code>\\r\\n</code>).
                        Lines from the input stream are processed until end of file is reached
                        on the input stream.

                        <p>A line that contains only whitespace or whose first non-whitespace
                        character is an ASCII <code>#</code> or <code>!</code> is ignored
                        (thus, <code>#</code> or <code>!</code> indicate comment lines).

                        <p>Every line other than a blank line or a comment line describes one
                        property to be added to the table (except that if a line ends with \,
                        then the following line, if it exists, is treated as a continuation
                        line, as described below). The key consists of all the characters in
                        the line starting with the first non-whitespace character and up to,
                        but   not including, the first ASCII <code>=</code>, <code>:</code>,
                        or whitespace character. All of the
                        key termination characters may be included in the key by preceding them
                        with a <code>\\</code>. Any whitespace after the key is skipped;
                        if the first
                        non-whitespace character after the key is <code>=</code> or
                        <code>:</code>, then it is ignored
                        and any whitespace characters after it are also skipped. All remaining
                        characters on the line become part of the associated element string.
                        Within the element string, the ASCII escape sequences <code>\\t</code>,
                        <code>\\n</code>, <code>\\r</code>, <code>\\</code>, <code>\\"</code>,
                        <code>\\'</code>, <code>\\</code> (a backslash and a space), and
                        <code>\\uxxxx</code> are recognized
                        and converted to single characters. Moreover, if the last character on
                        the line is <code>\\</code>, then the next line is treated as a
                        continuation of the
                        current line; the <code>\\</code> and line terminator are simply
                        discarded, and any
                        leading whitespace characters on the continuation line are also
                        discarded and are not part of the element string.

                        <p>As an example, each of the following four lines specifies the key
                        "Truth" and the associated element value "Beauty":

                        <pre>

Truth = Beauty Truth:Beauty Truth :Beauty

As another example, the following three lines specify a single property:

     fruits           apple, banana, pear, \
                                      cantaloupe, watermelon, \
                                      kiwi, mango

The key is "<code>fruits</code>" and the associated element is:

    "apple, banana, pear, cantaloupe, watermelon, kiwi, mango"

Note that a space appears before each \ so that a space will appear after each comma in the final result; the \, line terminator, and leading whitespace on the continuation line are merely discarded and are not replaced by one or more other characters.

As a third example, the line:

    cheeses

specifies that the key is "<code>cheeses</code>" and the associated element is the empty string.

Parameters

  inStream | the input stream.

Exceptions

  IOException | if an error occurred when reading from the input stream.

std::vector<LogString> propertyNames | ( |  | ) | const

Returns an enumeration of all the keys in this property list, including distinct keys in the default property list if a key of the same name has not already been found from the main properties list.

Returns
  an array of all the keys in this property list, including the keys in the default property list.

LogString put | ( | const LogString & | key,
|  | const LogString & | value
| ) |  |

Puts a property value into the collection.

Parameters

  key | the key to be placed into this property list.
  value | the value corresponding to key.

Returns
  the previous value of the specified key in this property list, or an empty string if it did not have one.

LogString setProperty | ( | const LogString & | key,
|  | const LogString & | value
| ) |  |

Calls Properties::put.

Parameters

  key | the key to be placed into this property list.
  value | the value corresponding to key.

Returns
  the previous value of the specified key in this property list, or an empty string if it did not have one.

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

- properties.h