Update contrib.
1 // Copyright (c) 1998-2010 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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
18 EXPORT_C void TPagedSetToken::ExternalizeL(RWriteStream &aStream) const
20 __ASSERT_DEBUG(iCount>=0,User::Invariant());
21 TBtreeToken::ExternalizeL(aStream);
22 aStream.WriteInt32L(iCount);
25 EXPORT_C void TPagedSetToken::InternalizeL(RReadStream &aStream)
27 TBtreeToken::InternalizeL(aStream);
28 iCount=aStream.ReadInt32L();
33 EXPORT_C void TPagedSetToken::Clear()
39 EXPORT_C TPagedSetBase::TPagedSetBase(TInt anEntrySize)
41 // Constructor creating a new set.
43 : iTree(EBtreeSecure,anEntrySize,anEntrySize),iKey(anEntrySize),iCount(0)
46 EXPORT_C TPagedSetBase::TPagedSetBase(const TPagedSetToken &aToken,TInt anEntrySize)
48 // Constructor reinstating an existing set.
50 : iTree(aToken,EBtreeSecure,anEntrySize,anEntrySize),iKey(anEntrySize),iCount(aToken.iCount)
53 EXPORT_C void TPagedSetBase::Connect(MPagePool *aPool)
55 // Hook the tree up to its bits.
58 iTree.Connect(aPool,&iKey);
61 EXPORT_C void TPagedSetBase::Set(const TPagedSetToken &aToken)
63 // Set to the state described by aToken.
66 iTree.Set(aToken,EBtreeSecure);
70 EXPORT_C TPagedSetToken TPagedSetBase::Token() const
72 // Build the streaming token for the set.
75 return TPagedSetToken(iTree.Token(),iCount);
78 EXPORT_C TInt TPagedSetBase::RepairL()
80 // Repair a broken set.
83 TInt count=iTree.RepairL();
88 EXPORT_C void TPagedSetBase::ClearL()
97 EXPORT_C TBool TPagedSetBase::ContainsL(const TAny *aPtr) const
99 // Return whether the set contains an entry equal to the one pointed to by aPtr.
103 return iTree.FindL(pos,aPtr);
106 EXPORT_C void TPagedSetBase::InsertL(const TAny *aPtr)
108 // Insert an entry into the set.
112 if (!iTree.InsertL(pos,aPtr))
113 __LEAVE(KErrAlreadyExists); // a duplicate
118 EXPORT_C void TPagedSetBase::DeleteL(const TAny *aPtr)
120 // Delete an entry from the set.
123 if (!iTree.DeleteL(aPtr))
124 __LEAVE(KErrNotFound);
129 EXPORT_C void TPagedSetBase::InsertAllowDuplicatesL(const TAny *aPtr)
131 // Insert an entry into the set, allow duplicates.
135 __DEBUG(TBool success=)iTree.InsertL(pos,aPtr,EAllowDuplicates);
136 __ASSERT_DEBUG(success,User::Invariant());
140 EXPORT_C TBool TPagedSetIterBase::ResetL()
142 return iTree->ResetL(iMark);
145 EXPORT_C TBool TPagedSetIterBase::NextL()
147 return iTree->NextL(iMark);
150 EXPORT_C void TPagedSetIterBase::ExtractAtL(TAny* aPtr) const
152 iTree->ExtractAtL(iMark,aPtr);
155 EXPORT_C TBool TPagedSetBiIterBase::FirstL()
157 return iTree->FirstL(iPos);
160 EXPORT_C TBool TPagedSetBiIterBase::LastL()
162 return iTree->LastL(iPos);
165 EXPORT_C TBool TPagedSetBiIterBase::NextL()
167 return iTree->NextL(iPos);
170 EXPORT_C TBool TPagedSetBiIterBase::PreviousL()
172 return iTree->PreviousL(iPos);
175 EXPORT_C void TPagedSetBiIterBase::ExtractAtL(TAny* aPtr) const
177 iTree->ExtractAtL(iPos,aPtr);