LibreOffice
LibreOffice 5.3 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Types | Public Member Functions | List of all members
com::sun::star::uno::Sequence< typename > Class Template Reference

Template C++ class representing an IDL sequence. More...

#include <unotype.hxx>

Public Types

typedef E ElementType
 typedefs the element type of the sequence More...
 

Public Member Functions

 Sequence ()
 Default constructor: Creates an empty sequence. More...
 
 Sequence (const Sequence &rSeq)
 Copy constructor: Creates a copy of given sequence. More...
 
 Sequence (uno_Sequence *pSequence, __sal_NoAcquire dummy)
 Constructor: Takes over ownership of given sequence. More...
 
 Sequence (const E *pElements, sal_Int32 len)
 Constructor: Creates a copy of given elements. More...
 
 Sequence (sal_Int32 len)
 Constructor: Creates a default constructed sequence of given length. More...
 
 ~Sequence ()
 Destructor: Releases sequence handle. More...
 
Sequenceoperator= (const Sequence &rSeq)
 Assignment operator: Acquires given sequence handle and releases previously set handle. More...
 
sal_Int32 getLength () const
 Gets length of the sequence. More...
 
bool hasElements () const
 Tests whether the sequence has elements, i.e. More...
 
const E * getConstArray () const
 Gets a pointer to elements array for reading. More...
 
E * getArray ()
 Gets a pointer to elements array for reading and writing. More...
 
E * begin ()
 This function allows to use Sequence in standard algorightms, like std::find and others. More...
 
E const * begin () const
 This function allows to use Sequence in standard algorightms, like std::find and others. More...
 
E * end ()
 This function allows to use Sequence in standard algorightms, like std::find and others. More...
 
E const * end () const
 This function allows to use Sequence in standard algorightms, like std::find and others. More...
 
E & operator[] (sal_Int32 nIndex)
 Non-const index operator: Obtains a reference to element indexed at given position. More...
 
const E & operator[] (sal_Int32 nIndex) const
 Const index operator: Obtains a reference to element indexed at given position. More...
 
bool operator== (const Sequence &rSeq) const
 Equality operator: Compares two sequences. More...
 
bool operator!= (const Sequence &rSeq) const
 Unequality operator: Compares two sequences. More...
 
void realloc (sal_Int32 nSize)
 Reallocates sequence to new length. More...
 
uno_Sequenceget () const
 Provides UNacquired sequence handle. More...
 

Detailed Description

template<typename>
class com::sun::star::uno::Sequence< typename >

Template C++ class representing an IDL sequence.

Template argument is the sequence element type. C++ Sequences are reference counted and shared, so the sequence keeps a handle to its data. To keep value semantics, copies are only generated if the sequence is to be modified (new handle).

Template Parameters
Eelement type of sequence

Member Typedef Documentation

template<typename >
typedef E com::sun::star::uno::Sequence< typename >::ElementType

typedefs the element type of the sequence

Constructor & Destructor Documentation

template<class E >
com::sun::star::uno::Sequence< E >::Sequence ( )
inline

Default constructor: Creates an empty sequence.

template<class E >
com::sun::star::uno::Sequence< E >::Sequence ( const Sequence< typename > &  rSeq)
inline

Copy constructor: Creates a copy of given sequence.

Parameters
rSeqanother sequence of same type
template<class E >
com::sun::star::uno::Sequence< E >::Sequence ( uno_Sequence< typename > *  pSequence,
__sal_NoAcquire  dummy 
)
inline

Constructor: Takes over ownership of given sequence.

Parameters
pSequencea sequence
dummySAL_NO_ACQUIRE to force obvious distinction to other constructors
template<class E >
com::sun::star::uno::Sequence< E >::Sequence ( const E *  pElements,
sal_Int32  len 
)
inline

Constructor: Creates a copy of given elements.

Parameters
pElementsan array of elements
lenlength of array
template<class E >
com::sun::star::uno::Sequence< E >::Sequence ( sal_Int32  len)
inlineexplicit

Constructor: Creates a default constructed sequence of given length.

Parameters
leninitial sequence length
template<class E >
com::sun::star::uno::Sequence< E >::~Sequence ( )
inline

Destructor: Releases sequence handle.

Last handle will destruct elements and free memory.

Member Function Documentation

template<class E >
E * com::sun::star::uno::Sequence< E >::begin ( )
inline

This function allows to use Sequence in standard algorightms, like std::find and others.

Since
LibreOffice 4.2
template<class E >
E const * com::sun::star::uno::Sequence< E >::begin ( ) const
inline

This function allows to use Sequence in standard algorightms, like std::find and others.

Since
LibreOffice 4.2
template<class E >
E * com::sun::star::uno::Sequence< E >::end ( )
inline

This function allows to use Sequence in standard algorightms, like std::find and others.

Since
LibreOffice 4.2
template<class E >
E const * com::sun::star::uno::Sequence< E >::end ( ) const
inline

This function allows to use Sequence in standard algorightms, like std::find and others.

Since
LibreOffice 4.2
template<typename >
uno_Sequence* com::sun::star::uno::Sequence< typename >::get ( ) const
inline

Provides UNacquired sequence handle.

Returns
UNacquired sequence handle
template<class E >
E * com::sun::star::uno::Sequence< E >::getArray ( )
inline

Gets a pointer to elements array for reading and writing.

In general if the sequence has a handle acquired by other sequences (reference count > 1), then a new sequence is created copy constructing all elements to keep value semantics! If the sequence has a length of 0, then the returned pointer is undefined.

Returns
pointer to elements array
template<typename >
const E* com::sun::star::uno::Sequence< typename >::getConstArray ( ) const
inline

Gets a pointer to elements array for reading.

If the sequence has a length of 0, then the returned pointer is undefined.

Returns
pointer to elements array
template<typename >
sal_Int32 com::sun::star::uno::Sequence< typename >::getLength ( ) const
inline

Gets length of the sequence.

Returns
length of sequence
template<typename >
bool com::sun::star::uno::Sequence< typename >::hasElements ( ) const
inline

Tests whether the sequence has elements, i.e.

elements count is greater than zero.

Returns
true, if elements count is greater than zero
template<class E >
bool com::sun::star::uno::Sequence< E >::operator!= ( const Sequence< typename > &  rSeq) const
inline

Unequality operator: Compares two sequences.

Parameters
rSeqanother sequence of same type (right side)
Returns
false if both sequences are equal, true otherwise
template<class E >
Sequence< E > & com::sun::star::uno::Sequence< E >::operator= ( const Sequence< typename > &  rSeq)
inline

Assignment operator: Acquires given sequence handle and releases previously set handle.

Parameters
rSeqanother sequence of same type
Returns
this sequence
template<class E >
bool com::sun::star::uno::Sequence< E >::operator== ( const Sequence< typename > &  rSeq) const
inline

Equality operator: Compares two sequences.

Parameters
rSeqanother sequence of same type (right side)
Returns
true if both sequences are equal, false otherwise
template<class E >
E & com::sun::star::uno::Sequence< E >::operator[] ( sal_Int32  nIndex)
inline

Non-const index operator: Obtains a reference to element indexed at given position.

The implementation does not check for array bounds! In general if the sequence has a handle acquired by other sequences (reference count > 1), then a new sequence is created copy constructing all elements to keep value semantics!

Parameters
nIndexindex
Returns
non-const C++ reference to element
template<class E >
const E & com::sun::star::uno::Sequence< E >::operator[] ( sal_Int32  nIndex) const
inline

Const index operator: Obtains a reference to element indexed at given position.

The implementation does not check for array bounds!

Parameters
nIndexindex
Returns
const C++ reference to element
template<class E >
void com::sun::star::uno::Sequence< E >::realloc ( sal_Int32  nSize)
inline

Reallocates sequence to new length.

If the new length is smaller than the former, then upper elements will be destructed (and their memory freed). If the new length is greater than the former, then upper (new) elements are default constructed. If the sequence has a handle acquired by other sequences (reference count > 1), then the remaining elements are copy constructed to a new sequence handle to keep value semantics!

Parameters
nSizenew size of sequence

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