Poco::Util

class FilesystemConfiguration

Library: Util
Package: Configuration
Header: Poco/Util/FilesystemConfiguration.h

Description

An implementation of AbstractConfiguration that stores configuration data in a directory hierarchy in the filesystem.

Every period-separated part of a property name is represented as a directory in the filesystem, relative to the base directory. Values are stored in files named "data".

All changes to properties are immediately persisted in the filesystem.

For example, a configuration consisting of the properties

   logging.loggers.root.channel.class = ConsoleChannel
   logging.loggers.app.name = Application
   logging.loggers.app.channel = c1
   logging.formatters.f1.class = PatternFormatter
   logging.formatters.f1.pattern = [%p] %t

is stored in the filesystem as follows:

   logging/
           loggers/
                   root/
                        channel/
                                class/
                                      data ("ConsoleChannel")
                   app/
                       name/
                            data ("Application")
                       channel/
                               data ("c1")
           formatters/
                      f1/
                         class/
                               data ("PatternFormatter")
                         pattern/
                                 data ("[%p] %t")                      

Inheritance

Direct Base Classes: AbstractConfiguration

All Base Classes: Poco::RefCountedObject, AbstractConfiguration

Member Summary

Member Functions: clear, enumerate, getRaw, keyToPath, setRaw

Inherited Functions: createView, duplicate, enumerate, expand, getBool, getDouble, getInt, getRaw, getRawString, getString, hasOption, hasProperty, keys, parseBool, parseInt, referenceCount, release, setBool, setDouble, setInt, setRaw, setString

Constructors

FilesystemConfiguration

FilesystemConfiguration(
    const std::string & path
);

Creates a FilesystemConfiguration using the given path. All directories are created as necessary.

Destructor

~FilesystemConfiguration protected virtual

~FilesystemConfiguration();

Member Functions

clear

void clear();

Clears the configuration by erasing the configuration directory and all its subdirectories and files.

enumerate protected virtual

void enumerate(
    const std::string & key,
    Keys & range
) const;

See also: Poco::Util::AbstractConfiguration::enumerate()

getRaw protected virtual

bool getRaw(
    const std::string & key,
    std::string & value
) const;

See also: Poco::Util::AbstractConfiguration::getRaw()

keyToPath protected

Poco::Path keyToPath(
    const std::string & key
) const;

setRaw protected virtual

void setRaw(
    const std::string & key,
    const std::string & value
);

See also: Poco::Util::AbstractConfiguration::setRaw()