diff options
author | Release Engineers <releng@openoffice.org> | 2009-08-27 15:54:55 +0000 |
---|---|---|
committer | Release Engineers <releng@openoffice.org> | 2009-08-27 15:54:55 +0000 |
commit | a3f1ad73fb8a8e84ee5ecd58b7f6a41460d09b49 (patch) | |
tree | 38cce455bb011b2cd016111319b24b8f61f60452 /comphelper/inc | |
parent | d30c818de2aa67effa98d57a40e25f3bde37267a (diff) |
CWS-TOOLING: integrate CWS bjm02
2009-08-12 Bjoern Michaelsen #i101879# moved officeversion from envelope body to requestbody
2009-08-11 Bjoern Michaelsen #i103732# reverting changeset f3f527950572
2009-08-10 Bjoern Michaelsen cws bjm02: merging local minibranches
2009-08-10 Bjoern Michaelsen #i104128# remove additional duplication in svx headers, remove license header merge conflicts in svx headers
2009-08-10 Bjoern Michaelsen #i100484# fixed buildbreaker on win32
2009-08-10 Bjoern Michaelsen #i104128# remove duplication in svx headers
2009-08-04 Bjoern Michaelsen #i103913# fixed bookmark updating when moving numbered para
2009-08-03 Bjoern Michaelsen #i101879# include officeversion/productname in soaprequest
2009-07-31 Bjoern Michaelsen #i84926# Selecting all in blockmode automatically falls back to std mode
2009-07-31 Bjoern Michaelsen #i100484# operation on 'pCmpLine' may be undefined, thanks cmc
2009-07-29 Bjoern Michaelsen #i103059# fixing crash on empty enumeration
2009-07-29 Bjoern Michaelsen #i98659# fixing typo in usagetracking option tabpage
2009-07-29 Bjoern Michaelsen #i103732# not triggering loading of oooimprovement dll if usage tracking is disabled
2009-07-29 Bjoern Michaelsen #i103036# stlunosequence can be use simple array-pointers as iterators, fixing used type in xmloff
2009-07-29 Bjoern Michaelsen #i103036# stlunosequence can be use simple array-pointers as iterators
2009-07-29 Bjoern Michaelsen #i103182# completely removing unused functions in extensions/oooimprovement
2009-07-28 Bjoern Michaelsen cws bjm02: merged changes from master up to milestone DEV300_m53
2009-06-29 Bjoern Michaelsen #i103182# commenting out getFailedAttempts(..) for future use
2009-06-29 Bjoern Michaelsen #i103183# removed unused function sw::mark::CrossRefBookmark::IsLegalName(..)
2009-06-29 Bjoern Michaelsen #i103182# removing unused functions in extensions/oooimprovement
2009-06-24 Bjoern Michaelsen #i103059# not using enumeration for getByName/getByIndex
2009-06-24 Bjoern Michaelsen #i103059# not using enumeration for hasByName/GetCount/hasElements for performance reasons
2009-06-24 Bjoern Michaelsen #i103036# stlunosequence can be use simple array-pointers as iterators
2009-08-27 releng CWS-TOOLING: integrate CWS hr65
2009-08-26 Jens-Heiner Rechtien #i104521#: implement 'setcurrent'; document --hg option to 'create'
2009-08-26 Jens-Heiner Rechtien #i104521#: SOAP method setSCMName() doesn't return a value
2009-08-26 Jens-Heiner Rechtien #i104521#: implement [set|get]_scm()
2009-08-26 Jens-Heiner Rechtien #i104521#: implement --hg switch to 'cws create'
2009-08-27 vg CWS-TOOLING: integrate CWS hr64_DEV300
2009-07-21 13:24:57 +0200 hr r274189 : #i99576#: re-enable optimization for tabcont.cxx
2009-07-21 13:17:18 +0200 hr r274188 : #i99592: disable -xspace optimization for Solaris x86 and SunStudio 12, due to some mis-optimzation in sc and elsewhere. SunStudio 12 update 1 is OK, but needs a few unrelated changes which will be implemented in DEV300 code line
2009-08-27 releng CWS-TOOLING: integrate CWS sw32bf02
2009-08-25 15:52:04 +0200 hde r275366 : reactived testcases hit by issue 102752
2009-08-21 13:52:17 +0200 od r275245 : #i102921# delete files whose deletion has been forgotten in cws impress172
2009-08-21 11:20:47 +0200 od r275225 : CWS-TOOLING: rebase CWS sw32bf02 to trunk@275001 (milestone: DEV300:m55)
2009-08-20 16:21:30 +0200 od r275191 : #i92511# method <lcl_MoveAllLowerObjs(..)>
- invalidation of cache for object rectangle inclusive spaces is needed.
2009-08-20 15:50:40 +0200 od r275188 : #i96726# method <SwPagePreView::DocSzChgd(..)>
- trigger recalculation of page preview layout even if the count of pages is not changing
2009-08-20 12:37:32 +0200 od r275172 : #i100466# correction for showing and hiding redlines
2009-08-18 13:25:18 +0200 od r275100 : #i103817# method <XMLTextImportHelper::SetStyleAndAttrs(..)
- assure that a heading applies the outline style, if no other list style is applied.
2009-08-18 13:21:38 +0200 od r275098 : #i103817# allow the outline style - list style for outline numbering - to be set directly at the paragraph
2009-08-17 14:13:02 +0200 od r275052 : #i103684# add missing documentation for new optional OutlineLevel attribute introduced in OOo 3.1
2009-08-17 14:00:25 +0200 od r275049 : #i100481# method <XMLTextFrameContext_Impl::CreateChildContext(..)>#
- correct condition for handling embedded documents and embedded math objects
2009-08-12 14:11:34 +0200 od r274891 : #i97379# assure that columns are not applied to fly frames, which represent graphics or embedded objects
2009-08-12 12:51:43 +0200 od r274889 : #i101870# method <SwTxtNode::_MakeNewTxtNode(..)>
- perform action on different paragraph styles before applying new paragraph style
2009-08-12 12:24:44 +0200 od r274888 : #i101092# method <ViewShell::Paint(..)>
- encapsulate paint of document background and document into pre and post drawing layer paint calls
2009-08-12 11:38:48 +0200 od r274886 : #i98766# minor adjustment in order to be warning free under Mac port builds
2009-08-12 11:33:54 +0200 od r274885 : #i99267# method <SwTabFrm::MakeAll()>
- reset <bSplit> after forward move to assure that follows can be joined, if further space is available.
2009-08-12 11:11:49 +0200 od r274882 : #i98766# method <ViewShell::SmoothScroll(..)
- disable smooth scroll for Mac port builds
2009-08-10 12:17:58 +0200 od r274801 : CWS-TOOLING: rebase CWS sw32bf02 to trunk@274622 (milestone: DEV300:m54)
2009-07-21 16:56:45 +0200 od r274206 : #i103685# method <SwTxtFormatter::NewTabPortion(..)>
- adjust condition to apply automatic tab stop at left margin correctly
in case that tab stops are not relative to indent
2009-07-10 11:53:53 +0200 od r273883 : #i102752 method <SwDrawContact::Modify(..)>
- assure that a ShapePropertyChangeNotifier exists
2009-07-07 12:01:58 +0200 mst r273788 : #i103304# apply patch by dtardon to fix bogus conditional
2009-07-07 09:01:13 +0200 od r273767 : CWS-TOOLING: rebase CWS sw32bf02 to trunk@273468 (milestone: DEV300:m51)
2009-08-27 vg CWS-TOOLING: integrate CWS native264_DEV300
2009-08-13 11:58:58 +0200 is r274928 : #i104200# update to jre6u16
2009-08-27 vg CWS-TOOLING: integrate CWS automationdev300m54tables
2009-08-14 13:01:05 +0200 wg r274976 : i104224
2009-08-14 13:00:28 +0200 wg r274975 : i104224
2009-08-14 12:12:34 +0200 wg r274974 : i104222
2009-08-13 14:28:13 +0200 wg r274944 : i104205
2009-08-13 14:27:40 +0200 wg r274943 : i104205
2009-08-13 14:26:36 +0200 wg r274942 : i104205
Diffstat (limited to 'comphelper/inc')
-rw-r--r-- | comphelper/inc/comphelper/stlunosequence.hxx | 482 |
1 files changed, 41 insertions, 441 deletions
diff --git a/comphelper/inc/comphelper/stlunosequence.hxx b/comphelper/inc/comphelper/stlunosequence.hxx index a0ace84e8a6e..c9bc525cabd6 100644 --- a/comphelper/inc/comphelper/stlunosequence.hxx +++ b/comphelper/inc/comphelper/stlunosequence.hxx @@ -5,9 +5,9 @@ * * OpenOffice.org - a multi-platform office productivity suite * - * $RCSfile: stlunosequence.hxx,v $ + * $RCSfile: $ * - * $Revision: 1.3 $ + * $Revision: $ * * This file is part of OpenOffice.org. * @@ -31,459 +31,59 @@ #define _COMPHELPER_STLUNOITERATOR_HXX #include <com/sun/star/uno/Sequence.hxx> -#include <iterator> #include <sal/types.h> -namespace comphelper { namespace stlunosequence { - template<typename S, typename V> - class StlSequence; - - template<typename S, typename V> - class StlSequenceIterator : public std::iterator<std::random_access_iterator_tag, V, sal_Int32> - { - public: - typedef ::std::random_access_iterator_tag iterator_category; - typedef V& reference; - typedef V value_type; - typedef sal_Int32 difference_type; - typedef V* pointer; - typedef const V& const_reference; - - StlSequenceIterator(); - StlSequenceIterator(S * uno_sequence, typename StlSequenceIterator<S,V>::difference_type index); - - reference operator*() const; - StlSequenceIterator<S,V>& operator++(); - StlSequenceIterator<S,V> operator++(int); - StlSequenceIterator<S,V>& operator--(); - StlSequenceIterator<S,V> operator--(int); - StlSequenceIterator<S,V>& operator+=(const typename StlSequenceIterator<S,V>::difference_type by); - StlSequenceIterator<S,V>& operator-=(const typename StlSequenceIterator<S,V>::difference_type by); - StlSequenceIterator<S,V> operator+(const typename StlSequenceIterator<S,V>::difference_type by) const; - StlSequenceIterator<S,V> operator-(const typename StlSequenceIterator<S,V>::difference_type by) const; - typename StlSequenceIterator<S,V>::difference_type operator-(const StlSequenceIterator<S,V>& to) const; - - bool operator==(const StlSequenceIterator<S,V>& other) const; - bool operator!=(const StlSequenceIterator<S,V>& other) const; - bool operator<(const StlSequenceIterator<S,V>& other) const; - reference operator[](const typename StlSequenceIterator<S,V>::difference_type by) const; - - - protected: - friend class StlSequence<S,V>; - S * m_UnoSequence; - typename StlSequenceIterator<S,V>::difference_type m_Index; - }; - - template<typename S, typename V> - class StlSequenceConstIterator : public StlSequenceIterator<S,V> - { - public: - typedef const V& reference; - StlSequenceConstIterator(); - StlSequenceConstIterator(S * uno_sequence, typename StlSequenceIterator<S,V>::difference_type by); - typename StlSequenceIterator<S,V>::const_reference operator*() const - { - return (*(this->m_UnoSequence))[this->m_Index]; - } - - typename StlSequenceIterator<S,V>::const_reference operator[](const typename StlSequenceIterator<S,V>::difference_type by) const - { - return (*(this->m_UnoSequence))[this->m_Index+by]; - } - }; - - template<typename S, typename V> - class StlSequence - { - public: - typedef sal_Int32 size_type; - typedef V& reference; - typedef const V& const_reference; - typedef sal_Int32 difference_type; - typedef V value_type; - typedef StlSequenceIterator<S,V> iterator; - typedef StlSequenceConstIterator<S,V> const_iterator; - - StlSequence(S& uno_sequence); - - typename StlSequence<S,V>::size_type size() const; - typename StlSequence<S,V>::size_type max_size() const; - bool empty() const; - void swap(StlSequence<S,V>& other); - typename StlSequence<S,V>::iterator begin(); - typename StlSequence<S,V>::iterator end(); - typename StlSequence<S,V>::const_iterator begin() const; - typename StlSequence<S,V>::const_iterator end() const; - - bool operator==(const StlSequence<S,V>& other) const; - bool operator!=(const StlSequence<S,V>& other) const; - bool operator<(const StlSequence<S,V>& other) const; - bool operator>(const StlSequence<S,V>& other) const; - bool operator<=(const StlSequence<S,V>& other) const; - bool operator>=(const StlSequence<S,V>& other) const; - - - private: - friend class StlSequenceIterator<S,V>; - S * m_UnoSequence; - static const typename StlSequence<S,V>::size_type begin_of_sequence; - static const typename StlSequence<S,V>::size_type end_of_sequence; - }; - - //StlSequenceIterator - template<typename S, typename V> - StlSequenceIterator<S,V>::StlSequenceIterator() - : m_UnoSequence(0), m_Index(StlSequence<S,V>::end_of_sequence) - {} - - template<typename S, typename V> - StlSequenceConstIterator<S,V>::StlSequenceConstIterator() - {} - - template<typename S, typename V> - StlSequenceIterator<S, V>::StlSequenceIterator(S * uno_sequence, typename StlSequenceIterator<S,V>::difference_type index) - : m_UnoSequence(uno_sequence), m_Index(index) - {} - - template<typename S, typename V> - StlSequenceConstIterator<S, V>::StlSequenceConstIterator(S * uno_sequence, typename StlSequenceIterator<S,V>::difference_type index) - : StlSequenceIterator<S,V>(uno_sequence, index) - {} - - template<typename S, typename V> - inline typename StlSequenceIterator<S,V>::reference StlSequenceIterator<S, V>::operator*() const - { - return (*m_UnoSequence)[m_Index]; - } - - template<typename S, typename V> - inline StlSequenceIterator<S,V>& StlSequenceIterator<S, V>::operator++() - { - ++m_Index; - if(m_Index>=m_UnoSequence->getLength()) - m_Index = StlSequence<S,V>::end_of_sequence; - return *this; - } - - template<typename S, typename V> - inline StlSequenceIterator<S,V> StlSequenceIterator<S, V>::operator++(int) - { - StlSequenceIterator<S,V> temp = *this; - ++*this; - return temp; - } - - template<typename S, typename V> - inline StlSequenceIterator<S,V>& StlSequenceIterator<S, V>::operator--() - { - if(m_Index==StlSequence<S,V>::end_of_sequence) - m_Index = m_UnoSequence->getLength(); - --m_Index; - return *this; - } - - template<typename S, typename V> - inline StlSequenceIterator<S,V> StlSequenceIterator<S, V>::operator--(int) - { - StlSequenceIterator<S,V> temp = *this; - --*this; - return temp; - } - - template<typename S, typename V> - inline StlSequenceIterator<S,V>& StlSequenceIterator<S, V>::operator+=(const typename StlSequenceIterator<S,V>::difference_type by) - { - if(by<0) - { - this->operator-=(-by); - return *this; - } - if(by==0) - return *this; - m_Index+=by; - if(m_Index>=m_UnoSequence->getLength()) - m_Index=StlSequence<S,V>::end_of_sequence; - return *this; - } - - template<typename S, typename V> - inline StlSequenceIterator<S,V>& StlSequenceIterator<S, V>::operator-=(const typename StlSequenceIterator<S,V>::difference_type by) - { - if(by<0) - { - if(-by==by) return *this; // breaking infinitive loop on MIN_INT - this->operator+=(-by); - return *this; - } - if(by==0) - return *this; - if(m_Index==StlSequence<S,V>::end_of_sequence) - m_Index=m_UnoSequence->getLength(); - m_Index-=by; - return *this; - } - - template<typename S, typename V> - inline StlSequenceIterator<S,V> StlSequenceIterator<S, V>::operator+(const typename StlSequenceIterator<S,V>::difference_type by) const - { - StlSequenceIterator<S,V> result = StlSequenceIterator<S,V>(*this); - result+=by; - return result; - } - - template<typename S, typename V> - inline StlSequenceIterator<S,V> StlSequenceIterator<S, V>::operator-(const typename StlSequenceIterator<S,V>::difference_type by) const - { - StlSequenceIterator<S,V> result = StlSequenceIterator<S,V>(*this); - result-=by; - return result; - } - - template<typename S, typename V> - inline typename StlSequenceIterator<S,V>::difference_type StlSequenceIterator<S, V>::operator-(const StlSequenceIterator<S,V>& to) const - { - if(m_Index==StlSequence<S,V>::end_of_sequence ^ to.m_Index==StlSequence<S,V>::end_of_sequence) - { - if(m_Index==StlSequence<S,V>::end_of_sequence) - return m_UnoSequence->getLength()-to.m_Index; - else - return m_Index-m_UnoSequence->getLength(); - } - return m_Index-to.m_Index; - } - - template<typename S, typename V> - inline bool StlSequenceIterator<S, V>::operator==(const StlSequenceIterator<S,V>& other) const - { - return (m_Index == other.m_Index); - } - - template<typename S, typename V> - inline bool StlSequenceIterator<S, V>::operator!=(const StlSequenceIterator<S,V>& other) const - { - return !this->operator==(other); - } - - template<typename S, typename V> - inline bool StlSequenceIterator<S, V>::operator<(const StlSequenceIterator<S,V>& other) const - { - if(m_Index==StlSequence<S,V>::end_of_sequence ^ other.m_Index==StlSequence<S,V>::end_of_sequence) - return other.m_Index==StlSequence<S,V>::end_of_sequence; - return m_Index<other.m_Index; - } - - template<typename S, typename V> - inline typename StlSequenceIterator<S,V>::reference StlSequenceIterator<S, V>::operator[](const typename StlSequenceIterator<S,V>::difference_type by) const - { - return (*(this->m_UnoSequence))[this->m_Index+by]; - } - - // StlSequence - template<typename S, typename V> - StlSequence<S,V>::StlSequence(S& uno_sequence) - : m_UnoSequence(&uno_sequence) - {} - - template<typename S, typename V> - inline typename StlSequence<S,V>::size_type StlSequence<S,V>::size() const - { - return m_UnoSequence->getLength(); - } - - template<typename S, typename V> - inline typename StlSequence<S,V>::size_type StlSequence<S,V>::max_size() const - { - return this->size(); - } - - template<typename S, typename V> - inline bool StlSequence<S,V>::empty() const - { - return this->size() == 0; - } - - template<typename S, typename V> - inline void StlSequence<S,V>::swap(StlSequence<S,V>& other) - { - ::std::swap(*this, other); - } - - template<typename S, typename V> - inline typename StlSequence<S,V>::iterator StlSequence<S,V>::begin() - { - return typename StlSequence<S,V>::iterator(m_UnoSequence, - size() ? begin_of_sequence : end_of_sequence); - } - - template<typename S, typename V> - inline typename StlSequence<S,V>::iterator StlSequence<S,V>::end() - { - return typename StlSequence<S,V>::iterator(m_UnoSequence, end_of_sequence); - } - - template<typename S, typename V> - inline typename StlSequence<S,V>::const_iterator StlSequence<S,V>::begin() const - { - return typename StlSequence<S,V>::const_iterator(m_UnoSequence, - size() ? begin_of_sequence : end_of_sequence); - } - - template<typename S, typename V> - inline typename StlSequence<S,V>::const_iterator StlSequence<S,V>::end() const - { - return typename StlSequence<S,V>::const_iterator(m_UnoSequence, end_of_sequence); - } - - template<typename S, typename V> - inline bool StlSequence<S,V>::operator==(const StlSequence<S,V>& other) const - { - if(this->size() != other.size()) return false; - return ::std::equal(this->begin(), this->end(), other.begin()); - } - - template<typename S, typename V> - inline bool StlSequence<S,V>::operator<(const StlSequence<S,V>& other) const - { - return ::std::lexicographical_compare(this->begin(), this->end(), other.begin(), other.end()); - } - - template<typename S, typename V> - inline bool StlSequence<S,V>::operator!=(const StlSequence<S,V>& other) const - { return !(*this == other); } - - template<typename S, typename V> - inline bool StlSequence<S,V>::operator>(const StlSequence<S,V>& other) const - { return (other < *this); } - - template<typename S, typename V> - inline bool StlSequence<S,V>::operator<=(const StlSequence<S,V>& other) const - { return !(other < *this); } - - template<typename S, typename V> - inline bool StlSequence<S,V>::operator>=(const StlSequence<S,V>& other) const - { return !(*this < other); } - - template<typename S, typename V> - const typename StlSequence<S,V>::size_type StlSequence<S,V>::begin_of_sequence = 0; - - template<typename S, typename V> - const typename StlSequence<S,V>::size_type StlSequence<S,V>::end_of_sequence = -1; -}} - namespace comphelper { /** - @short a wrapper-class that provides stl-container-like access to an existing - ::com::sun::star::uno::Sequence - @descr This template class allows using an existing ::com::sun::star::uno::Sequence - like any other stl container. It provides standard-compliant mutable random access - iterators. Because random access iterators are the most generic iterators defined - by the stl, any stl algorithm can be applied to the Sequence. - <p> - This is just a basic stl forward container, but _not_ an stl sequence (the size of the - ::com::sun::star::uno::Sequence cannot be changed using the StlUnoSequence interface). - Inserts are expensive operations on ::com::sun::star::uno::Sequence - use - ::std::copy() to a efficient stl container implementing the stl sequence interface - and the available insert iterator adapters you need those. - <p> - @attention There is one requirement of an stl container that this class does not meet: - It is _not_ owner of its contents and thus it does not destroy its contents when destructed. - @attention No additional boundschecking over the requirements of the STL are performed. - E.g. sequence.begin()-- results in undefined behavior. - @attention StlUnoSequence is not threadsafe. - <p> - Example: (creating a ::std::list from a ::com::sun::star::uno::Sequence) - <code> - ::com::sun::star::uno::Sequence<sal_Int32> uno_seq(10); - ::comphelper::StlUnoSequence<sal_Int32> stl_seq(&uno_seq); - ::std::list stl_list(stl_seq.begin(), stl_seq.end()); - </code> - <p> - Example: (sorting ::com::sun::star::uno::Sequence inplace) - <code> - ::com::sun::star::uno::Sequence<sal_Int32> uno_seq(10); - ::comphelper::StlUnoSequence<sal_Int32> stl_seq(&uno_seq); - ::std::sort(stl_seq.begin(), stl_seq.end()); - </code> - <p> - Example: (counting occurrences of 4711 in a ::com::sun::star::uno::Sequence) - <code> - ::com::sun::star::uno::Sequence<sal_Int32> uno_seq(10); - ::comphelper::StlUnoSequence<sal_Int32> stl_seq(&uno_seq); - sal_Int32 count = 0; - ::std::count(stl_seq.begin(), stl_seq.end(), 4711, count); - </code> - <p> - Example: (inserting the second half of one Sequence after the first element of another) - <code> - ::com::sun::star::uno::Sequence<sal_Int32> uno_seq1(10); - ::com::sun::star::uno::Sequence<sal_Int32> uno_seq2(10); - ::com::sun::star::uno::Sequence<sal_Int32> result(15); - ::comphelper::StlUnoSequence<sal_Int32> stl_seq1(&uno_seq1); - ::comphelper::StlUnoSequence<sal_Int32> stl_seq2(&uno_seq1); - ::comphelper::StlUnoSequence<sal_Int32> stl_result(&result); - ::std::list<sal_Int32> temp(uno_seq1.begin(), uno_seq1.end()); - ::std::copy(uno_seq2.begin()+5, uno_seq2.end(), ::std::insert_iterator< ::std::list<sal_Int32> >(temp, ++temp.begin())); - ::std::copy(temp.begin(), temp.end(), result.begin()); - </code> - - @see http://www.sgi.com/tech/stl/Container.html - @see http://www.sgi.com/tech/stl/Sequence.html - @see http://www.sgi.com/tech/stl/RandomAccessIterator.html + @short stl-container-like access to an existing ::com::sun::star::uno::Sequence + @descr These template functions allows using an existing + ::com::sun::star::uno::Sequence using stl algorithms. They provides + standard-compliant mutable random access iterators. Because random access + iterators are the most generic iterators defined by the stl, any stl algorithm + can be applied to the Sequence (excluding algorithms requiring output + iterators). + <p> + Example: (creating a ::std::list from a ::com::sun::star::uno::Sequence) + <code> + ::com::sun::star::uno::Sequence<sal_Int32> aSeq(10); + ::std::list stl_list(stl_begin(aSeq), stl_end(aSeq)); + </code> + <p> + Example: (sorting ::com::sun::star::uno::Sequence inplace) + <code> + ::com::sun::star::uno::Sequence<sal_Int32> aSeq(10); + ::std::sort(stl_begin(aSeq), stl_seq.end(aSeq)); + </code> + <p> + Example: (counting occurrences of 4711 in a ::com::sun::star::uno::Sequence) + <code> + ::com::sun::star::uno::Sequence<sal_Int32> aSeq(10); + sal_Int32 count = 0; + ::std::count(stl_begin(aSeq), stl_end(aSeq), 4711, count); + </code> + <p> + + @see http://www.sgi.com/tech/stl/Container.html + @see http://www.sgi.com/tech/stl/Sequence.html + @see http://www.sgi.com/tech/stl/RandomAccessIterator.html */ template <typename V> - class StlUnoSequence : public stlunosequence::StlSequence< ::com::sun::star::uno::Sequence<V>, V> - { - public: - /* - @short named constructor (these are needed to keep const-correctness) - */ - static StlUnoSequence<V> createInstance(::com::sun::star::uno::Sequence<V>& uno_sequence) - { return StlUnoSequence<V>(uno_sequence); } - /* - @short named constructor (these are needed to keep const-correctness) - */ - static const StlUnoSequence<V> createInstance(const ::com::sun::star::uno::Sequence<V>& uno_sequence) - { return StlUnoSequence<V>(const_cast< ::com::sun::star::uno::Sequence<V>& >(uno_sequence)); } - private: - StlUnoSequence(::com::sun::star::uno::Sequence<V>& uno_sequence) - : stlunosequence::StlSequence< ::com::sun::star::uno::Sequence<V>, V>(uno_sequence) - {} - }; - - /* - @short shortcut for StlUnoSequence<V>::createInstance(uno_sequence).begin() - */ - template <typename V> - typename StlUnoSequence<V>::iterator stl_begin(::com::sun::star::uno::Sequence<V>& uno_sequence) - { return StlUnoSequence<V>::createInstance(uno_sequence).begin(); } + V* stl_begin(::com::sun::star::uno::Sequence<V>& rSeq) + { return rSeq.getArray(); } - /* - @short shortcut for StlUnoSequence<V>::createInstance(uno_sequence).end() - */ template <typename V> - typename StlUnoSequence<V>::iterator stl_end(::com::sun::star::uno::Sequence<V>& uno_sequence) - { return StlUnoSequence<V>::createInstance(uno_sequence).end(); } + V* stl_end(::com::sun::star::uno::Sequence<V>& rSeq) + { return rSeq.getArray() + rSeq.getLength(); } - /* - @short shortcut for StlUnoSequence<V>::createInstance(uno_sequence).begin() - */ template <typename V> - typename StlUnoSequence<V>::const_iterator stl_begin(const ::com::sun::star::uno::Sequence<V>& uno_sequence) - { - return StlUnoSequence<V>::createInstance(uno_sequence).begin(); - } + const V* stl_begin(const ::com::sun::star::uno::Sequence<V>& rSeq) + { return rSeq.getConstArray(); } - /* - @short shortcut for StlUnoSequence<V>::createInstance(uno_sequence).end() - */ template <typename V> - typename StlUnoSequence<V>::const_iterator stl_end(const ::com::sun::star::uno::Sequence<V>& uno_sequence) - { - return StlUnoSequence<V>::createInstance(uno_sequence).end(); - } + const V* stl_end(const ::com::sun::star::uno::Sequence<V>& rSeq) + { return rSeq.getConstArray() + rSeq.getLength(); } } #endif |