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