LibreOffice Module cppuhelper (master) 1
Public Member Functions | Private Member Functions | Private Attributes | List of all members
cppu::OInterfaceIteratorHelper Class Reference

This is the iterator of an InterfaceContainerHelper. More...

#include <interfacecontainer.h>

Collaboration diagram for cppu::OInterfaceIteratorHelper:
[legend]

Public Member Functions

 OInterfaceIteratorHelper (OInterfaceContainerHelper &rCont)
 Create an iterator over the elements of the container. More...
 
 ~OInterfaceIteratorHelper ()
 Releases the connection to the container. More...
 
bool SAL_CALL hasMoreElements () const
 Return true, if there are more elements in the iterator. More...
 
css::uno::XInterface *SAL_CALL next ()
 Return the next element of the iterator. More...
 
void SAL_CALL remove ()
 Removes the current element (the last one returned by next()) from the underlying container. More...
 

Private Member Functions

 OInterfaceIteratorHelper (const OInterfaceIteratorHelper &) SAL_DELETED_FUNCTION
 
OInterfaceIteratorHelperoperator= (const OInterfaceIteratorHelper &) SAL_DELETED_FUNCTION
 

Private Attributes

OInterfaceContainerHelperrCont
 
sal_Bool bIsList
 
detail::element_alias aData
 
sal_Int32 nRemain
 

Detailed Description

This is the iterator of an InterfaceContainerHelper.

Typically one constructs an instance on the stack for one firing session. It is not allowed to assign or copy an instance of this class.

See also
OInterfaceContainerHelper

Definition at line 71 of file interfacecontainer.h.

Constructor & Destructor Documentation

◆ OInterfaceIteratorHelper() [1/2]

cppu::OInterfaceIteratorHelper::OInterfaceIteratorHelper ( OInterfaceContainerHelper rCont)

Create an iterator over the elements of the container.

The iterator copies the elements of the container. A change to the container during the lifetime of an iterator is allowed and does not affect the iterator-instance. The iterator and the container take cares themself for concurrent access, no additional guarding is necessary.

Remark: The copy is on demand. The iterator copy the elements only if the container change the contents. It is not allowed to destroy the container as long as an iterator exist.

Parameters
rContthe container of the elements.

Definition at line 42 of file interfacecontainer.cxx.

References aData, cppu::OInterfaceContainerHelper::aData, cppu::OInterfaceContainerHelper::bInUse, bIsList, cppu::OInterfaceContainerHelper::bIsList, cppu::OInterfaceContainerHelper::copyAndResetInUse(), nRemain, cppu::detail::element_alias::pAsInterface, cppu::detail::element_alias::pAsVector, rCont, and cppu::OInterfaceContainerHelper::rMutex.

◆ ~OInterfaceIteratorHelper()

cppu::OInterfaceIteratorHelper::~OInterfaceIteratorHelper ( )

◆ OInterfaceIteratorHelper() [2/2]

cppu::OInterfaceIteratorHelper::OInterfaceIteratorHelper ( const OInterfaceIteratorHelper )
private

Member Function Documentation

◆ hasMoreElements()

bool SAL_CALL cppu::OInterfaceIteratorHelper::hasMoreElements ( ) const
inline

Return true, if there are more elements in the iterator.

Definition at line 95 of file interfacecontainer.h.

Referenced by cppu::OInterfaceContainerHelper::disposeAndClear(), and cppu::OInterfaceContainerHelper::forEach().

◆ next()

XInterface * cppu::OInterfaceIteratorHelper::next ( )

Return the next element of the iterator.

Calling this method if hasMoreElements() has returned false, is an error. Cast the returned pointer to the

Definition at line 90 of file interfacecontainer.cxx.

References aData, bIsList, nRemain, cppu::detail::element_alias::pAsInterface, and cppu::detail::element_alias::pAsVector.

Referenced by cppu::OInterfaceContainerHelper::disposeAndClear(), and cppu::OInterfaceContainerHelper::forEach().

◆ operator=()

OInterfaceIteratorHelper & cppu::OInterfaceIteratorHelper::operator= ( const OInterfaceIteratorHelper )
private

◆ remove()

void cppu::OInterfaceIteratorHelper::remove ( )

Removes the current element (the last one returned by next()) from the underlying container.

Calling this method before next() has been called or calling it twice with no next() inbetween is an error.

Definition at line 105 of file interfacecontainer.cxx.

References aData, bIsList, get(), o3tl::make_unsigned(), nRemain, p, cppu::detail::element_alias::pAsInterface, cppu::detail::element_alias::pAsVector, rCont, and cppu::OInterfaceContainerHelper::removeInterface().

Referenced by cppu::OInterfaceContainerHelper::forEach().

Member Data Documentation

◆ aData

detail::element_alias cppu::OInterfaceIteratorHelper::aData
private

◆ bIsList

sal_Bool cppu::OInterfaceIteratorHelper::bIsList
private

◆ nRemain

sal_Int32 cppu::OInterfaceIteratorHelper::nRemain
private

Definition at line 116 of file interfacecontainer.h.

Referenced by next(), OInterfaceIteratorHelper(), and remove().

◆ rCont

OInterfaceContainerHelper& cppu::OInterfaceIteratorHelper::rCont
private

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