LibreOffice Module unotools (master) 1
|
a small wrapper around a configuration node. More...
#include <confignode.hxx>
Public Member Functions | |
OConfigurationNode () | |
constructs an empty and invalid node object More... | |
OConfigurationNode (const OConfigurationNode &_rSource) | |
copy ctor More... | |
OConfigurationNode (OConfigurationNode &&_rSource) | |
move ctor More... | |
OConfigurationNode & | operator= (const OConfigurationNode &_rSource) |
assignment More... | |
OConfigurationNode & | operator= (OConfigurationNode &&_rSource) |
OUString | getLocalName () const |
returns the local name of the node More... | |
OConfigurationNode | openNode (const OUString &_rPath) const noexcept |
open a sub node More... | |
OConfigurationNode | openNode (const char *_pAsciiPath) const |
OConfigurationNode | createNode (const OUString &_rName) const noexcept |
create a new child node More... | |
bool | removeNode (const OUString &_rName) const noexcept |
remove an existent child nod More... | |
css::uno::Any | getNodeValue (const OUString &_rPath) const noexcept |
retrieves the content of a descendant More... | |
css::uno::Any | getNodeValue (const char *_pAsciiPath) const |
bool | setNodeValue (const OUString &_rPath, const css::uno::Any &_rValue) const noexcept |
write a node valueThe value given is written into the node specified by the given relative path. More... | |
bool | setNodeValue (const char *_pAsciiPath, const css::uno::Any &_rValue) const |
css::uno::Sequence< OUString > | getNodeNames () const noexcept |
return the names of the existing children More... | |
virtual void | clear () noexcept |
invalidate the object More... | |
bool | isSetNode () const |
checks whether or not the object represents a set node. More... | |
bool | hasByName (const OUString &_rName) const noexcept |
checks whether or not a direct child with a given name exists More... | |
bool | hasByHierarchicalName (const OUString &_rName) const noexcept |
checks whether or not a descendent (no matter if direct or indirect) with the given name exists More... | |
bool | isValid () const |
check if the objects represents a valid configuration node More... | |
bool | isReadonly () const |
check whether the object is read-only of updatable More... | |
Protected Types | |
enum | NAMEORIGIN { NO_CONFIGURATION , NO_CALLER } |
Protected Member Functions | |
OConfigurationNode (const css::uno::Reference< css::uno::XInterface > &_rxNode) | |
constructs a node object with an interface representing a node More... | |
const css::uno::Reference< css::container::XNameAccess > & | getUNONode () const |
virtual void | _disposing (const css::lang::EventObject &_rSource) override |
OUString | normalizeName (const OUString &_rName, NAMEORIGIN _eOrigin) const |
Protected Member Functions inherited from utl::OEventListenerAdapter | |
OEventListenerAdapter () | |
virtual | ~OEventListenerAdapter () |
void | startComponentListening (const css::uno::Reference< css::lang::XComponent > &_rxComp) |
void | stopComponentListening (const css::uno::Reference< css::lang::XComponent > &_rxComp) |
void | stopAllComponentListening () |
virtual void | _disposing (const css::lang::EventObject &_rSource)=0 |
Private Member Functions | |
OConfigurationNode | insertNode (const OUString &_rName, const css::uno::Reference< css::uno::XInterface > &_xNode) const noexcept |
escape names before accessing children ? More... | |
Private Attributes | |
css::uno::Reference< css::container::XHierarchicalNameAccess > | m_xHierarchyAccess |
css::uno::Reference< css::container::XNameAccess > | m_xDirectAccess |
accessing children grandchildren (mandatory interface of our UNO object) More... | |
css::uno::Reference< css::container::XNameReplace > | m_xReplaceAccess |
accessing children (mandatory interface of our UNO object) More... | |
css::uno::Reference< css::container::XNameContainer > | m_xContainerAccess |
replacing child values More... | |
bool | m_bEscapeNames |
modifying set nodes (optional interface of our UNO object) More... | |
a small wrapper around a configuration node.
Nodes in the terminology used herein are inner nodes of a configuration tree, which means no leafs.
Definition at line 40 of file confignode.hxx.
|
protected |
Enumerator | |
---|---|
NO_CONFIGURATION | |
NO_CALLER | the name came from a configuration node the name came from a client of this class |
Definition at line 162 of file confignode.hxx.
|
protected |
constructs a node object with an interface representing a node
|
inline |
constructs an empty and invalid node object
Definition at line 66 of file confignode.hxx.
utl::OConfigurationNode::OConfigurationNode | ( | const OConfigurationNode & | _rSource | ) |
copy ctor
Definition at line 78 of file confignode.cxx.
References m_xDirectAccess, and utl::OEventListenerAdapter::startComponentListening().
utl::OConfigurationNode::OConfigurationNode | ( | OConfigurationNode && | _rSource | ) |
move ctor
Definition at line 91 of file confignode.cxx.
References m_xDirectAccess, and utl::OEventListenerAdapter::startComponentListening().
|
overrideprotectedvirtual |
Implements utl::OEventListenerAdapter.
Definition at line 138 of file confignode.cxx.
References clear(), and m_xDirectAccess.
|
virtualnoexcept |
invalidate the object
Reimplemented in utl::OConfigurationTreeRoot.
Definition at line 430 of file confignode.cxx.
References m_xContainerAccess, m_xDirectAccess, m_xHierarchyAccess, and m_xReplaceAccess.
Referenced by _disposing(), and utl::OConfigurationTreeRoot::clear().
|
noexcept |
create a new child node
If the object represents a set node, this method may be used to create a new child. For non-set-nodes, the method will fail.
Unless the respective operations on the pure configuration API, the to-be-created node immediately becomes a part of its hierarchy, no explicit insertion is necessary.
_rName | name for the new child. Must be level-1-depth. |
Definition at line 255 of file confignode.cxx.
References DBG_UNHANDLED_EXCEPTION, and Exception.
OUString utl::OConfigurationNode::getLocalName | ( | ) | const |
returns the local name of the node
Definition at line 146 of file confignode.cxx.
References DBG_UNHANDLED_EXCEPTION, Exception, and m_xDirectAccess.
|
noexcept |
return the names of the existing children
Definition at line 185 of file confignode.cxx.
References Exception, m_xDirectAccess, and TOOLS_WARN_EXCEPTION.
|
inline |
Definition at line 115 of file confignode.hxx.
|
noexcept |
retrieves the content of a descendant
the returned value may contain anything from an interface (if <arg>_rPath</arg> refers to inner node of the configuration tree) to any explicit value (e.g. string, integer) or even void.
Unfortunately, this implies that if a void value is returned, you won't have a clue if this means "the path does not exist" (besides the assertion made :), or if the value is really void.
Definition at line 406 of file confignode.cxx.
References Any, and DBG_UNHANDLED_EXCEPTION.
|
inlineprotected |
Definition at line 62 of file confignode.hxx.
|
noexcept |
checks whether or not a descendent (no matter if direct or indirect) with the given name exists
Definition at line 327 of file confignode.cxx.
|
noexcept |
checks whether or not a direct child with a given name exists
Definition at line 344 of file confignode.cxx.
|
privatenoexcept |
escape names before accessing children ?
Definition at line 230 of file confignode.cxx.
References Any, DBG_UNHANDLED_EXCEPTION, Exception, and sName.
|
inline |
check whether the object is read-only of updatable
Definition at line 155 of file confignode.hxx.
bool utl::OConfigurationNode::isSetNode | ( | ) | const |
checks whether or not the object represents a set node.
Definition at line 315 of file confignode.cxx.
References Exception, and m_xHierarchyAccess.
|
inline |
check if the objects represents a valid configuration node
Definition at line 152 of file confignode.hxx.
Referenced by utl::OConfigurationTreeRoot::commit().
|
protected |
Definition at line 161 of file confignode.cxx.
References DBG_UNHANDLED_EXCEPTION, Exception, m_bEscapeNames, m_xDirectAccess, NO_CALLER, and sName.
|
inline |
Definition at line 84 of file confignode.hxx.
|
noexcept |
open a sub node
_rPath | access path of the to-be-opened sub node. May be a hierarchical path. |
Definition at line 277 of file confignode.cxx.
References Exception, SAL_WARN, and TOOLS_WARN_EXCEPTION.
OConfigurationNode & utl::OConfigurationNode::operator= | ( | const OConfigurationNode & | _rSource | ) |
assignment
Definition at line 104 of file confignode.cxx.
References m_bEscapeNames, m_xContainerAccess, m_xDirectAccess, m_xHierarchyAccess, m_xReplaceAccess, utl::OEventListenerAdapter::startComponentListening(), and utl::OEventListenerAdapter::stopAllComponentListening().
OConfigurationNode & utl::OConfigurationNode::operator= | ( | OConfigurationNode && | _rSource | ) |
Definition at line 121 of file confignode.cxx.
References m_bEscapeNames, m_xContainerAccess, m_xDirectAccess, m_xHierarchyAccess, m_xReplaceAccess, utl::OEventListenerAdapter::startComponentListening(), and utl::OEventListenerAdapter::stopAllComponentListening().
|
noexcept |
remove an existent child nod
If the object represents a set node, this method may be used to delete an existent child. For non-set-nodes, the method will fail.
Definition at line 207 of file confignode.cxx.
References Exception, SAL_WARN, sName, and TOOLS_WARN_EXCEPTION.
|
inline |
Definition at line 128 of file confignode.hxx.
|
noexcept |
write a node valueThe value given is written into the node specified by the given relative path.
In opposite to <method>getNodeValue</method>, _rName must refer to a leaf in the configuration tree, not an inner node.
|
private |
modifying set nodes (optional interface of our UNO object)
Definition at line 51 of file confignode.hxx.
Referenced by normalizeName(), and operator=().
|
private |
replacing child values
Definition at line 50 of file confignode.hxx.
Referenced by clear(), and operator=().
|
private |
accessing children grandchildren (mandatory interface of our UNO object)
Definition at line 46 of file confignode.hxx.
Referenced by _disposing(), clear(), getLocalName(), getNodeNames(), normalizeName(), OConfigurationNode(), and operator=().
|
private |
Definition at line 44 of file confignode.hxx.
Referenced by clear(), isSetNode(), and operator=().
|
private |
accessing children (mandatory interface of our UNO object)
Definition at line 48 of file confignode.hxx.
Referenced by clear(), and operator=().