summaryrefslogtreecommitdiff
path: root/include/com
diff options
context:
space:
mode:
authorMarcos Paulo de Souza <marcos.souza.org@gmail.com>2013-11-06 15:07:46 -0200
committerStephan Bergmann <sbergman@redhat.com>2013-11-07 10:43:34 -0600
commitbcb51cff22f385abe71555f8d7fdbec2697bf188 (patch)
tree4ca8f3c2b755a018f96d03ff43da2dc0ee0f6c69 /include/com
parentd877941fc7bb690d0c5b132a914920cf65f8abb2 (diff)
fdo#63020: Replace ::comphelper::stl_begin()...
And use some templates inside include/com/sun/star/uno/Sequence.hxx Change-Id: I48875fa1517751fc4cb0cf2b6c08b88975a29b47 Reviewed-on: https://gerrit.libreoffice.org/6599 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include/com')
-rw-r--r--include/com/sun/star/uno/Sequence.h28
-rw-r--r--include/com/sun/star/uno/Sequence.hxx24
2 files changed, 38 insertions, 14 deletions
diff --git a/include/com/sun/star/uno/Sequence.h b/include/com/sun/star/uno/Sequence.h
index d57200ad3144..0e180a576119 100644
--- a/include/com/sun/star/uno/Sequence.h
+++ b/include/com/sun/star/uno/Sequence.h
@@ -163,6 +163,34 @@ public:
*/
inline E * SAL_CALL getArray();
+ /** This function allows to use Sequence in standard algorightms, like std::find
+ and others.
+
+ @since LibreOffice 4.2
+ */
+ inline E * begin();
+
+ /** This function allows to use Sequence in standard algorightms, like std::find
+ and others.
+
+ @since LibreOffice 4.2
+ */
+ inline E const * begin() const;
+
+ /** This function allows to use Sequence in standard algorightms, like std::find
+ and others.
+
+ @since LibreOffice 4.2
+ */
+ inline E * end();
+
+ /** This function allows to use Sequence in standard algorightms, like std::find
+ and others.
+
+ @since LibreOffice 4.2
+ */
+ inline E const * end() const;
+
/** Non-const index operator: Obtains a reference to element indexed at
given position.
The implementation does not check for array bounds!
diff --git a/include/com/sun/star/uno/Sequence.hxx b/include/com/sun/star/uno/Sequence.hxx
index a37a222c7b72..6e009f52af6a 100644
--- a/include/com/sun/star/uno/Sequence.hxx
+++ b/include/com/sun/star/uno/Sequence.hxx
@@ -44,7 +44,6 @@ template< class E >
typelib_TypeDescriptionReference * Sequence< E >::s_pType = 0;
/// @endcond
-//______________________________________________________________________________
template< class E >
inline Sequence< E >::Sequence() SAL_THROW(())
{
@@ -55,7 +54,6 @@ inline Sequence< E >::Sequence() SAL_THROW(())
// no bad_alloc, because empty sequence is statically allocated in cppu
}
-//______________________________________________________________________________
template< class E >
inline Sequence< E >::Sequence( const Sequence< E > & rSeq ) SAL_THROW(())
{
@@ -63,7 +61,6 @@ inline Sequence< E >::Sequence( const Sequence< E > & rSeq ) SAL_THROW(())
_pSequence = rSeq._pSequence;
}
-//______________________________________________________________________________
template< class E >
inline Sequence< E >::Sequence(
uno_Sequence * pSequence, __sal_NoAcquire ) SAL_THROW(())
@@ -71,7 +68,6 @@ inline Sequence< E >::Sequence(
{
}
-//______________________________________________________________________________
template< class E >
inline Sequence< E >::Sequence( const E * pElements, sal_Int32 len )
{
@@ -84,7 +80,6 @@ inline Sequence< E >::Sequence( const E * pElements, sal_Int32 len )
throw ::std::bad_alloc();
}
-//______________________________________________________________________________
template< class E >
inline Sequence< E >::Sequence( sal_Int32 len )
{
@@ -97,7 +92,6 @@ inline Sequence< E >::Sequence( sal_Int32 len )
throw ::std::bad_alloc();
}
-//______________________________________________________________________________
template< class E >
inline Sequence< E >::~Sequence() SAL_THROW(())
{
@@ -106,7 +100,6 @@ inline Sequence< E >::~Sequence() SAL_THROW(())
this, rType.getTypeLibType(), (uno_ReleaseFunc)cpp_release );
}
-//______________________________________________________________________________
template< class E >
inline Sequence< E > & Sequence< E >::operator = ( const Sequence< E > & rSeq ) SAL_THROW(())
{
@@ -116,7 +109,6 @@ inline Sequence< E > & Sequence< E >::operator = ( const Sequence< E > & rSeq )
return *this;
}
-//______________________________________________________________________________
template< class E >
inline sal_Bool Sequence< E >::operator == ( const Sequence< E > & rSeq ) const
SAL_THROW(())
@@ -131,7 +123,6 @@ inline sal_Bool Sequence< E >::operator == ( const Sequence< E > & rSeq ) const
(uno_ReleaseFunc)cpp_release );
}
-//______________________________________________________________________________
template< class E >
inline sal_Bool Sequence< E >::operator != ( const Sequence< E > & rSeq ) const
SAL_THROW(())
@@ -139,7 +130,6 @@ inline sal_Bool Sequence< E >::operator != ( const Sequence< E > & rSeq ) const
return (! operator == ( rSeq ));
}
-//______________________________________________________________________________
template< class E >
inline E * Sequence< E >::getArray()
{
@@ -153,7 +143,16 @@ inline E * Sequence< E >::getArray()
return reinterpret_cast< E * >( _pSequence->elements );
}
-//______________________________________________________________________________
+template<class E> E * Sequence<E>::begin() { return getArray(); }
+
+template<class E> E const * Sequence<E>::begin() const
+{ return getConstArray(); }
+
+template<class E> E * Sequence<E>::end() { return begin() + getLength(); }
+
+template<class E> E const * Sequence<E>::end() const
+{ return begin() + getLength(); }
+
template< class E >
inline E & Sequence< E >::operator [] ( sal_Int32 nIndex )
{
@@ -161,7 +160,6 @@ inline E & Sequence< E >::operator [] ( sal_Int32 nIndex )
return getArray()[ nIndex ];
}
-//______________________________________________________________________________
template< class E >
inline const E & Sequence< E >::operator [] ( sal_Int32 nIndex ) const
SAL_THROW(())
@@ -170,7 +168,6 @@ inline const E & Sequence< E >::operator [] ( sal_Int32 nIndex ) const
return reinterpret_cast< const E * >( _pSequence->elements )[ nIndex ];
}
-//______________________________________________________________________________
template< class E >
inline void Sequence< E >::realloc( sal_Int32 nSize )
{
@@ -183,7 +180,6 @@ inline void Sequence< E >::realloc( sal_Int32 nSize )
throw ::std::bad_alloc();
}
-//------------------------------------------------------------------------------
inline ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL toUnoSequence(
const ::rtl::ByteSequence & rByteSequence ) SAL_THROW(())
{