LibreOffice Module comphelper (master) 1
Classes | Public Member Functions | Protected Member Functions | Static Protected Member Functions | Private Attributes | List of all members
comphelper::ComponentBase Class Reference

#include <componentbase.hxx>

Collaboration diagram for comphelper::ComponentBase:
[legend]

Classes

struct  GuardAccess
 helper struct to grant access to selected public methods to the ComponentMethodGuard class More...
 
struct  NoInitializationNeeded
 

Public Member Functions

::osl::Mutex & getMutex (GuardAccess)
 retrieves the component's mutex More...
 
void checkDisposed (GuardAccess) const
 checks whether the component is already disposed, throws a DisposedException if so. More...
 
void checkInitialized (GuardAccess) const
 checks whether the component is already initialized, throws a NotInitializedException if not. More...
 

Protected Member Functions

 ComponentBase (::cppu::OBroadcastHelper &_rBHelper)
 creates a ComponentBase instance More...
 
 ComponentBase (::cppu::OBroadcastHelper &_rBHelper, NoInitializationNeeded)
 creates a ComponentBase instance More...
 
 ~ComponentBase () COVERITY_NOEXCEPT_FALSE
 
void setInitialized ()
 marks the instance as initialized More...
 
::cppu::OBroadcastHelpergetBroadcastHelper ()
 retrieves the component's broadcast helper More...
 
::osl::Mutex & getMutex ()
 retrieves the component's mutex More...
 
bool impl_isDisposed () const
 determines whether the instance is already disposed More...
 
bool impl_isInitialized_nothrow () const
 determines whether the component is already initialized More...
 

Static Protected Member Functions

static css::uno::Reference< css::uno::XInterface > getComponent ()
 returns the context to be used when throwing exceptions More...
 

Private Attributes

::cppu::OBroadcastHelperm_rBHelper
 
bool m_bInitialized
 

Detailed Description

Definition at line 33 of file componentbase.hxx.

Constructor & Destructor Documentation

◆ ComponentBase() [1/2]

comphelper::ComponentBase::ComponentBase ( ::cppu::OBroadcastHelper _rBHelper)
inlineprotected

creates a ComponentBase instance

The instance is not initialized. As a consequence, every ComponentMethodGuard instantiated for this component will throw a css::lang::NotInitializedException, until ->setInitialized() is called.

Definition at line 42 of file componentbase.hxx.

◆ ComponentBase() [2/2]

comphelper::ComponentBase::ComponentBase ( ::cppu::OBroadcastHelper _rBHelper,
NoInitializationNeeded   
)
inlineprotected

creates a ComponentBase instance

The instance is already initialized, so there's no need to call setInitialized later on. Use this constructor for component implementations which do not require explicit initialization.

Definition at line 55 of file componentbase.hxx.

◆ ~ComponentBase()

comphelper::ComponentBase::~ComponentBase ( )
inlineprotected

Definition at line 61 of file componentbase.hxx.

Member Function Documentation

◆ checkDisposed()

void comphelper::ComponentBase::checkDisposed ( GuardAccess  ) const

checks whether the component is already disposed, throws a DisposedException if so.

Definition at line 36 of file componentbase.cxx.

References cppu::OBroadcastHelperVar< class container, class keyType >::bDisposed, getComponent(), and m_rBHelper.

Referenced by comphelper::ComponentMethodGuard::ComponentMethodGuard().

◆ checkInitialized()

void comphelper::ComponentBase::checkInitialized ( GuardAccess  ) const

checks whether the component is already initialized, throws a NotInitializedException if not.

Definition at line 43 of file componentbase.cxx.

References getComponent(), and m_bInitialized.

Referenced by comphelper::ComponentMethodGuard::ComponentMethodGuard().

◆ getBroadcastHelper()

::cppu::OBroadcastHelper & comphelper::ComponentBase::getBroadcastHelper ( )
inlineprotected

retrieves the component's broadcast helper

Definition at line 82 of file componentbase.hxx.

◆ getComponent()

Reference< XInterface > comphelper::ComponentBase::getComponent ( )
staticprotected

returns the context to be used when throwing exceptions

The default implementation returns <NULL>.

Definition at line 50 of file componentbase.cxx.

Referenced by checkDisposed(), and checkInitialized().

◆ getMutex() [1/2]

::osl::Mutex & comphelper::ComponentBase::getMutex ( )
inlineprotected

retrieves the component's mutex

Definition at line 84 of file componentbase.hxx.

◆ getMutex() [2/2]

::osl::Mutex & comphelper::ComponentBase::getMutex ( GuardAccess  )
inline

retrieves the component's mutex

Definition at line 74 of file componentbase.hxx.

References getMutex().

Referenced by getMutex().

◆ impl_isDisposed()

bool comphelper::ComponentBase::impl_isDisposed ( ) const
inlineprotected

determines whether the instance is already disposed

Definition at line 86 of file componentbase.hxx.

◆ impl_isInitialized_nothrow()

bool comphelper::ComponentBase::impl_isInitialized_nothrow ( ) const
inlineprotected

determines whether the component is already initialized

Definition at line 90 of file componentbase.hxx.

◆ setInitialized()

void comphelper::ComponentBase::setInitialized ( )
inlineprotected

marks the instance as initialized

Subsequent instantiations of a ComponentMethodGuard won't throw the NotInitializedException now.

Definition at line 67 of file componentbase.hxx.

Member Data Documentation

◆ m_bInitialized

bool comphelper::ComponentBase::m_bInitialized
private

Definition at line 101 of file componentbase.hxx.

Referenced by checkInitialized().

◆ m_rBHelper

::cppu::OBroadcastHelper& comphelper::ComponentBase::m_rBHelper
private

Definition at line 100 of file componentbase.hxx.

Referenced by checkDisposed().


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