LibreOffice Module comphelper (master) 1
|
#include <configurationhelper.hxx>
Static Public Member Functions | |
static css::uno::Reference< css::uno::XInterface > | openConfig (const css::uno::Reference< css::uno::XComponentContext > &rxContext, const OUString &sPackage, EConfigurationModes eMode) |
returns access to the specified configuration package. More... | |
static css::uno::Any | readRelativeKey (const css::uno::Reference< css::uno::XInterface > &xCFG, const OUString &sRelPath, const OUString &sKey) |
reads the value of an existing(!) configuration key, which is searched relative to the specified configuration access. More... | |
static void | writeRelativeKey (const css::uno::Reference< css::uno::XInterface > &xCFG, const OUString &sRelPath, const OUString &sKey, const css::uno::Any &aValue) |
writes a new value for an existing(!) configuration key, which is searched relative to the specified configuration access. More... | |
static css::uno::Reference< css::uno::XInterface > | makeSureSetNodeExists (const css::uno::Reference< css::uno::XInterface > &xCFG, const OUString &sRelPathToSet, const OUString &sSetNode) |
it checks if the specified set node exists ... or create an empty one otherwise. More... | |
static void | flush (const css::uno::Reference< css::uno::XInterface > &xCFG) |
commit all changes made on the specified configuration access. More... | |
static css::uno::Any | readDirectKey (const css::uno::Reference< css::uno::XComponentContext > &rxContext, const OUString &sPackage, const OUString &sRelPath, const OUString &sKey, EConfigurationModes eMode) |
does the same then openConfig() & readRelativeKey() together. More... | |
static void | writeDirectKey (const css::uno::Reference< css::uno::XComponentContext > &rxContext, const OUString &sPackage, const OUString &sRelPath, const OUString &sKey, const css::uno::Any &aValue, EConfigurationModes eMode) |
does the same then openConfig() / writeRelativeKey() & flush() together. More... | |
Definition at line 61 of file configurationhelper.hxx.
|
static |
commit all changes made on the specified configuration access.
This method must be used in combination with openConfig(). The cached configuration access must be provided here.
xCFG | the configuration root, where changes should be committed. |
Any | exceptions the underlying configuration can throw. E.g. css::uno::Exception if the provided configuration access does not allow writing for this set. |
Definition at line 162 of file configurationhelper.cxx.
Referenced by writeDirectKey().
|
static |
it checks if the specified set node exists ... or create an empty one otherwise.
This method must be used in combination with openConfig(). The cached configuration access must be provided here ... and all operations are made relative to this access point.
Further this method must be used only with configuration set's. Atomic keys can't be "created"... they "exist every time".
xCFG | the configuration root, where sRelPathToSet should be interpreted as relative path. |
sRelPathToSet | path relative to xCFG parameter. |
sSetNode | the set node, which should be checked if it exists... or which should be created with default values. |
Any | exceptions the underlying configuration can throw. E.g. css::uno::Exception if the provided configuration access does not allow writing for this set. |
Definition at line 110 of file configurationhelper.cxx.
|
static |
returns access to the specified configuration package.
This method should be used, if e.g. more than one request to the same configuration package is needed. The configuration access can be cached outside and used inbetween.
rxContext | the uno service manager, which should be used to create the configuration access. |
sPackage | the name of the configuration package. e.g.
|
eMode | specify the open mode for the returned configuration access. It's interpreted as a flag field and can be any useful combination of values of EConfigurationModes. |
Any | exceptions the underlying configuration can throw. E.g. css::uno::Exception if the configuration could not be opened. |
Definition at line 35 of file configurationhelper.cxx.
References comphelper::AllLocales, bReadOnly, comphelper::containerToSequence(), eMode, and comphelper::ReadOnly.
Referenced by readDirectKey(), and writeDirectKey().
|
static |
does the same then openConfig() & readRelativeKey() together.
This method should be used for reading one key at one code place only. Because it opens the specified configuration package, reads the key and closes the configuration again.
So it's not very useful to use this method for reading multiple keys at the same time. (Excepting these keys exists inside different configuration packages ...))
Definition at line 138 of file configurationhelper.cxx.
References eMode, openConfig(), and readRelativeKey().
|
static |
reads the value of an existing(!) configuration key, which is searched relative to the specified configuration access.
This method must be used in combination with openConfig(). The cached configuration access must be provided here ... and all operations are made relative to this access point.
xCFG | the configuration root, where sRelPath should be interpreted. as relative path |
sRelPath | path relative to xCFG parameter. |
sKey | the configuration node, where we should read the value. |
Any | exceptions the underlying configuration can throw. E.g. css::container::NoSuchElementException if the specified key does not exists. |
Definition at line 75 of file configurationhelper.cxx.
Referenced by readDirectKey().
|
static |
does the same then openConfig() / writeRelativeKey() & flush() together.
This method should be used for writing one key at one code place only. Because it opens the specified configuration package, writes the key, flush all changes and closes the configuration again.
So it's not very useful to use this method for writing multiple keys at the same time. (Excepting these keys exists inside different configuration packages ...))
Definition at line 149 of file configurationhelper.cxx.
References eMode, flush(), openConfig(), and writeRelativeKey().
|
static |
writes a new value for an existing(!) configuration key, which is searched relative to the specified configuration access.
This method must be used in combination with openConfig(). The cached configuration access must be provided here ... and all operations are made relative to this access point.
xCFG | the configuration root, where sRelPath should be interpreted. as relative path |
sRelPath | path relative to xCFG parameter. |
sKey | the configuration node, where we should write the new value. |
aValue | the new value for sKey. |
Any | exceptions the underlying configuration can throw. E.g. css::container::NoSuchElementException if the specified key does not exists or css::uno::Exception if the provided configuration access does not allow writing for this key. |
Definition at line 92 of file configurationhelper.cxx.
Referenced by writeDirectKey().