os/kernelhwsrv/userlibandfileserver/fileserver/inc/f32file.inl
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/kernelhwsrv/userlibandfileserver/fileserver/inc/f32file.inl	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,289 @@
     1.4 +// Copyright (c) 1996-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 the License "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 +// f32\inc\f32file.inl
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +
    1.22 +
    1.23 +
    1.24 +// Class TEntry
    1.25 +inline const TUid& TEntry::operator[](TInt anIndex) const
    1.26 +/**
    1.27 +Gets any one of the file's three UIDs.
    1.28 +
    1.29 +@param anIndex Identifies the UID required. This can be zero, one or 
    1.30 +               two. Specifiying any other value raises a panic.
    1.31 +
    1.32 +@return On return, contains the requested UID.
    1.33 +
    1.34 +@see TUidType
    1.35 +*/
    1.36 +    {return(iType[anIndex]);}
    1.37 +
    1.38 +
    1.39 +
    1.40 +
    1.41 +inline TBool TEntry::IsUidPresent(TUid aUid) const
    1.42 +/**
    1.43 +Tests whether the specified UID matches any of the UIDs in the UID type.
    1.44 +
    1.45 +@param aUid The UID to be checked.
    1.46 +
    1.47 +@return True if the specified UID is present, false otherwise.
    1.48 +
    1.49 +@see TUidType::IsPresent
    1.50 +@see TUidType
    1.51 +*/
    1.52 +    {return(iType.IsPresent(aUid));}
    1.53 +
    1.54 +
    1.55 +
    1.56 +
    1.57 +inline TBool TEntry::IsTypeValid() const
    1.58 +/**
    1.59 +Test whether the file has a valid UID.
    1.60 +
    1.61 +@return True if the entry has a valid UID, false otherwise. 
    1.62 +
    1.63 +@see TUidType::IsValid  
    1.64 +@see TUidType
    1.65 +*/
    1.66 +    {return(iType.IsValid());}
    1.67 +
    1.68 +
    1.69 +
    1.70 +
    1.71 +inline TUid TEntry::MostDerivedUid() const
    1.72 +/**
    1.73 +Gets the most derived (i.e. the most specific) UID.
    1.74 +
    1.75 +@return The entry's most derived UID.
    1.76 +
    1.77 +@see TUidType::MostDerived
    1.78 +@see TUidType
    1.79 +*/
    1.80 +    {return(iType.MostDerived());}
    1.81 +
    1.82 +/**
    1.83 +Sets 64 bit file size.
    1.84 +
    1.85 +The low word is stored in iSize and high word is stored in private data member iSizeHigh.
    1.86 +This is intended to be used by File Systsem Plugin implementations, and not recommended
    1.87 +to be called by general clients of the File Server.
    1.88 +
    1.89 +@publishedAll
    1.90 +@prototype
    1.91 +
    1.92 +@see TEntry::iSize
    1.93 +*/
    1.94 +inline void TEntry::SetFileSize(TInt64 aFileSize)
    1.95 +	{
    1.96 +	iAtt &= ~KEntryAttPacked;
    1.97 +	iSizeHigh=I64HIGH(aFileSize); 
    1.98 +	iSize=I64LOW(aFileSize);
    1.99 +	}
   1.100 +
   1.101 +// Class TFindFile
   1.102 +inline const TDesC& TFindFile::File() const
   1.103 +/**
   1.104 +Gets the full file specification of a file which was found by a successful 
   1.105 +call to any of the search variants that do not accept wildcards.
   1.106 +
   1.107 +The file specification includes drive, path and filename.
   1.108 +
   1.109 +Notes:
   1.110 +
   1.111 +1. When called after a successful search using wildcards the only valid 
   1.112 +   components of the retrieved file specification are drive letter and 
   1.113 +   directory.
   1.114 +   
   1.115 +@return The full path and filename.
   1.116 +*/
   1.117 +	{return iFile.FullName();}
   1.118 +
   1.119 +
   1.120 +
   1.121 +// Class CDirScan
   1.122 +inline RFs& CDirScan::Fs()
   1.123 +	{return(*iFs);}
   1.124 +
   1.125 +
   1.126 +
   1.127 +
   1.128 +// Class TDriveUnit
   1.129 +inline TDriveUnit::operator TInt() const
   1.130 +/**
   1.131 +Converts the drive unit to an integer value.
   1.132 +*/
   1.133 +	{return(iDrive);}
   1.134 +
   1.135 +
   1.136 +
   1.137 +
   1.138 +inline TInt ValidateMatchMask( TUint aMask)
   1.139 +/**
   1.140 +Validates the mask used to match drive attributes.
   1.141 +*/
   1.142 +	{
   1.143 +	const TUint matchedFlags= aMask & KDriveAttMatchedFlags;  //KDriveAttMatchedFlags = 0xFFF
   1.144 +	const TUint matchedAtt = aMask & KDriveAttMatchedAtt;	 //KDriveAttMatchedAtt = 0x0FFF0000
   1.145 +	
   1.146 +	switch(matchedAtt)
   1.147 +		{
   1.148 +		case KDriveAttExclude:
   1.149 +			return matchedFlags==0?KErrArgument:KErrNone;
   1.150 +		case KDriveAttExclusive :
   1.151 +			return matchedFlags==0?KErrArgument:KErrNone;
   1.152 +		case KDriveAttExclude | KDriveAttExclusive:
   1.153 +			return matchedFlags==0?KErrArgument:KErrNone;
   1.154 +		case KDriveAttAll:
   1.155 +			return matchedFlags==0?KErrNone:KErrArgument;
   1.156 +		case 0:
   1.157 +			return KErrNone;
   1.158 +		default:
   1.159 +			return KErrArgument;										
   1.160 +		}
   1.161 +	}	
   1.162 +
   1.163 +inline RFs::TNameValidParam::TNameValidParam(TBool aUseSessionPath)
   1.164 +	{
   1.165 +  	iError = ErrNone;
   1.166 +  	iUseSessionPath = aUseSessionPath;
   1.167 +  	iInvalidCharPos = 0;
   1.168 +  	}
   1.169 +
   1.170 +
   1.171 +
   1.172 +inline RFs::TNameValidParam::TError RFs::TNameValidParam::ErrorCode()const
   1.173 +
   1.174 +/**
   1.175 +returns the error code.
   1.176 +@see TError 
   1.177 +*/ 
   1.178 +	{
   1.179 +	return iError;
   1.180 +	}
   1.181 +
   1.182 +/**
   1.183 +Allows the user to set, whether he wants to use the session path for filling
   1.184 +up missing parts of the name that he passes to RFs::IsValidName(TDesC& aName, TNameValidParam& aParam).
   1.185 +If aUseSessionPath is EFalse, then the sessionpath is not used to validate aName.
   1.186 +*/
   1.187 +inline void RFs::TNameValidParam::UseSessionPath(TBool aUseSessionPath)
   1.188 +	{
   1.189 +	iUseSessionPath = aUseSessionPath;
   1.190 +	}
   1.191 +
   1.192 +/**
   1.193 +if the error code returned by TNameValidParam::ErrorCode() is TError::ErrBadCharacter,
   1.194 +then this returns the position of the rightmost invalid character.
   1.195 +For eg: "a>bcd>" would have the iInvalidCharPos=6 and not 2.
   1.196 +However preference is given to wild characters whil reporting the invalid character position
   1.197 +For eg: "a*bcd>" would return the iInvalidCharPos= 2 and not 6. 
   1.198 +if any other error code is returned then this value is 0.
   1.199 +*/
   1.200 +inline TUint RFs::TNameValidParam::InvalidCharPos()const
   1.201 +	{
   1.202 +	return iInvalidCharPos;
   1.203 +	}
   1.204 +	
   1.205 +
   1.206 +
   1.207 +
   1.208 +//-------------------------------------------------------------------------------------------------------------------
   1.209 +TVolFormatParam::TVolFormatParam() 
   1.210 +                :iUId((TUint32)KUId), iFSysNameHash(0)
   1.211 +    {
   1.212 +    Init();
   1.213 +    }
   1.214 +
   1.215 +/** resets all data to the "not set" values */
   1.216 +void TVolFormatParam::Init()
   1.217 +    {
   1.218 +    iFSysNameHash = 0;
   1.219 +    iParamsSet = EFalse;
   1.220 +    Mem::FillZ(iData, sizeof(iData));
   1.221 +    }
   1.222 +
   1.223 +/** 
   1.224 +    Calculates the file system name hash. For use in conjunction with this class only
   1.225 +    The file system name hash is a standard CRC32 on the up-cased name.
   1.226 +    
   1.227 +    @param  aFsName given name.
   1.228 +    @return CRC32 name hash value
   1.229 +
   1.230 +*/    
   1.231 +TUint32 TVolFormatParam::CalcFSNameHash(const TDesC& aFsName) 
   1.232 +    {
   1.233 +    TUint32 nameHash = 0;
   1.234 +        
   1.235 +    if(aFsName.Length() > 0)
   1.236 +        {
   1.237 +        TFullName fsName;
   1.238 +        fsName.Copy(aFsName);
   1.239 +        fsName.UpperCase();
   1.240 +        Mem::Crc32(nameHash, fsName.Ptr(), fsName.Length());
   1.241 +        }
   1.242 +
   1.243 +    return nameHash;
   1.244 +    }
   1.245 +
   1.246 +
   1.247 +/** sets the file system name hash corresponding to aFsName */
   1.248 +void TVolFormatParam::SetFileSystemName(const TDesC& aFsName)
   1.249 +    {
   1.250 +    iFSysNameHash = CalcFSNameHash(aFsName);
   1.251 +    }    
   1.252 +
   1.253 +/** @return file system name hash that was wet by SetFileSystemName() */
   1.254 +TUint32 TVolFormatParam::FSNameHash() const 
   1.255 +    {
   1.256 +    return iFSysNameHash;
   1.257 +    }
   1.258 +
   1.259 +/** @return ETrue if the user has set at least one parameter apart from the file sysetm name, i.e. SetVal() was called */
   1.260 +TBool TVolFormatParam::SomeParamsSet() const 
   1.261 +    {
   1.262 +    return iParamsSet;
   1.263 +    }
   1.264 +
   1.265 +/** 
   1.266 +    assign a data slot some integer value.
   1.267 +    @param  index of the slot 0..KMaxDataSlots-1
   1.268 +    @aVal   value to set
   1.269 +*/
   1.270 +void TVolFormatParam::SetVal(TUint aIndex, TUint32 aVal)
   1.271 +    {
   1.272 +    ASSERT(aIndex < KMaxDataSlots); 
   1.273 +    iData[aIndex] = aVal; 
   1.274 +    iParamsSet= ETrue;
   1.275 +    }
   1.276 +
   1.277 +/**
   1.278 +    @param  index of the slot 0..KMaxDataSlots-1
   1.279 +    @return data from the specified slot
   1.280 +*/
   1.281 +TUint32 TVolFormatParam::GetVal(TUint aIndex) const 
   1.282 +    {
   1.283 +    ASSERT(aIndex< KMaxDataSlots); 
   1.284 +    return iData[aIndex];
   1.285 +    }
   1.286 +
   1.287 +
   1.288 +
   1.289 +
   1.290 +
   1.291 +
   1.292 +