1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: sci_impl.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef ARY_SCI_IMPL_HXX
32 #define ARY_SCI_IMPL_HXX
38 #include <ary/stdconstiter.hxx>
47 //************************* SCI_Vector **********************************//
50 class SCI_Vector
: public StdConstIterator
<ELEM
>
53 typedef std::vector
<ELEM
> source
;
54 typedef typename
source::const_iterator source_iterator
;
57 const source
& i_rSource
);
58 virtual ~SCI_Vector();
61 // Interface StdConstIterator<>:
62 virtual void do_Advance();
64 inq_CurElement() const;
65 virtual bool inq_IsSorted() const;
68 source_iterator itRun
;
69 source_iterator itEnd
;
74 //************************* SCI_Map **********************************//
76 template <class KEY
, class VALUE
>
77 class SCI_Map
: public StdConstIterator
< typename
std::map
<KEY
,VALUE
>::value_type
>
80 typedef std::map
<KEY
,VALUE
> source
;
81 typedef typename
source::const_iterator source_iterator
;
84 const source
& i_rSource
);
88 // Interface StdConstIterator<>:
89 virtual void do_Advance();
90 virtual const typename
std::map
<KEY
,VALUE
>::value_type
*
91 inq_CurElement() const;
92 virtual bool inq_IsSorted() const;
95 source_iterator itRun
;
96 source_iterator itEnd
;
100 //************************* SCI_MultiMap **********************************//
102 template <class KEY
, class VALUE
>
103 class SCI_MultiMap
: public StdConstIterator
< typename
std::multimap
<KEY
,VALUE
>::value_type
>
106 typedef std::multimap
<KEY
,VALUE
> source
;
107 typedef typename
source::const_iterator source_iterator
;
110 const source
& i_rSource
);
112 source_iterator i_begin
,
113 source_iterator i_end
);
114 virtual ~SCI_MultiMap();
117 // Interface StdConstIterator<>:
118 virtual void do_Advance();
119 virtual const typename
std::multimap
<KEY
,VALUE
>::value_type
*
120 inq_CurElement() const;
121 virtual bool inq_IsSorted() const;
124 source_iterator itRun
;
125 source_iterator itEnd
;
130 //************************* SCI_Set **********************************//
133 template <class TYPES
>
134 class SCI_Set
: public StdConstIterator
<typename
TYPES::element_type
>
137 typedef typename
TYPES::element_type element
;
138 typedef typename
TYPES::sort_type sorter
;
139 typedef std::set
<element
, sorter
> source
;
140 typedef typename
source::const_iterator source_iterator
;
143 const source
& i_rSource
);
147 // Interface StdConstIterator<>:
148 virtual void do_Advance();
149 virtual const element
*
150 inq_CurElement() const;
151 virtual bool inq_IsSorted() const;
154 source_iterator itRun
;
155 source_iterator itEnd
;
158 //************************* SCI_DataInMap **********************************//
160 template <class KEY
, class VALUE
>
161 class SCI_DataInMap
: public StdConstIterator
<VALUE
>
164 typedef std::map
<KEY
,VALUE
> source
;
165 typedef typename
source::const_iterator source_iterator
;
168 const source
& i_rSource
);
169 virtual ~SCI_DataInMap();
172 // Interface StdConstIterator<>:
173 virtual void do_Advance();
174 virtual const VALUE
*
175 inq_CurElement() const;
176 virtual bool inq_IsSorted() const;
179 source_iterator itRun
;
180 source_iterator itEnd
;
187 //********************************************************************//
192 template <class ELEM
>
193 SCI_Vector
<ELEM
>::SCI_Vector( const source
& i_rSource
)
194 : itRun(i_rSource
.begin()),
195 itEnd(i_rSource
.end())
199 template <class ELEM
>
200 SCI_Vector
<ELEM
>::~SCI_Vector()
205 template <class ELEM
>
207 SCI_Vector
<ELEM
>::do_Advance()
213 template <class ELEM
>
215 SCI_Vector
<ELEM
>::inq_CurElement() const
222 template <class ELEM
>
224 SCI_Vector
<ELEM
>::inq_IsSorted() const
232 template <class KEY
, class VALUE
>
233 SCI_Map
<KEY
,VALUE
>::SCI_Map( const source
& i_rSource
)
234 : itRun(i_rSource
.begin()),
235 itEnd(i_rSource
.end())
239 template <class KEY
, class VALUE
>
240 SCI_Map
<KEY
,VALUE
>::~SCI_Map()
244 template <class KEY
, class VALUE
>
246 SCI_Map
<KEY
,VALUE
>::do_Advance()
252 template <class KEY
, class VALUE
>
253 const typename
std::map
<KEY
,VALUE
>::value_type
*
254 SCI_Map
<KEY
,VALUE
>::inq_CurElement() const
262 template <class KEY
, class VALUE
>
264 SCI_Map
<KEY
,VALUE
>::inq_IsSorted() const
275 template <class KEY
, class VALUE
>
276 SCI_MultiMap
<KEY
,VALUE
>::SCI_MultiMap( const source
& i_rSource
)
277 : itRun(i_rSource
.begin()),
278 itEnd(i_rSource
.end())
282 template <class KEY
, class VALUE
>
283 SCI_MultiMap
<KEY
,VALUE
>::SCI_MultiMap( source_iterator i_begin
,
284 source_iterator i_end
)
290 template <class KEY
, class VALUE
>
291 SCI_MultiMap
<KEY
,VALUE
>::~SCI_MultiMap()
295 template <class KEY
, class VALUE
>
297 SCI_MultiMap
<KEY
,VALUE
>::do_Advance()
303 template <class KEY
, class VALUE
>
304 const typename
std::multimap
<KEY
,VALUE
>::value_type
*
305 SCI_MultiMap
<KEY
,VALUE
>::inq_CurElement() const
313 template <class KEY
, class VALUE
>
315 SCI_MultiMap
<KEY
,VALUE
>::inq_IsSorted() const
327 template <class ELEM
>
328 SCI_Set
<ELEM
>::SCI_Set( const source
& i_rSource
)
329 : itRun(i_rSource
.begin()),
330 itEnd(i_rSource
.end())
334 template <class ELEM
>
335 SCI_Set
<ELEM
>::~SCI_Set()
340 template <class ELEM
>
342 SCI_Set
<ELEM
>::do_Advance()
348 template <class ELEM
>
349 const typename SCI_Set
<ELEM
>::element
*
350 SCI_Set
<ELEM
>::inq_CurElement() const
357 template <class ELEM
>
359 SCI_Set
<ELEM
>::inq_IsSorted() const
370 template <class KEY
, class VALUE
>
371 SCI_DataInMap
<KEY
,VALUE
>::SCI_DataInMap( const source
& i_rSource
)
372 : itRun(i_rSource
.begin()),
373 itEnd(i_rSource
.end())
377 template <class KEY
, class VALUE
>
378 SCI_DataInMap
<KEY
,VALUE
>::~SCI_DataInMap()
382 template <class KEY
, class VALUE
>
384 SCI_DataInMap
<KEY
,VALUE
>::do_Advance()
390 template <class KEY
, class VALUE
>
392 SCI_DataInMap
<KEY
,VALUE
>::inq_CurElement() const
395 return &(*itRun
).second
;
400 template <class KEY
, class VALUE
>
402 SCI_DataInMap
<KEY
,VALUE
>::inq_IsSorted() const