|
1 // Copyright (c) 1996-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 the License "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 // f32\inc\f32file.inl |
|
15 // |
|
16 // |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // Class TEntry |
|
22 inline const TUid& TEntry::operator[](TInt anIndex) const |
|
23 /** |
|
24 Gets any one of the file's three UIDs. |
|
25 |
|
26 @param anIndex Identifies the UID required. This can be zero, one or |
|
27 two. Specifiying any other value raises a panic. |
|
28 |
|
29 @return On return, contains the requested UID. |
|
30 |
|
31 @see TUidType |
|
32 */ |
|
33 {return(iType[anIndex]);} |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 inline TBool TEntry::IsUidPresent(TUid aUid) const |
|
39 /** |
|
40 Tests whether the specified UID matches any of the UIDs in the UID type. |
|
41 |
|
42 @param aUid The UID to be checked. |
|
43 |
|
44 @return True if the specified UID is present, false otherwise. |
|
45 |
|
46 @see TUidType::IsPresent |
|
47 @see TUidType |
|
48 */ |
|
49 {return(iType.IsPresent(aUid));} |
|
50 |
|
51 |
|
52 |
|
53 |
|
54 inline TBool TEntry::IsTypeValid() const |
|
55 /** |
|
56 Test whether the file has a valid UID. |
|
57 |
|
58 @return True if the entry has a valid UID, false otherwise. |
|
59 |
|
60 @see TUidType::IsValid |
|
61 @see TUidType |
|
62 */ |
|
63 {return(iType.IsValid());} |
|
64 |
|
65 |
|
66 |
|
67 |
|
68 inline TUid TEntry::MostDerivedUid() const |
|
69 /** |
|
70 Gets the most derived (i.e. the most specific) UID. |
|
71 |
|
72 @return The entry's most derived UID. |
|
73 |
|
74 @see TUidType::MostDerived |
|
75 @see TUidType |
|
76 */ |
|
77 {return(iType.MostDerived());} |
|
78 |
|
79 /** |
|
80 Sets 64 bit file size. |
|
81 |
|
82 The low word is stored in iSize and high word is stored in private data member iSizeHigh. |
|
83 This is intended to be used by File Systsem Plugin implementations, and not recommended |
|
84 to be called by general clients of the File Server. |
|
85 |
|
86 @publishedAll |
|
87 @prototype |
|
88 |
|
89 @see TEntry::iSize |
|
90 */ |
|
91 inline void TEntry::SetFileSize(TInt64 aFileSize) |
|
92 { |
|
93 iAtt &= ~KEntryAttPacked; |
|
94 iSizeHigh=I64HIGH(aFileSize); |
|
95 iSize=I64LOW(aFileSize); |
|
96 } |
|
97 |
|
98 // Class TFindFile |
|
99 inline const TDesC& TFindFile::File() const |
|
100 /** |
|
101 Gets the full file specification of a file which was found by a successful |
|
102 call to any of the search variants that do not accept wildcards. |
|
103 |
|
104 The file specification includes drive, path and filename. |
|
105 |
|
106 Notes: |
|
107 |
|
108 1. When called after a successful search using wildcards the only valid |
|
109 components of the retrieved file specification are drive letter and |
|
110 directory. |
|
111 |
|
112 @return The full path and filename. |
|
113 */ |
|
114 {return iFile.FullName();} |
|
115 |
|
116 |
|
117 |
|
118 // Class CDirScan |
|
119 inline RFs& CDirScan::Fs() |
|
120 {return(*iFs);} |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 // Class TDriveUnit |
|
126 inline TDriveUnit::operator TInt() const |
|
127 /** |
|
128 Converts the drive unit to an integer value. |
|
129 */ |
|
130 {return(iDrive);} |
|
131 |
|
132 |
|
133 |
|
134 |
|
135 inline TInt ValidateMatchMask( TUint aMask) |
|
136 /** |
|
137 Validates the mask used to match drive attributes. |
|
138 */ |
|
139 { |
|
140 const TUint matchedFlags= aMask & KDriveAttMatchedFlags; //KDriveAttMatchedFlags = 0xFFF |
|
141 const TUint matchedAtt = aMask & KDriveAttMatchedAtt; //KDriveAttMatchedAtt = 0x0FFF0000 |
|
142 |
|
143 switch(matchedAtt) |
|
144 { |
|
145 case KDriveAttExclude: |
|
146 return matchedFlags==0?KErrArgument:KErrNone; |
|
147 case KDriveAttExclusive : |
|
148 return matchedFlags==0?KErrArgument:KErrNone; |
|
149 case KDriveAttExclude | KDriveAttExclusive: |
|
150 return matchedFlags==0?KErrArgument:KErrNone; |
|
151 case KDriveAttAll: |
|
152 return matchedFlags==0?KErrNone:KErrArgument; |
|
153 case 0: |
|
154 return KErrNone; |
|
155 default: |
|
156 return KErrArgument; |
|
157 } |
|
158 } |
|
159 |
|
160 inline RFs::TNameValidParam::TNameValidParam(TBool aUseSessionPath) |
|
161 { |
|
162 iError = ErrNone; |
|
163 iUseSessionPath = aUseSessionPath; |
|
164 iInvalidCharPos = 0; |
|
165 } |
|
166 |
|
167 |
|
168 |
|
169 inline RFs::TNameValidParam::TError RFs::TNameValidParam::ErrorCode()const |
|
170 |
|
171 /** |
|
172 returns the error code. |
|
173 @see TError |
|
174 */ |
|
175 { |
|
176 return iError; |
|
177 } |
|
178 |
|
179 /** |
|
180 Allows the user to set, whether he wants to use the session path for filling |
|
181 up missing parts of the name that he passes to RFs::IsValidName(TDesC& aName, TNameValidParam& aParam). |
|
182 If aUseSessionPath is EFalse, then the sessionpath is not used to validate aName. |
|
183 */ |
|
184 inline void RFs::TNameValidParam::UseSessionPath(TBool aUseSessionPath) |
|
185 { |
|
186 iUseSessionPath = aUseSessionPath; |
|
187 } |
|
188 |
|
189 /** |
|
190 if the error code returned by TNameValidParam::ErrorCode() is TError::ErrBadCharacter, |
|
191 then this returns the position of the rightmost invalid character. |
|
192 For eg: "a>bcd>" would have the iInvalidCharPos=6 and not 2. |
|
193 However preference is given to wild characters whil reporting the invalid character position |
|
194 For eg: "a*bcd>" would return the iInvalidCharPos= 2 and not 6. |
|
195 if any other error code is returned then this value is 0. |
|
196 */ |
|
197 inline TUint RFs::TNameValidParam::InvalidCharPos()const |
|
198 { |
|
199 return iInvalidCharPos; |
|
200 } |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 //------------------------------------------------------------------------------------------------------------------- |
|
206 TVolFormatParam::TVolFormatParam() |
|
207 :iUId((TUint32)KUId), iFSysNameHash(0) |
|
208 { |
|
209 Init(); |
|
210 } |
|
211 |
|
212 /** resets all data to the "not set" values */ |
|
213 void TVolFormatParam::Init() |
|
214 { |
|
215 iFSysNameHash = 0; |
|
216 iParamsSet = EFalse; |
|
217 Mem::FillZ(iData, sizeof(iData)); |
|
218 } |
|
219 |
|
220 /** |
|
221 Calculates the file system name hash. For use in conjunction with this class only |
|
222 The file system name hash is a standard CRC32 on the up-cased name. |
|
223 |
|
224 @param aFsName given name. |
|
225 @return CRC32 name hash value |
|
226 |
|
227 */ |
|
228 TUint32 TVolFormatParam::CalcFSNameHash(const TDesC& aFsName) |
|
229 { |
|
230 TUint32 nameHash = 0; |
|
231 |
|
232 if(aFsName.Length() > 0) |
|
233 { |
|
234 TFullName fsName; |
|
235 fsName.Copy(aFsName); |
|
236 fsName.UpperCase(); |
|
237 Mem::Crc32(nameHash, fsName.Ptr(), fsName.Length()); |
|
238 } |
|
239 |
|
240 return nameHash; |
|
241 } |
|
242 |
|
243 |
|
244 /** sets the file system name hash corresponding to aFsName */ |
|
245 void TVolFormatParam::SetFileSystemName(const TDesC& aFsName) |
|
246 { |
|
247 iFSysNameHash = CalcFSNameHash(aFsName); |
|
248 } |
|
249 |
|
250 /** @return file system name hash that was wet by SetFileSystemName() */ |
|
251 TUint32 TVolFormatParam::FSNameHash() const |
|
252 { |
|
253 return iFSysNameHash; |
|
254 } |
|
255 |
|
256 /** @return ETrue if the user has set at least one parameter apart from the file sysetm name, i.e. SetVal() was called */ |
|
257 TBool TVolFormatParam::SomeParamsSet() const |
|
258 { |
|
259 return iParamsSet; |
|
260 } |
|
261 |
|
262 /** |
|
263 assign a data slot some integer value. |
|
264 @param index of the slot 0..KMaxDataSlots-1 |
|
265 @aVal value to set |
|
266 */ |
|
267 void TVolFormatParam::SetVal(TUint aIndex, TUint32 aVal) |
|
268 { |
|
269 ASSERT(aIndex < KMaxDataSlots); |
|
270 iData[aIndex] = aVal; |
|
271 iParamsSet= ETrue; |
|
272 } |
|
273 |
|
274 /** |
|
275 @param index of the slot 0..KMaxDataSlots-1 |
|
276 @return data from the specified slot |
|
277 */ |
|
278 TUint32 TVolFormatParam::GetVal(TUint aIndex) const |
|
279 { |
|
280 ASSERT(aIndex< KMaxDataSlots); |
|
281 return iData[aIndex]; |
|
282 } |
|
283 |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |