sl@0
|
1 |
// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
// Class CDbStoreDatabase
|
sl@0
|
17 |
inline CStreamStore& CDbStoreDatabase::Store()
|
sl@0
|
18 |
{
|
sl@0
|
19 |
return *iStore;
|
sl@0
|
20 |
}
|
sl@0
|
21 |
|
sl@0
|
22 |
inline MDbStreamFilter* CDbStoreDatabase::Filter()
|
sl@0
|
23 |
{
|
sl@0
|
24 |
return iFilter;
|
sl@0
|
25 |
}
|
sl@0
|
26 |
|
sl@0
|
27 |
// Class TDbStoreIndexStats
|
sl@0
|
28 |
inline TDbStoreIndexStats::TDbStoreIndexStats() :
|
sl@0
|
29 |
iRefresh(EInvalid),
|
sl@0
|
30 |
iFlags(0)
|
sl@0
|
31 |
{
|
sl@0
|
32 |
}
|
sl@0
|
33 |
|
sl@0
|
34 |
inline TBool TDbStoreIndexStats::IsValid() const
|
sl@0
|
35 |
{
|
sl@0
|
36 |
return iRefresh>=ERefresh;
|
sl@0
|
37 |
}
|
sl@0
|
38 |
|
sl@0
|
39 |
// Class CDbStoreIndexDef
|
sl@0
|
40 |
inline void CDbStoreIndexDef::SetTokenId(TStreamId anId)
|
sl@0
|
41 |
{
|
sl@0
|
42 |
iTokenId=anId;
|
sl@0
|
43 |
}
|
sl@0
|
44 |
|
sl@0
|
45 |
inline TStreamId CDbStoreIndexDef::TokenId() const
|
sl@0
|
46 |
{
|
sl@0
|
47 |
return iTokenId;
|
sl@0
|
48 |
}
|
sl@0
|
49 |
|
sl@0
|
50 |
// Class TRecordSize
|
sl@0
|
51 |
inline TInt TRecordSize::Clustering() const
|
sl@0
|
52 |
{
|
sl@0
|
53 |
return iClustering;
|
sl@0
|
54 |
}
|
sl@0
|
55 |
|
sl@0
|
56 |
inline TInt TRecordSize::InlineLimit() const
|
sl@0
|
57 |
{
|
sl@0
|
58 |
return iInlineLimit;
|
sl@0
|
59 |
}
|
sl@0
|
60 |
|
sl@0
|
61 |
inline TInt TRecordSize::FixedFieldSize(TDbColType aType)
|
sl@0
|
62 |
{
|
sl@0
|
63 |
__ASSERT(aType>EDbColBit&&aType<EDbColText8);
|
sl@0
|
64 |
return FieldSizes[aType];
|
sl@0
|
65 |
}
|
sl@0
|
66 |
|
sl@0
|
67 |
// Class CDbStoreDef
|
sl@0
|
68 |
inline void CDbStoreDef::SetTokenId(TStreamId anId)
|
sl@0
|
69 |
{
|
sl@0
|
70 |
iTokenId=anId;
|
sl@0
|
71 |
}
|
sl@0
|
72 |
|
sl@0
|
73 |
inline TStreamId CDbStoreDef::TokenId() const
|
sl@0
|
74 |
{
|
sl@0
|
75 |
return iTokenId;
|
sl@0
|
76 |
}
|
sl@0
|
77 |
|
sl@0
|
78 |
inline TInt CDbStoreDef::Clustering() const
|
sl@0
|
79 |
{
|
sl@0
|
80 |
return iInfo.Clustering();
|
sl@0
|
81 |
}
|
sl@0
|
82 |
|
sl@0
|
83 |
inline TInt CDbStoreDef::InlineLimit() const
|
sl@0
|
84 |
{
|
sl@0
|
85 |
return iInfo.InlineLimit();
|
sl@0
|
86 |
}
|
sl@0
|
87 |
|
sl@0
|
88 |
// Class TClusterId
|
sl@0
|
89 |
inline TClusterId ClusterId(TDbRecordId aRecordId)
|
sl@0
|
90 |
{
|
sl@0
|
91 |
return aRecordId.Value()>>4;
|
sl@0
|
92 |
}
|
sl@0
|
93 |
|
sl@0
|
94 |
inline TInt RecordIndex(TDbRecordId aRecordId)
|
sl@0
|
95 |
{
|
sl@0
|
96 |
return aRecordId.Value()&0xfu;
|
sl@0
|
97 |
}
|
sl@0
|
98 |
|
sl@0
|
99 |
inline TDbRecordId RecordId(TClusterId aId,TInt aIndex)
|
sl@0
|
100 |
{
|
sl@0
|
101 |
__ASSERT(TUint(aIndex)<16u);
|
sl@0
|
102 |
return (aId<<4)+aIndex;
|
sl@0
|
103 |
}
|
sl@0
|
104 |
|
sl@0
|
105 |
inline TClusterId ClusterId(TStreamId aStreamId)
|
sl@0
|
106 |
{
|
sl@0
|
107 |
return aStreamId.Value();
|
sl@0
|
108 |
}
|
sl@0
|
109 |
|
sl@0
|
110 |
// Class RClusterMap
|
sl@0
|
111 |
inline RClusterMap::RClusterMap()
|
sl@0
|
112 |
{
|
sl@0
|
113 |
__ASSERT(iMap==0 && iAlloc==0);
|
sl@0
|
114 |
}
|
sl@0
|
115 |
|
sl@0
|
116 |
inline void RClusterMap::Close()
|
sl@0
|
117 |
{
|
sl@0
|
118 |
User::Free(iMap);
|
sl@0
|
119 |
}
|
sl@0
|
120 |
|
sl@0
|
121 |
inline TClusterId RClusterMap::LastBound() const
|
sl@0
|
122 |
{
|
sl@0
|
123 |
return iLastBound;
|
sl@0
|
124 |
}
|
sl@0
|
125 |
|
sl@0
|
126 |
inline void RClusterMap::Complete(TClusterId aLastCluster)
|
sl@0
|
127 |
{
|
sl@0
|
128 |
if (aLastCluster==iLastBound)
|
sl@0
|
129 |
{
|
sl@0
|
130 |
iComplete=ETrue;
|
sl@0
|
131 |
}
|
sl@0
|
132 |
}
|
sl@0
|
133 |
|
sl@0
|
134 |
inline TBool RClusterMap::IsComplete() const
|
sl@0
|
135 |
{
|
sl@0
|
136 |
return iComplete;
|
sl@0
|
137 |
}
|
sl@0
|
138 |
|
sl@0
|
139 |
inline void RClusterMap::BindL(TClusterId aPrevious,TClusterId aCluster)
|
sl@0
|
140 |
{
|
sl@0
|
141 |
if (aPrevious==iLastBound)
|
sl@0
|
142 |
{
|
sl@0
|
143 |
AddL(aCluster);
|
sl@0
|
144 |
}
|
sl@0
|
145 |
}
|
sl@0
|
146 |
|
sl@0
|
147 |
// Class TClusterLinkCache
|
sl@0
|
148 |
inline void TClusterLinkCache::Invalidate()
|
sl@0
|
149 |
{
|
sl@0
|
150 |
iEnd=NULL;
|
sl@0
|
151 |
}
|
sl@0
|
152 |
|
sl@0
|
153 |
void TClusterLinkCache::Reset(TClusterId aBaseId)
|
sl@0
|
154 |
{
|
sl@0
|
155 |
*(iEnd=iMap)=aBaseId;
|
sl@0
|
156 |
}
|
sl@0
|
157 |
|
sl@0
|
158 |
inline void TClusterLinkCache::Bind(TClusterId aPrevious,TClusterId aCluster,RClusterMap& aMap)
|
sl@0
|
159 |
{
|
sl@0
|
160 |
if (iEnd!=NULL && *iEnd==aPrevious)
|
sl@0
|
161 |
{
|
sl@0
|
162 |
Add(aCluster,aMap);
|
sl@0
|
163 |
}
|
sl@0
|
164 |
}
|
sl@0
|
165 |
|
sl@0
|
166 |
// Class CCluster
|
sl@0
|
167 |
inline CCluster::CCluster(CDbStoreDatabase& aDatabase) :
|
sl@0
|
168 |
iDatabase(aDatabase)
|
sl@0
|
169 |
{
|
sl@0
|
170 |
}
|
sl@0
|
171 |
|
sl@0
|
172 |
inline TBool CCluster::IsFull() const
|
sl@0
|
173 |
{
|
sl@0
|
174 |
return iMap[KMaxClustering]-iMap[0]>=KClusterLimit;
|
sl@0
|
175 |
}
|
sl@0
|
176 |
|
sl@0
|
177 |
inline TClusterId CCluster::Id() const
|
sl@0
|
178 |
{
|
sl@0
|
179 |
return iCluster;
|
sl@0
|
180 |
}
|
sl@0
|
181 |
|
sl@0
|
182 |
inline const TClusterDes& CCluster::Des() const
|
sl@0
|
183 |
{
|
sl@0
|
184 |
return iDes;
|
sl@0
|
185 |
}
|
sl@0
|
186 |
|
sl@0
|
187 |
// Class CClusterCache
|
sl@0
|
188 |
inline CDbStoreDatabase& CClusterCache::Database()
|
sl@0
|
189 |
{
|
sl@0
|
190 |
return iDatabase;
|
sl@0
|
191 |
}
|
sl@0
|
192 |
|
sl@0
|
193 |
inline CStreamStore& CClusterCache::Store()
|
sl@0
|
194 |
{
|
sl@0
|
195 |
return Database().Store();
|
sl@0
|
196 |
}
|
sl@0
|
197 |
|
sl@0
|
198 |
// Class CDbStoreRecords
|
sl@0
|
199 |
inline TClusterId CDbStoreRecords::Head() const
|
sl@0
|
200 |
{
|
sl@0
|
201 |
return iToken.iHead;
|
sl@0
|
202 |
}
|
sl@0
|
203 |
|
sl@0
|
204 |
inline TInt CDbStoreRecords::Count() const
|
sl@0
|
205 |
{
|
sl@0
|
206 |
return iToken.iCount;
|
sl@0
|
207 |
}
|
sl@0
|
208 |
|
sl@0
|
209 |
// Class CDbStoreTable
|
sl@0
|
210 |
inline const CDbStoreDef& CDbStoreTable::Def() const
|
sl@0
|
211 |
{
|
sl@0
|
212 |
return STATIC_CAST(const CDbStoreDef&,CDbTable::Def());
|
sl@0
|
213 |
}
|
sl@0
|
214 |
|
sl@0
|
215 |
inline CDbStoreDatabase& CDbStoreTable::Database()
|
sl@0
|
216 |
{
|
sl@0
|
217 |
return STATIC_CAST(CDbStoreDatabase&,CDbTable::Database());
|
sl@0
|
218 |
}
|
sl@0
|
219 |
|
sl@0
|
220 |
inline CDbStoreRecords& CDbStoreTable::StoreRecordsL()
|
sl@0
|
221 |
{
|
sl@0
|
222 |
return STATIC_CAST(CDbStoreRecords&,CDbTable::RecordsL());
|
sl@0
|
223 |
}
|
sl@0
|
224 |
|
sl@0
|
225 |
|
sl@0
|
226 |
// Class CDbStoreCompression
|
sl@0
|
227 |
inline void CDbStoreCompression::Inflate()
|
sl@0
|
228 |
{
|
sl@0
|
229 |
__ASSERT(iState==EDecoding);
|
sl@0
|
230 |
iState=EInflating;
|
sl@0
|
231 |
}
|
sl@0
|
232 |
|