Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // f32\inc\f32file.inl
22 inline const TUid& TEntry::operator[](TInt anIndex) const
24 Gets any one of the file's three UIDs.
26 @param anIndex Identifies the UID required. This can be zero, one or
27 two. Specifiying any other value raises a panic.
29 @return On return, contains the requested UID.
33 {return(iType[anIndex]);}
38 inline TBool TEntry::IsUidPresent(TUid aUid) const
40 Tests whether the specified UID matches any of the UIDs in the UID type.
42 @param aUid The UID to be checked.
44 @return True if the specified UID is present, false otherwise.
46 @see TUidType::IsPresent
49 {return(iType.IsPresent(aUid));}
54 inline TBool TEntry::IsTypeValid() const
56 Test whether the file has a valid UID.
58 @return True if the entry has a valid UID, false otherwise.
60 @see TUidType::IsValid
63 {return(iType.IsValid());}
68 inline TUid TEntry::MostDerivedUid() const
70 Gets the most derived (i.e. the most specific) UID.
72 @return The entry's most derived UID.
74 @see TUidType::MostDerived
77 {return(iType.MostDerived());}
80 Sets 64 bit file size.
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.
91 inline void TEntry::SetFileSize(TInt64 aFileSize)
93 iAtt &= ~KEntryAttPacked;
94 iSizeHigh=I64HIGH(aFileSize);
95 iSize=I64LOW(aFileSize);
99 inline const TDesC& TFindFile::File() const
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.
104 The file specification includes drive, path and filename.
108 1. When called after a successful search using wildcards the only valid
109 components of the retrieved file specification are drive letter and
112 @return The full path and filename.
114 {return iFile.FullName();}
119 inline RFs& CDirScan::Fs()
126 inline TDriveUnit::operator TInt() const
128 Converts the drive unit to an integer value.
135 inline TInt ValidateMatchMask( TUint aMask)
137 Validates the mask used to match drive attributes.
140 const TUint matchedFlags= aMask & KDriveAttMatchedFlags; //KDriveAttMatchedFlags = 0xFFF
141 const TUint matchedAtt = aMask & KDriveAttMatchedAtt; //KDriveAttMatchedAtt = 0x0FFF0000
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;
152 return matchedFlags==0?KErrNone:KErrArgument;
160 inline RFs::TNameValidParam::TNameValidParam(TBool aUseSessionPath)
163 iUseSessionPath = aUseSessionPath;
169 inline RFs::TNameValidParam::TError RFs::TNameValidParam::ErrorCode()const
172 returns the error code.
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.
184 inline void RFs::TNameValidParam::UseSessionPath(TBool aUseSessionPath)
186 iUseSessionPath = aUseSessionPath;
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.
197 inline TUint RFs::TNameValidParam::InvalidCharPos()const
199 return iInvalidCharPos;
205 //-------------------------------------------------------------------------------------------------------------------
206 TVolFormatParam::TVolFormatParam()
207 :iUId((TUint32)KUId), iFSysNameHash(0)
212 /** resets all data to the "not set" values */
213 void TVolFormatParam::Init()
217 Mem::FillZ(iData, sizeof(iData));
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.
224 @param aFsName given name.
225 @return CRC32 name hash value
228 TUint32 TVolFormatParam::CalcFSNameHash(const TDesC& aFsName)
230 TUint32 nameHash = 0;
232 if(aFsName.Length() > 0)
235 fsName.Copy(aFsName);
237 Mem::Crc32(nameHash, fsName.Ptr(), fsName.Length());
244 /** sets the file system name hash corresponding to aFsName */
245 void TVolFormatParam::SetFileSystemName(const TDesC& aFsName)
247 iFSysNameHash = CalcFSNameHash(aFsName);
250 /** @return file system name hash that was wet by SetFileSystemName() */
251 TUint32 TVolFormatParam::FSNameHash() const
253 return iFSysNameHash;
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
263 assign a data slot some integer value.
264 @param index of the slot 0..KMaxDataSlots-1
267 void TVolFormatParam::SetVal(TUint aIndex, TUint32 aVal)
269 ASSERT(aIndex < KMaxDataSlots);
270 iData[aIndex] = aVal;
275 @param index of the slot 0..KMaxDataSlots-1
276 @return data from the specified slot
278 TUint32 TVolFormatParam::GetVal(TUint aIndex) const
280 ASSERT(aIndex< KMaxDataSlots);
281 return iData[aIndex];