LibreOffice Module unotools (master) 1
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
utl::OConfigurationTreeRoot Class Referencefinal

a specialized version of an OConfigurationNode, representing the root of a configuration sub treeOnly this class is able to commit any changes made any any OConfigurationNode objects. More...

#include <confignode.hxx>

Inheritance diagram for utl::OConfigurationTreeRoot:
[legend]
Collaboration diagram for utl::OConfigurationTreeRoot:
[legend]

Public Types

enum  CREATION_MODE {
  CM_READONLY ,
  CM_UPDATABLE
}
 modes to use when creating a top-level node object More...
 

Public Member Functions

 OConfigurationTreeRoot ()
 default ctorThe object constructed here is invalid (i.e. More...
 
 OConfigurationTreeRoot (const css::uno::Reference< css::uno::XComponentContext > &i_rContext, const OUString &i_rNodePath, const bool i_bUpdatable)
 creates a configuration tree for the given path in the given mode More...
 
bool commit () const noexcept
 commit all changes made on the subtree the object is the root forAll changes made on any OConfigurationNode object retrieved (maybe indirect) from this root object are committed when calling this method. More...
 
virtual void clear () noexcept override
 invalidate the object More...
 
- Public Member Functions inherited from utl::OConfigurationNode
 OConfigurationNode ()
 constructs an empty and invalid node object More...
 
 OConfigurationNode (const OConfigurationNode &_rSource)
 copy ctor More...
 
 OConfigurationNode (OConfigurationNode &&_rSource)
 move ctor More...
 
OConfigurationNodeoperator= (const OConfigurationNode &_rSource)
 assignment More...
 
OConfigurationNodeoperator= (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...
 

Static Public Member Functions

static OConfigurationTreeRoot createWithProvider (const css::uno::Reference< css::lang::XMultiServiceFactory > &_rxConfProvider, const OUString &_rPath, sal_Int32 _nDepth, CREATION_MODE _eMode)
 open a new top-level configuration node More...
 
static OConfigurationTreeRoot createWithComponentContext (const css::uno::Reference< css::uno::XComponentContext > &_rxContext, const OUString &_rPath, sal_Int32 _nDepth=-1, CREATION_MODE _eMode=CM_UPDATABLE)
 open a new top-level configuration nodeopens a new node which is the root if an own configuration sub tree. More...
 
static OConfigurationTreeRoot tryCreateWithComponentContext (const css::uno::Reference< css::uno::XComponentContext > &rxContext, const OUString &_rPath, sal_Int32 _nDepth=-1, CREATION_MODE _eMode=CM_UPDATABLE)
 tolerant version of the <member>createWithServiceFactory</member> More...
 

Private Member Functions

 OConfigurationTreeRoot (const css::uno::Reference< css::uno::XInterface > &_rxRootNode)
 ctor for a readonly node More...
 

Private Attributes

css::uno::Reference< css::util::XChangesBatch > m_xCommitter
 

Additional Inherited Members

- Protected Types inherited from utl::OConfigurationNode
enum  NAMEORIGIN {
  NO_CONFIGURATION ,
  NO_CALLER
}
 
- Protected Member Functions inherited from utl::OConfigurationNode
 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
 

Detailed Description

a specialized version of an OConfigurationNode, representing the root of a configuration sub tree

Only this class is able to commit any changes made any any OConfigurationNode objects.

Definition at line 177 of file confignode.hxx.

Member Enumeration Documentation

◆ CREATION_MODE

modes to use when creating a top-level node object

Enumerator
CM_READONLY 

open the node (i.e. sub tree) for read access only

CM_UPDATABLE 

open the node (i.e. sub tree) for read and write access, fall back to read-only if write access is not possible

Definition at line 189 of file confignode.hxx.

Constructor & Destructor Documentation

◆ OConfigurationTreeRoot() [1/3]

utl::OConfigurationTreeRoot::OConfigurationTreeRoot ( const css::uno::Reference< css::uno::XInterface > &  _rxRootNode)
private

ctor for a readonly node

◆ OConfigurationTreeRoot() [2/3]

utl::OConfigurationTreeRoot::OConfigurationTreeRoot ( )
inline

default ctorThe object constructed here is invalid (i.e.

<method>isValid</method> will return sal_False).

Definition at line 201 of file confignode.hxx.

Referenced by createWithProvider(), and tryCreateWithComponentContext().

◆ OConfigurationTreeRoot() [3/3]

utl::OConfigurationTreeRoot::OConfigurationTreeRoot ( const css::uno::Reference< css::uno::XComponentContext > &  i_rContext,
const OUString &  i_rNodePath,
const bool  i_bUpdatable 
)

creates a configuration tree for the given path in the given mode

Member Function Documentation

◆ clear()

void utl::OConfigurationTreeRoot::clear ( )
overridevirtualnoexcept

invalidate the object

Reimplemented from utl::OConfigurationNode.

Definition at line 503 of file confignode.cxx.

References utl::OConfigurationNode::clear(), and m_xCommitter.

◆ commit()

bool utl::OConfigurationTreeRoot::commit ( ) const
noexcept

commit all changes made on the subtree the object is the root forAll changes made on any OConfigurationNode object retrieved (maybe indirect) from this root object are committed when calling this method.

Returns
sal_True if and only if the commit was successful

Definition at line 509 of file confignode.cxx.

References DBG_UNHANDLED_EXCEPTION, Exception, utl::OConfigurationNode::isValid(), and m_xCommitter.

◆ createWithComponentContext()

OConfigurationTreeRoot utl::OConfigurationTreeRoot::createWithComponentContext ( const css::uno::Reference< css::uno::XComponentContext > &  _rxContext,
const OUString &  _rPath,
sal_Int32  _nDepth = -1,
CREATION_MODE  _eMode = CM_UPDATABLE 
)
static

open a new top-level configuration nodeopens a new node which is the root if an own configuration sub tree.

This is what "top level" means: The node does not have a parent. It does not mean that the node represents a module tree (like org.openoffice.Office.Writer or such).
In opposite to <method>createWithProvider</method>, createWithProvider expects a service factory. This factory is used to create a configuration provider, and this provider is used to retrieve the node

See also
createWithProvider
Parameters
_rxContextservice factory to use to create the configuration provider.
_rPathpath to the node the object should represent
_nDepthdepth for node retrieval
_eModespecifies which privileges should be applied when retrieving the node

Definition at line 539 of file confignode.cxx.

References createWithProvider().

◆ createWithProvider()

OConfigurationTreeRoot utl::OConfigurationTreeRoot::createWithProvider ( const css::uno::Reference< css::lang::XMultiServiceFactory > &  _rxConfProvider,
const OUString &  _rPath,
sal_Int32  _nDepth,
CREATION_MODE  _eMode 
)
static

open a new top-level configuration node

opens a new node which is the root if an own configuration sub tree. This is what "top level" means: The node does not have a parent. It does not mean that the node represents a module tree (like org.openoffice.Office.Writer or such).
In opposite to <method>createWithServiceFactory</method>, createWithProvider expects a configuration provider to work with.

Parameters
_rxConfProviderconfiguration provider to use when retrieving the node.
_rPathpath to the node the object should represent
_nDepthdepth for node retrieval
_eModespecifies which privileges should be applied when retrieving the node
See also
createWithServiceFactory

Definition at line 530 of file confignode.cxx.

References CM_READONLY, and OConfigurationTreeRoot().

Referenced by createWithComponentContext(), and tryCreateWithComponentContext().

◆ tryCreateWithComponentContext()

OConfigurationTreeRoot utl::OConfigurationTreeRoot::tryCreateWithComponentContext ( const css::uno::Reference< css::uno::XComponentContext > &  rxContext,
const OUString &  _rPath,
sal_Int32  _nDepth = -1,
CREATION_MODE  _eMode = CM_UPDATABLE 
)
static

tolerant version of the <member>createWithServiceFactory</member>

No assertions are thrown in case of a failure to initialize the configuration service, but once the configuration could be initialized, errors in the creation of the specific node (e.g. because the given node path does not exist) are still asserted.

Definition at line 544 of file confignode.cxx.

References createWithProvider(), Exception, Translate::get(), and OConfigurationTreeRoot().

Member Data Documentation

◆ m_xCommitter

css::uno::Reference< css::util::XChangesBatch > utl::OConfigurationTreeRoot::m_xCommitter
private

Definition at line 180 of file confignode.hxx.

Referenced by clear(), and commit().


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