xref: /aoo42x/main/svl/inc/svl/svstdarr.hxx (revision 39a19a47)
1*39a19a47SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*39a19a47SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*39a19a47SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*39a19a47SAndrew Rist  * distributed with this work for additional information
6*39a19a47SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*39a19a47SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*39a19a47SAndrew Rist  * "License"); you may not use this file except in compliance
9*39a19a47SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*39a19a47SAndrew Rist  *
11*39a19a47SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*39a19a47SAndrew Rist  *
13*39a19a47SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*39a19a47SAndrew Rist  * software distributed under the License is distributed on an
15*39a19a47SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*39a19a47SAndrew Rist  * KIND, either express or implied.  See the License for the
17*39a19a47SAndrew Rist  * specific language governing permissions and limitations
18*39a19a47SAndrew Rist  * under the License.
19*39a19a47SAndrew Rist  *
20*39a19a47SAndrew Rist  *************************************************************/
21*39a19a47SAndrew Rist 
22*39a19a47SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #if 0
25cdf0e10cSrcweir ***********************************************************************
26cdf0e10cSrcweir *
27cdf0e10cSrcweir *   Die vordefinierte Arrays werden ueber POSITIV-Defines aktiviert:
28cdf0e10cSrcweir *   (die defines setzen sich aus "_SVSTDARR_" und dem Namen des Array
29cdf0e10cSrcweir *    ohne "Sv" zusammen)
30cdf0e10cSrcweir *
31cdf0e10cSrcweir *	VarArr:		SvBools, SvULongs, SvUShorts, SvLongs, SvShorts
32cdf0e10cSrcweir *	PtrArr:		SvStrings, SvStringsDtor
33cdf0e10cSrcweir *	SortArr:	SvStringsSort, SvStringsSortDtor,
34cdf0e10cSrcweir *				SvStringsISort, SvStringsISortDtor,
35cdf0e10cSrcweir *				SvUShortsSort
36cdf0e10cSrcweir ***********************************************************************
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir 
39cdf0e10cSrcweir #include "svl/svldllapi.h"
40cdf0e10cSrcweir #include <svl/svarray.hxx>
41cdf0e10cSrcweir #include <deque>
42cdf0e10cSrcweir 
43cdf0e10cSrcweir typedef std::deque< sal_Bool > SvBools;
44cdf0e10cSrcweir 
45cdf0e10cSrcweir typedef std::deque< sal_uInt8 > SvBytes;
46cdf0e10cSrcweir 
47cdf0e10cSrcweir //#ifdef _SVSTDARR_ULONGS
48cdf0e10cSrcweir #ifndef _SVSTDARR_ULONGS_DECL
49cdf0e10cSrcweir SV_DECL_VARARR_VISIBILITY( SvULongs, sal_uLong, 1, 1, SVL_DLLPUBLIC )
50cdf0e10cSrcweir #define _SVSTDARR_ULONGS_DECL
51cdf0e10cSrcweir #endif
52cdf0e10cSrcweir //#endif
53cdf0e10cSrcweir 
54cdf0e10cSrcweir //#ifdef _SVSTDARR_ULONGSSORT
55cdf0e10cSrcweir #ifndef _SVSTDARR_ULONGSSORT_DECL
56cdf0e10cSrcweir SV_DECL_VARARR_SORT_VISIBILITY( SvULongsSort, sal_uLong, 1, 1, SVL_DLLPUBLIC )
57cdf0e10cSrcweir #define _SVSTDARR_ULONGSSORT_DECL
58cdf0e10cSrcweir #endif
59cdf0e10cSrcweir //#endif
60cdf0e10cSrcweir 
61cdf0e10cSrcweir //#ifdef _SVSTDARR_USHORTS
62cdf0e10cSrcweir #ifndef _SVSTDARR_USHORTS_DECL
63cdf0e10cSrcweir SV_DECL_VARARR_VISIBILITY( SvUShorts, sal_uInt16, 1, 1, SVL_DLLPUBLIC )
64cdf0e10cSrcweir #define _SVSTDARR_USHORTS_DECL
65cdf0e10cSrcweir #endif
66cdf0e10cSrcweir //#endif
67cdf0e10cSrcweir 
68cdf0e10cSrcweir //#ifdef _SVSTDARR_USHORTSSORT
69cdf0e10cSrcweir #ifndef _SVSTDARR_USHORTSSORT_DECL
70cdf0e10cSrcweir 
71cdf0e10cSrcweir typedef sal_Bool (*FnForEach_SvUShortsSort)( const sal_uInt16&, void* );
72cdf0e10cSrcweir class SVL_DLLPUBLIC SvUShortsSort : __MWERKS__PRIVATE SvUShorts
73cdf0e10cSrcweir {
74cdf0e10cSrcweir public:
SvUShortsSort(sal_uInt8 nSize=1,sal_uInt8 nG=1)75cdf0e10cSrcweir 	SvUShortsSort(sal_uInt8 nSize = 1, sal_uInt8 nG = 1)
76cdf0e10cSrcweir 		: SvUShorts(nSize,nG) {}
77cdf0e10cSrcweir 
78cdf0e10cSrcweir 	void Insert( const SvUShortsSort *pI, sal_uInt16 nS=0, sal_uInt16 nE=USHRT_MAX );
79cdf0e10cSrcweir 	sal_Bool Insert( const sal_uInt16 aE );
80cdf0e10cSrcweir 	sal_Bool Insert( const sal_uInt16 aE, sal_uInt16& rP );
81cdf0e10cSrcweir 	void Insert( const sal_uInt16 *pE, sal_uInt16 nL );
82cdf0e10cSrcweir 	// remove ab Pos
83cdf0e10cSrcweir 	void RemoveAt( const sal_uInt16 nP, sal_uInt16 nL = 1 );
84cdf0e10cSrcweir 	// remove ab dem Eintrag
85cdf0e10cSrcweir 	void Remove( const sal_uInt16 nP, sal_uInt16 nL = 1 );
86cdf0e10cSrcweir 	sal_Bool Seek_Entry( const sal_uInt16 aE, sal_uInt16* pP = 0 ) const;
87cdf0e10cSrcweir 
Count() const88cdf0e10cSrcweir 	sal_uInt16 Count() const  {   return SvUShorts::Count();	}
GetData() const89cdf0e10cSrcweir 	const sal_uInt16* GetData() const { return (const sal_uInt16*)pData; }
90cdf0e10cSrcweir 
operator [](sal_uInt16 nP) const91cdf0e10cSrcweir 	const sal_uInt16& operator[](sal_uInt16 nP) const {
92cdf0e10cSrcweir 		return SvUShorts::operator[]( nP );
93cdf0e10cSrcweir 	}
GetObject(sal_uInt16 nP) const94cdf0e10cSrcweir 	const sal_uInt16& GetObject(sal_uInt16 nP) const {
95cdf0e10cSrcweir 		return SvUShorts::GetObject( nP );
96cdf0e10cSrcweir 	}
ForEach(FnForEach_SvUShortsSort fnForEach,void * pArgs=0)97cdf0e10cSrcweir 	void ForEach( FnForEach_SvUShortsSort fnForEach, void* pArgs = 0 )
98cdf0e10cSrcweir 	{
99cdf0e10cSrcweir 		_ForEach( 0, nA, (FnForEach_SvUShorts)fnForEach, pArgs );
100cdf0e10cSrcweir 	}
ForEach(sal_uInt16 nS,sal_uInt16 nE,FnForEach_SvUShortsSort fnForEach,void * pArgs=0)101cdf0e10cSrcweir 	void ForEach( sal_uInt16 nS, sal_uInt16 nE,
102cdf0e10cSrcweir 					FnForEach_SvUShortsSort fnForEach, void* pArgs = 0 )
103cdf0e10cSrcweir 	{
104cdf0e10cSrcweir 		_ForEach( nS, nE, (FnForEach_SvUShorts)fnForEach, pArgs );
105cdf0e10cSrcweir 	}
106cdf0e10cSrcweir private:
107cdf0e10cSrcweir 	SvUShortsSort( const SvUShortsSort& );
108cdf0e10cSrcweir 	SvUShortsSort& operator=( const SvUShortsSort& );
109cdf0e10cSrcweir };
110cdf0e10cSrcweir 
111cdf0e10cSrcweir #define _SVSTDARR_USHORTSSORT_DECL
112cdf0e10cSrcweir #endif
113cdf0e10cSrcweir //#endif
114cdf0e10cSrcweir 
115cdf0e10cSrcweir //#ifdef _SVSTDARR_LONGS
116cdf0e10cSrcweir #ifndef _SVSTDARR_LONGS_DECL
117cdf0e10cSrcweir SV_DECL_VARARR_VISIBILITY( SvLongs, long, 1, 1, SVL_DLLPUBLIC )
118cdf0e10cSrcweir #define _SVSTDARR_LONGS_DECL
119cdf0e10cSrcweir #endif
120cdf0e10cSrcweir //#endif
121cdf0e10cSrcweir 
122cdf0e10cSrcweir //#ifdef _SVSTDARR_LONGSSORT
123cdf0e10cSrcweir #ifndef _SVSTDARR_LONGSSORT_DECL
124cdf0e10cSrcweir SV_DECL_VARARR_SORT_VISIBILITY( SvLongsSort, long, 1, 1, SVL_DLLPUBLIC )
125cdf0e10cSrcweir #define _SVSTDARR_LONGSSORT_DECL
126cdf0e10cSrcweir #endif
127cdf0e10cSrcweir //#endif
128cdf0e10cSrcweir 
129cdf0e10cSrcweir typedef std::deque< short > SvShorts;
130cdf0e10cSrcweir 
131cdf0e10cSrcweir /*
132cdf0e10cSrcweir  form here all Arrays for Strings, ByteString and then
133cdf0e10cSrcweir  len of a string (xub_StrLen)
134cdf0e10cSrcweir #if (defined(_SVSTDARR_STRINGS) && !defined(_SVSTDARR_STRINGS_DECL)) || \
135cdf0e10cSrcweir     (defined(_SVSTDARR_STRINGSDTOR) && !defined(_SVSTDARR_STRINGSDTOR_DECL)) || \
136cdf0e10cSrcweir     (defined(_SVSTDARR_STRINGSSORT) && !defined(_SVSTDARR_STRINGSSORT_DECL)) || \
137cdf0e10cSrcweir     (defined(_SVSTDARR_STRINGSSORTDTOR) && !defined(_SVSTDARR_STRINGSSORTDTOR_DECL)) || \
138cdf0e10cSrcweir     (defined(_SVSTDARR_STRINGSISORT) && !defined(_SVSTDARR_STRINGSISORT_DECL)) || \
139cdf0e10cSrcweir     (defined(_SVSTDARR_STRINGSISORTDTOR) && !defined(_SVSTDARR_STRINGSISORTDTOR_DECL)) || \
140cdf0e10cSrcweir     (defined(_SVSTDARR_BYTESTRINGS) && !defined(_SVSTDARR_BYTESTRINGS_DECL)) || \
141cdf0e10cSrcweir     (defined(_SVSTDARR_BYTESTRINGSDTOR) && !defined(_SVSTDARR_BYTESTRINGSDTOR_DECL)) || \
142cdf0e10cSrcweir     (defined(_SVSTDARR_BYTESTRINGSSORT) && !defined(_SVSTDARR_BYTESTRINGSSORT_DECL)) || \
143cdf0e10cSrcweir     (defined(_SVSTDARR_BYTESTRINGSSORTDTOR) && !defined(_SVSTDARR_BYTESTRINGSSORTDTOR_DECL)) || \
144cdf0e10cSrcweir     (defined(_SVSTDARR_BYTESTRINGSISORT) && !defined(_SVSTDARR_BYTESTRINGSISORT_DECL)) || \
145cdf0e10cSrcweir     (defined(_SVSTDARR_BYTESTRINGSISORTDTOR) && !defined(_SVSTDARR_BYTESTRINGSISORTDTOR_DECL)) || \
146cdf0e10cSrcweir     (defined(_SVSTDARR_XUB_STRLEN) && !defined(_SVSTDARR_XUB_STRLEN_DECL)) ||\
147cdf0e10cSrcweir     (defined(_SVSTDARR_XUB_STRLENSORT) && !defined(_SVSTDARR_XUB_STRLENSORT_DECL))
148cdf0e10cSrcweir */
149cdf0e10cSrcweir #include <tools/string.hxx>
150cdf0e10cSrcweir 
151cdf0e10cSrcweir typedef String* StringPtr;
152cdf0e10cSrcweir typedef ByteString* ByteStringPtr;
153cdf0e10cSrcweir 
154cdf0e10cSrcweir //#endif
155cdf0e10cSrcweir 
156cdf0e10cSrcweir //#ifdef _SVSTDARR_STRINGS
157cdf0e10cSrcweir #ifndef _SVSTDARR_STRINGS_DECL
158cdf0e10cSrcweir SV_DECL_PTRARR_VISIBILITY( SvStrings, StringPtr, 1, 1, SVL_DLLPUBLIC )
159cdf0e10cSrcweir #define _SVSTDARR_STRINGS_DECL
160cdf0e10cSrcweir #endif
161cdf0e10cSrcweir //#endif
162cdf0e10cSrcweir 
163cdf0e10cSrcweir //#ifdef _SVSTDARR_STRINGSDTOR
164cdf0e10cSrcweir #ifndef _SVSTDARR_STRINGSDTOR_DECL
165cdf0e10cSrcweir SV_DECL_PTRARR_DEL_VISIBILITY( SvStringsDtor, StringPtr, 1, 1, SVL_DLLPUBLIC )
166cdf0e10cSrcweir #define _SVSTDARR_STRINGSDTOR_DECL
167cdf0e10cSrcweir #endif
168cdf0e10cSrcweir //#endif
169cdf0e10cSrcweir 
170cdf0e10cSrcweir //#ifdef _SVSTDARR_STRINGSSORT
171cdf0e10cSrcweir #ifndef _SVSTDARR_STRINGSSORT_DECL
172cdf0e10cSrcweir SV_DECL_PTRARR_SORT_VISIBILITY( SvStringsSort, StringPtr, 1, 1, SVL_DLLPUBLIC )
173cdf0e10cSrcweir #define _SVSTDARR_STRINGSSORT_DECL
174cdf0e10cSrcweir #endif
175cdf0e10cSrcweir //#endif
176cdf0e10cSrcweir 
177cdf0e10cSrcweir //#ifdef _SVSTDARR_STRINGSSORTDTOR
178cdf0e10cSrcweir #ifndef _SVSTDARR_STRINGSSORTDTOR_DECL
179cdf0e10cSrcweir SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvStringsSortDtor, StringPtr, 1, 1, SVL_DLLPUBLIC )
180cdf0e10cSrcweir #define _SVSTDARR_STRINGSSORTDTOR_DECL
181cdf0e10cSrcweir #endif
182cdf0e10cSrcweir //#endif
183cdf0e10cSrcweir 
184cdf0e10cSrcweir //#ifdef _SVSTDARR_STRINGSISORT
185cdf0e10cSrcweir #ifndef _SVSTDARR_STRINGSISORT_DECL
186cdf0e10cSrcweir SV_DECL_PTRARR_SORT_VISIBILITY( SvStringsISort, StringPtr, 1, 1, SVL_DLLPUBLIC )
187cdf0e10cSrcweir #define _SVSTDARR_STRINGSISORT_DECL
188cdf0e10cSrcweir #endif
189cdf0e10cSrcweir //#endif
190cdf0e10cSrcweir 
191cdf0e10cSrcweir //#ifdef _SVSTDARR_STRINGSISORTDTOR
192cdf0e10cSrcweir #ifndef _SVSTDARR_STRINGSISORTDTOR_DECL
193cdf0e10cSrcweir SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvStringsISortDtor, StringPtr, 1, 1, SVL_DLLPUBLIC )
194cdf0e10cSrcweir #define _SVSTDARR_STRINGSISORTDTOR_DECL
195cdf0e10cSrcweir #endif
196cdf0e10cSrcweir //#endif
197cdf0e10cSrcweir 
198cdf0e10cSrcweir //#ifdef _SVSTDARR_BYTESTRINGS
199cdf0e10cSrcweir #ifndef _SVSTDARR_BYTESTRINGS_DECL
200cdf0e10cSrcweir SV_DECL_PTRARR_VISIBILITY( SvByteStrings, ByteStringPtr, 1, 1, SVL_DLLPUBLIC )
201cdf0e10cSrcweir #define _SVSTDARR_BYTESTRINGS_DECL
202cdf0e10cSrcweir #endif
203cdf0e10cSrcweir //#endif
204cdf0e10cSrcweir 
205cdf0e10cSrcweir //#ifdef _SVSTDARR_BYTESTRINGSDTOR
206cdf0e10cSrcweir #ifndef _SVSTDARR_BYTESTRINGSDTOR_DECL
207cdf0e10cSrcweir SV_DECL_PTRARR_DEL_VISIBILITY( SvByteStringsDtor, ByteStringPtr, 1, 1, SVL_DLLPUBLIC )
208cdf0e10cSrcweir #define _SVSTDARR_BYTESTRINGSDTOR_DECL
209cdf0e10cSrcweir #endif
210cdf0e10cSrcweir //#endif
211cdf0e10cSrcweir 
212cdf0e10cSrcweir //#ifdef _SVSTDARR_BYTESTRINGSSORT
213cdf0e10cSrcweir #ifndef _SVSTDARR_BYTESTRINGSSORT_DECL
214cdf0e10cSrcweir SV_DECL_PTRARR_SORT_VISIBILITY( SvByteStringsSort, ByteStringPtr, 1, 1, SVL_DLLPUBLIC )
215cdf0e10cSrcweir #define _SVSTDARR_BYTESTRINGSSORT_DECL
216cdf0e10cSrcweir #endif
217cdf0e10cSrcweir //#endif
218cdf0e10cSrcweir 
219cdf0e10cSrcweir //#ifdef _SVSTDARR_BYTESTRINGSSORTDTOR
220cdf0e10cSrcweir #ifndef _SVSTDARR_BYTESTRINGSSORTDTOR_DECL
221cdf0e10cSrcweir SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvByteStringsSortDtor, ByteStringPtr, 1, 1, SVL_DLLPUBLIC )
222cdf0e10cSrcweir #define _SVSTDARR_BYTESTRINGSSORTDTOR_DECL
223cdf0e10cSrcweir #endif
224cdf0e10cSrcweir //#endif
225cdf0e10cSrcweir 
226cdf0e10cSrcweir //#ifdef _SVSTDARR_BYTESTRINGSISORT
227cdf0e10cSrcweir #ifndef _SVSTDARR_BYTESTRINGSISORT_DECL
228cdf0e10cSrcweir SV_DECL_PTRARR_SORT_VISIBILITY( SvByteStringsISort, ByteStringPtr, 1, 1, SVL_DLLPUBLIC )
229cdf0e10cSrcweir #define _SVSTDARR_BYTESTRINGSISORT_DECL
230cdf0e10cSrcweir #endif
231cdf0e10cSrcweir //#endif
232cdf0e10cSrcweir 
233cdf0e10cSrcweir //#ifdef _SVSTDARR_BYTESTRINGSISORTDTOR
234cdf0e10cSrcweir #ifndef _SVSTDARR_BYTESTRINGSISORTDTOR_DECL
235cdf0e10cSrcweir SV_DECL_PTRARR_SORT_DEL_VISIBILITY( SvByteStringsISortDtor, ByteStringPtr, 1, 1, SVL_DLLPUBLIC )
236cdf0e10cSrcweir #define _SVSTDARR_BYTESTRINGSISORTDTOR_DECL
237cdf0e10cSrcweir #endif
238cdf0e10cSrcweir //#endif
239cdf0e10cSrcweir 
240cdf0e10cSrcweir typedef std::deque< xub_StrLen > SvXub_StrLens;
241cdf0e10cSrcweir 
242