1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/persistentdata/persistentstorage/store/INC/S32CONT.H Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,279 @@
1.4 +// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#if !defined(__S32CONT_H__)
1.20 +#define __S32CONT_H__
1.21 +#if !defined(__S32BTREE_H__)
1.22 +#include <s32btree.h>
1.23 +#endif
1.24 +
1.25 +/**
1.26 + * @publishedAll
1.27 + * @released
1.28 + */
1.29 +class TPagedSetToken : public TBtreeToken
1.30 + {
1.31 +public:
1.32 + TPagedSetToken() {}
1.33 + inline TPagedSetToken(TEmpty);
1.34 +//
1.35 + inline TInt Count() const;
1.36 +//
1.37 + IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
1.38 + IMPORT_C void InternalizeL(RReadStream& aStream);
1.39 +protected:
1.40 + IMPORT_C void Clear();
1.41 +private:
1.42 + inline TPagedSetToken(const TBtreeToken& aTree,TInt aCount);
1.43 +private:
1.44 + TInt iCount;
1.45 +private:
1.46 + friend class TPagedSetBase;
1.47 + };
1.48 +#define KEmptyPagedSetToken TPagedSetToken(TPagedSetToken::EEmpty)
1.49 +
1.50 +/**
1.51 + * @publishedAll
1.52 + * @released
1.53 + */
1.54 +class TPagedSetBase
1.55 + {
1.56 +public:
1.57 + IMPORT_C void Connect(MPagePool* aPool);
1.58 + IMPORT_C void Set(const TPagedSetToken& aToken);
1.59 + IMPORT_C TPagedSetToken Token() const;
1.60 +//
1.61 + inline TBool IsDirty() const;
1.62 + inline void MarkCurrent();
1.63 + inline void MarkDirty();
1.64 +//
1.65 + inline TBool IsBroken() const;
1.66 + inline TBool IsIntact() const;
1.67 + inline void MarkBroken();
1.68 + IMPORT_C TInt RepairL();
1.69 +//
1.70 + inline TInt Count() const;
1.71 + inline TBool IsEmpty() const;
1.72 + IMPORT_C void ClearL();
1.73 +//
1.74 + IMPORT_C TBool ContainsL(const TAny* aPtr) const;
1.75 + IMPORT_C void InsertL(const TAny* aPtr);
1.76 + IMPORT_C void DeleteL(const TAny* aPtr);
1.77 +protected:
1.78 + IMPORT_C TPagedSetBase(TInt anEntrySize);
1.79 + IMPORT_C TPagedSetBase(const TPagedSetToken& aToken,TInt anEntrySize);
1.80 + IMPORT_C void InsertAllowDuplicatesL(const TAny* aPtr);
1.81 +private:
1.82 + TBtreeFix<TAny,TAny> iTree;
1.83 + TBtreeKey iKey;
1.84 + TInt iCount;
1.85 +private:
1.86 + friend class TPagedSetIterBase;
1.87 + friend class TPagedSetBiIterBase;
1.88 + };
1.89 +
1.90 +/**
1.91 + * @publishedAll
1.92 + * @released
1.93 + */
1.94 +class TPagedMultisetBase : public TPagedSetBase
1.95 + {
1.96 +public:
1.97 + inline void InsertL(const TAny* aPtr);
1.98 +protected:
1.99 + inline TPagedMultisetBase(TInt anEntrySize);
1.100 + inline TPagedMultisetBase(const TPagedSetToken& aToken,TInt anEntrySize);
1.101 + };
1.102 +
1.103 +/**
1.104 + * @publishedAll
1.105 + * @released
1.106 + */
1.107 +template <class T>
1.108 +class TPagedSet : public TPagedSetBase
1.109 + {
1.110 +public:
1.111 + inline TPagedSet();
1.112 + inline TPagedSet(const TPagedSetToken& aToken);
1.113 +//
1.114 + inline TBool ContainsL(const T& anObject) const;
1.115 + inline void InsertL(const T& anObject);
1.116 + inline void DeleteL(const T& anObject);
1.117 + };
1.118 +
1.119 +/**
1.120 + * @publishedAll
1.121 + * @released
1.122 + */
1.123 +TEMPLATE_SPECIALIZATION class TPagedSet<TAny> : public TPagedSetBase
1.124 + {
1.125 +public:
1.126 + inline TPagedSet(TInt anEntrySize);
1.127 + inline TPagedSet(const TPagedSetToken& aToken,TInt anEntrySize);
1.128 + };
1.129 +
1.130 +/**
1.131 + * @publishedAll
1.132 + * @released
1.133 + */
1.134 +template <class T>
1.135 +class TPagedMultiset : public TPagedMultisetBase
1.136 + {
1.137 +public:
1.138 + inline TPagedMultiset();
1.139 + inline TPagedMultiset(const TPagedSetToken& aToken);
1.140 +//
1.141 + inline TBool ContainsL(const T& anObject) const;
1.142 + inline void InsertL(const T& anObject);
1.143 + inline void DeleteL(const T& anObject);
1.144 + };
1.145 +
1.146 +/**
1.147 + * @publishedAll
1.148 + * @released
1.149 + */
1.150 +TEMPLATE_SPECIALIZATION class TPagedMultiset<TAny> : public TPagedMultisetBase
1.151 + {
1.152 +public:
1.153 + inline TPagedMultiset(TInt anEntrySize);
1.154 + inline TPagedMultiset(const TPagedSetToken& aToken,TInt anEntrySize);
1.155 + };
1.156 +
1.157 +/**
1.158 + * @publishedAll
1.159 + * @released
1.160 + */
1.161 +class TPagedSetIterBase
1.162 + {
1.163 +public:
1.164 + IMPORT_C TBool ResetL();
1.165 + IMPORT_C TBool NextL();
1.166 + IMPORT_C void ExtractAtL(TAny* aPtr) const;
1.167 +protected:
1.168 + inline TPagedSetIterBase(const TPagedSetBase& aSet);
1.169 +private:
1.170 + const TBtreeFixBase* iTree;
1.171 + TBtreeMark iMark;
1.172 + };
1.173 +
1.174 +/**
1.175 + * @publishedAll
1.176 + * @released
1.177 + */
1.178 +template <class T>
1.179 +class TPagedSetIter : public TPagedSetIterBase
1.180 + {
1.181 +public:
1.182 + inline TPagedSetIter(const TPagedSet<T>& aSet);
1.183 + inline TPagedSetIter(const TPagedMultiset<T>& aSet);
1.184 + inline T AtL() const;
1.185 + inline void ExtractAtL(T& anObject) const;
1.186 + };
1.187 +
1.188 +/**
1.189 + * @publishedAll
1.190 + * @released
1.191 + */
1.192 +TEMPLATE_SPECIALIZATION class TPagedSetIter<TAny> : public TPagedSetIterBase
1.193 + {
1.194 +public:
1.195 + inline TPagedSetIter(const TPagedSetBase& aSet);
1.196 + };
1.197 +
1.198 +/**
1.199 + * @publishedAll
1.200 + * @released
1.201 + */
1.202 +class TPagedSetBiIterBase
1.203 + {
1.204 +public:
1.205 + IMPORT_C TBool FirstL();
1.206 + IMPORT_C TBool LastL();
1.207 + IMPORT_C TBool NextL();
1.208 + IMPORT_C TBool PreviousL();
1.209 + IMPORT_C void ExtractAtL(TAny* aPtr) const;
1.210 +protected:
1.211 + inline TPagedSetBiIterBase(const TPagedSetBase& aSet);
1.212 +private:
1.213 + const TBtreeFixBase* iTree;
1.214 + TBtreePos iPos;
1.215 + };
1.216 +
1.217 +/**
1.218 + * @publishedAll
1.219 + * @released
1.220 + */
1.221 +template <class T>
1.222 +class TPagedSetBiIter : public TPagedSetBiIterBase
1.223 + {
1.224 +public:
1.225 + inline TPagedSetBiIter(const TPagedSet<T>& aSet);
1.226 + inline TPagedSetBiIter(const TPagedMultiset<T>& aSet);
1.227 + inline T AtL() const;
1.228 + inline void ExtractAtL(T& anObject) const;
1.229 + };
1.230 +
1.231 +/**
1.232 + * @publishedAll
1.233 + * @released
1.234 + */
1.235 +TEMPLATE_SPECIALIZATION class TPagedSetBiIter<TAny> : public TPagedSetBiIterBase
1.236 + {
1.237 +public:
1.238 + inline TPagedSetBiIter(const TPagedSetBase& aSet);
1.239 + };
1.240 +
1.241 +/**
1.242 + * @publishedAll
1.243 + * @released
1.244 + */
1.245 +class TPagedSetRIterBase
1.246 + {
1.247 +public:
1.248 + inline TBool ResetL();
1.249 + inline TBool NextL();
1.250 + inline void ExtractAtL(TAny* aPtr) const;
1.251 +protected:
1.252 + inline TPagedSetRIterBase(const TPagedSetBase& aSet);
1.253 +private:
1.254 + TPagedSetBiIter<TAny> iIter;
1.255 + };
1.256 +
1.257 +/**
1.258 + * @publishedAll
1.259 + * @released
1.260 + */
1.261 +template <class T>
1.262 +class TPagedSetRIter : public TPagedSetRIterBase
1.263 + {
1.264 +public:
1.265 + inline TPagedSetRIter(const TPagedSet<T>& aSet);
1.266 + inline TPagedSetRIter(const TPagedMultiset<T>& aSet);
1.267 + inline T AtL() const;
1.268 + inline void ExtractAtL(T& anObject) const;
1.269 + };
1.270 +
1.271 +/**
1.272 + * @publishedAll
1.273 + * @released
1.274 + */
1.275 +TEMPLATE_SPECIALIZATION class TPagedSetRIter<TAny> : public TPagedSetRIterBase
1.276 + {
1.277 +public:
1.278 + inline TPagedSetRIter(const TPagedSetBase& aSet);
1.279 + };
1.280 +
1.281 +#include <s32cont.inl>
1.282 +#endif