lowlevellibsandfws/apputils/inc/BADESCA.H
changeset 0 e4d67989cc36
equal deleted inserted replaced
-1:000000000000 0:e4d67989cc36
       
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Written by DavidW, October 1996
       
    15 // Descriptor arrays
       
    16 // 
       
    17 //
       
    18 
       
    19 #if !defined(__BADESCA_H__)
       
    20 #define __BADESCA_H__
       
    21 
       
    22 #if !defined(__BAMDESCA_H__)
       
    23 #include <bamdesca.h>
       
    24 #endif
       
    25 
       
    26 #if !defined(__E32BASE_H__)
       
    27 #include <e32base.h>
       
    28 #endif
       
    29 
       
    30 
       
    31 class CDesC8Array : public CArrayFixBase, public MDesC8Array
       
    32 /** An implementation base class for 8 bit descriptor arrays. 
       
    33 
       
    34 It provides some of the behaviour for 8 bit descriptor arrays. The class is 
       
    35 abstract and cannot be instantiated. 
       
    36 @publishedAll
       
    37 @released
       
    38 */
       
    39 	{
       
    40 protected:
       
    41 	IMPORT_C CDesC8Array(TBufRep aRep,TInt aGranularity);
       
    42 public:
       
    43     IMPORT_C ~CDesC8Array();
       
    44 	IMPORT_C void AppendL(const TDesC8& aPtr);
       
    45 	IMPORT_C void InsertL(TInt aPos,const TDesC8& aPtr);
       
    46 	IMPORT_C TInt InsertIsqL(const TDesC8& aPtr,TKeyCmpText aTextComparisonType=ECmpFolded);
       
    47 	IMPORT_C TInt InsertIsqAllowDuplicatesL(const TDesC8& aPtr,TKeyCmpText aTextComparisonType=ECmpFolded);
       
    48 	IMPORT_C void Sort(TKeyCmpText aTextComparisonType=ECmpFolded);
       
    49 	IMPORT_C TInt Find(const TDesC8& aPtr,TInt& aPos,TKeyCmpText aTextComparisonType=ECmpFolded) const;
       
    50 	IMPORT_C TInt FindIsq(const TDesC8& aPtr,TInt& aPos,TKeyCmpText aTextComparisonType=ECmpFolded) const;
       
    51 	IMPORT_C void Delete(TInt aPos);
       
    52 	IMPORT_C void Delete(TInt aIndex,TInt aCount);
       
    53 	IMPORT_C void Reset();
       
    54 	inline TPtrC8 operator[](TInt aIndex) const;
       
    55 // from MDesC8Array
       
    56     IMPORT_C TInt MdcaCount() const;
       
    57 	IMPORT_C TPtrC8 MdcaPoint(TInt aIndex) const;
       
    58 	};
       
    59 
       
    60 inline TPtrC8 CDesC8Array::operator[](TInt aIndex) const
       
    61 	{ return(MdcaPoint(aIndex)); }
       
    62 
       
    63 
       
    64 class CDesC8ArrayFlat : public CDesC8Array
       
    65 /** An array of 8 bit descriptors implemented using a flat buffer.
       
    66 "bafl.lib" 
       
    67 @since 5.0
       
    68 @publishedAll
       
    69 @released
       
    70 */
       
    71 	{
       
    72 public:
       
    73 	IMPORT_C CDesC8ArrayFlat(TInt aGranularity);
       
    74     IMPORT_C ~CDesC8ArrayFlat();
       
    75 	};
       
    76 
       
    77 
       
    78 class CDesC8ArraySeg : public CDesC8Array
       
    79 /** An array of 8 bit descriptors implemented using a segmented buffer. 
       
    80 "bafl.lib"
       
    81 @since 5.0
       
    82 @publishedAll
       
    83 @released
       
    84 */
       
    85 	{
       
    86 public:
       
    87 	IMPORT_C CDesC8ArraySeg(TInt aGranularity);
       
    88     IMPORT_C ~CDesC8ArraySeg();
       
    89 	};
       
    90 
       
    91 
       
    92 class CDesC16Array : public CArrayFixBase, public MDesC16Array
       
    93 /** An implementation base class for 16 bit descriptor arrays. It provides some 
       
    94 of the behaviour for 16 bit descriptor arrays.
       
    95 
       
    96 The class is abstract and cannot be instantiated. 
       
    97 " bafl.lib "
       
    98 @since 5.0
       
    99 @publishedAll
       
   100 @released
       
   101 */
       
   102 	{
       
   103 protected:
       
   104 	IMPORT_C CDesC16Array(TBufRep aRep,TInt aGranularity);
       
   105 public:
       
   106     IMPORT_C ~CDesC16Array();
       
   107 	IMPORT_C void AppendL(const TDesC16& aPtr);
       
   108 	IMPORT_C void InsertL(TInt aPos,const TDesC16& aPtr);
       
   109 	IMPORT_C TInt InsertIsqL(const TDesC16& aPtr,TKeyCmpText aTextComparisonType=ECmpFolded);
       
   110 	IMPORT_C TInt InsertIsqAllowDuplicatesL(const TDesC16& aPtr,TKeyCmpText aTextComparisonType=ECmpFolded);
       
   111 	IMPORT_C void Sort(TKeyCmpText aTextComparisonType=ECmpFolded);
       
   112 	IMPORT_C TInt Find(const TDesC16& aPtr,TInt& aPos,TKeyCmpText aTextComparisonType=ECmpFolded) const;
       
   113 	IMPORT_C TInt FindIsq(const TDesC16& aPtr,TInt& aPos,TKeyCmpText aTextComparisonType=ECmpFolded) const;
       
   114 	IMPORT_C void Delete(TInt aPos);
       
   115 	IMPORT_C void Delete(TInt aIndex,TInt aCount);
       
   116 	IMPORT_C void Reset();
       
   117 	inline TPtrC16 operator[](TInt aIndex) const;
       
   118 // from MDesC16Array
       
   119     IMPORT_C TInt MdcaCount() const;
       
   120 		IMPORT_C TPtrC16 MdcaPoint(TInt aIndex) const;
       
   121 	};
       
   122 
       
   123 
       
   124 
       
   125 inline TPtrC16 CDesC16Array::operator[](TInt aIndex) const
       
   126 /** Returns a non-modifiable descriptor to represent the descriptor
       
   127 element located at the specified index within the array.
       
   128 
       
   129 @param aIndex The position of the descriptor element within the array. 
       
   130 The position is relative to zero; i.e. zero implies the first descriptor 
       
   131 element in the array. This value must be non-negative and less than the
       
   132 number of descriptors currently within the array otherwise the operator 
       
   133 panics with
       
   134 @code
       
   135 EArrayIndexOutOfRange
       
   136 @endcode
       
   137 @return A 16 bit non-modifiable pointer descriptor. */
       
   138  { return(MdcaPoint(aIndex)); }
       
   139 
       
   140 
       
   141 class CDesC16ArrayFlat : public CDesC16Array
       
   142 /** Array of 16 bit descriptors implemented using a flat buffer. 
       
   143 "bafl.lib  
       
   144 @since 5.0
       
   145 @publishedAll
       
   146 @released
       
   147 */
       
   148 	{
       
   149 public:
       
   150 	IMPORT_C CDesC16ArrayFlat(TInt aGranularity);
       
   151     IMPORT_C ~CDesC16ArrayFlat();
       
   152 	};
       
   153 
       
   154 
       
   155 class CDesC16ArraySeg : public CDesC16Array
       
   156 /** An array of 16 bit descriptors implemented using a segmented buffer. 
       
   157 "bafl.lib"
       
   158 @since 5.0
       
   159 @publishedAll
       
   160 @released
       
   161 */
       
   162 	{
       
   163 public:
       
   164 	IMPORT_C CDesC16ArraySeg(TInt aGranularity);
       
   165     IMPORT_C ~CDesC16ArraySeg();
       
   166 	};
       
   167 
       
   168 
       
   169 class CPtrC8Array : public CArrayFixFlat<TPtrC8>, public MDesC8Array
       
   170 /** Array of 8 bit non-modifiable pointer descriptors, TPtrC8, implemented using 
       
   171 a flat buffer.
       
   172 "bafl.lib" 
       
   173 @since 5.0
       
   174 @publishedAll
       
   175 @released
       
   176 */
       
   177 	{
       
   178 public:
       
   179 	IMPORT_C CPtrC8Array(TInt aGranularity);
       
   180 	IMPORT_C ~CPtrC8Array();
       
   181 //
       
   182 	IMPORT_C void CopyL(const MDesC8Array& aArray);
       
   183     inline void operator=(const MDesC8Array& aArray);
       
   184 // Mixin members
       
   185     IMPORT_C TInt MdcaCount() const;
       
   186     IMPORT_C TPtrC8 MdcaPoint(TInt aIndex) const;
       
   187 	};
       
   188 
       
   189 
       
   190 class CPtrC16Array : public CArrayFixFlat<TPtrC16>, public MDesC16Array
       
   191 /** An array of 16 bit non-modifiable pointer descriptors, TPtrC16, implemented 
       
   192 using a flat buffer. 
       
   193 "bafl.lib"
       
   194 @since 5.0
       
   195 @publishedAll
       
   196 @released
       
   197 */
       
   198 	{
       
   199 public:
       
   200 	IMPORT_C CPtrC16Array(TInt aGranularity);
       
   201 	IMPORT_C ~CPtrC16Array();
       
   202 //
       
   203 	IMPORT_C void CopyL(const MDesC16Array& aArray);
       
   204     inline void operator=(const MDesC16Array& aArray);
       
   205 // Mixin members
       
   206     IMPORT_C TInt MdcaCount() const;
       
   207     IMPORT_C TPtrC16 MdcaPoint(TInt aIndex) const;
       
   208 	};
       
   209 
       
   210 
       
   211 inline void CPtrC8Array::operator=(const MDesC8Array& aArray)
       
   212 /** Copies a descriptor array into this array, deleting any pre-existing
       
   213 elements.
       
   214 
       
   215 The function constructs TPtrC8 elements for each descriptor element
       
   216 in the specified descriptor array. This operator behaves in the 
       
   217 same ways as CPtrC8Array::CopyL().
       
   218 
       
   219 @param aArrayA reference to any descriptor array which satisfies
       
   220 the protocol defined by this mixin class. */
       
   221 	{CopyL(aArray);}
       
   222 
       
   223 
       
   224 inline void CPtrC16Array::operator=(const MDesC16Array& aArray)
       
   225 /** Copies a descriptor array into this array, deleting any pre-existing
       
   226 elements.
       
   227 
       
   228 The function constructs TPtrC16 elements for each descriptor element
       
   229 in the specified descriptor array.This operator behaves in the 
       
   230 same ways as CPtrC16Array::CopyL().
       
   231 
       
   232 @param aArray A reference to any descriptor array which satisfies
       
   233 the protocol defined by this mixin class. */
       
   234 	{CopyL(aArray);}
       
   235 
       
   236 // generic text array definitions
       
   237 
       
   238 #if defined (_UNICODE)
       
   239 /** Build independent implementation base class for descriptor arrays.
       
   240 
       
   241 @see CDesC8Array
       
   242 @see CDesC16Array 
       
   243 @publishedAll
       
   244 @released
       
   245 */
       
   246 typedef CDesC16Array     CDesCArray;
       
   247 
       
   248 /** Build independent array of descriptors implemented using a flat buffer.
       
   249 
       
   250 @see CDesC8ArrayFlat
       
   251 @see CDesC16ArrayFlat
       
   252 @publishedAll
       
   253 @released
       
   254 */
       
   255 typedef CDesC16ArrayFlat CDesCArrayFlat;
       
   256 
       
   257 /** Build independent array of descriptors implemented using a segmented buffer.
       
   258 
       
   259 @see CDesC16ArraySeg
       
   260 @see CDesC8ArraySeg 
       
   261 @publishedAll
       
   262 @released
       
   263 */
       
   264 typedef CDesC16ArraySeg  CDesCArraySeg;
       
   265 
       
   266 /** Build independent array of non-modifiable pointer descriptors.
       
   267 
       
   268 A 16 bit build variant is generated for a Unicode build and an 8 bit build 
       
   269 variant generated for a non-Unicode build.
       
   270 
       
   271 This build independent type should always be used unless an explicit 8 bit 
       
   272 or 16 bit build variant is required.
       
   273 
       
   274 @see CPtrC16Array
       
   275 @see CPtrC8Array 
       
   276 @publishedAll
       
   277 @released
       
   278 */
       
   279 typedef CPtrC16Array CPtrCArray;
       
   280 #else
       
   281 /** Build independent implementation base class for descriptor arrays.
       
   282 
       
   283 @see CDesC8Array
       
   284 @see CDesC16Array 
       
   285 @publishedAll
       
   286 @released
       
   287 */
       
   288 typedef CDesC8Array      CDesCArray;
       
   289 /** Build independent array of descriptors implemented using a flat buffer.
       
   290 
       
   291 @see CDesC8ArrayFlat
       
   292 @see CDesC16ArrayFlat
       
   293 @publishedAll
       
   294 @released
       
   295 */
       
   296 typedef CDesC8ArrayFlat  CDesCArrayFlat;
       
   297 /** Build independent array of descriptors implemented using a segmented buffer.
       
   298 
       
   299 @see CDesC16ArraySeg
       
   300 @see CDesC8ArraySeg 
       
   301 @publishedAll
       
   302 @released
       
   303 */
       
   304 typedef CDesC8ArraySeg   CDesCArraySeg;
       
   305 /** Build independent array of non-modifiable pointer descriptors.
       
   306 
       
   307 A 16 bit build variant is generated for a Unicode build and an 8 bit build 
       
   308 variant generated for a non-Unicode build.
       
   309 
       
   310 This build independent type should always be used unless an explicit 8 bit 
       
   311 or 16 bit build variant is required.
       
   312 
       
   313 @see CPtrC16Array
       
   314 @see CPtrC8Array 
       
   315 @publishedAll
       
   316 @released
       
   317 */
       
   318 typedef CPtrC8Array CPtrCArray;
       
   319 #endif
       
   320 
       
   321 
       
   322 #endif // __BADESCA_H__
       
   323 
       
   324 
       
   325 
       
   326