epoc32/include/f32file.inl
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
     1.1 --- a/epoc32/include/f32file.inl	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ b/epoc32/include/f32file.inl	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -1,9 +1,9 @@
     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 "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     1.8 +// under the terms of the License "Eclipse Public License v1.0"
     1.9  // which accompanies this distribution, and is available
    1.10 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.11 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.12  //
    1.13  // Initial Contributors:
    1.14  // Nokia Corporation - initial contribution.
    1.15 @@ -76,15 +76,24 @@
    1.16  */
    1.17      {return(iType.MostDerived());}
    1.18  
    1.19 +/**
    1.20 +Sets 64 bit file size.
    1.21  
    1.22 +The low word is stored in iSize and high word is stored in private data member iSizeHigh.
    1.23 +This is intended to be used by File Systsem Plugin implementations, and not recommended
    1.24 +to be called by general clients of the File Server.
    1.25  
    1.26 +@publishedAll
    1.27 +@prototype
    1.28  
    1.29 -//	Returns the entire size of the TEntry...
    1.30 -inline TInt EntrySize(const TEntry& anEntry)
    1.31 -	{return(sizeof(TUint)+sizeof(TInt)+sizeof(TTime)+sizeof(TInt)+sizeof(TUidType)+anEntry.iName.Size());}
    1.32 -
    1.33 -
    1.34 -
    1.35 +@see TEntry::iSize
    1.36 +*/
    1.37 +inline void TEntry::SetFileSize(TInt64 aFileSize)
    1.38 +	{
    1.39 +	iAtt &= ~KEntryAttPacked;
    1.40 +	iSizeHigh=I64HIGH(aFileSize); 
    1.41 +	iSize=I64LOW(aFileSize);
    1.42 +	}
    1.43  
    1.44  // Class TFindFile
    1.45  inline const TDesC& TFindFile::File() const
    1.46 @@ -131,32 +140,150 @@
    1.47  	const TUint matchedFlags= aMask & KDriveAttMatchedFlags;  //KDriveAttMatchedFlags = 0xFFF
    1.48  	const TUint matchedAtt = aMask & KDriveAttMatchedAtt;	 //KDriveAttMatchedAtt = 0x0FFF0000
    1.49  	
    1.50 -
    1.51  	switch(matchedAtt)
    1.52  		{
    1.53 -
    1.54  		case KDriveAttExclude:
    1.55  			return matchedFlags==0?KErrArgument:KErrNone;
    1.56 -			
    1.57 -
    1.58  		case KDriveAttExclusive :
    1.59  			return matchedFlags==0?KErrArgument:KErrNone;
    1.60 -			
    1.61 -
    1.62  		case KDriveAttExclude | KDriveAttExclusive:
    1.63  			return matchedFlags==0?KErrArgument:KErrNone;
    1.64 -			
    1.65 -
    1.66  		case KDriveAttAll:
    1.67  			return matchedFlags==0?KErrNone:KErrArgument;
    1.68 -							
    1.69  		case 0:
    1.70  			return KErrNone;
    1.71 -			
    1.72  		default:
    1.73 -			return KErrArgument;			
    1.74 -							
    1.75 +			return KErrArgument;										
    1.76  		}
    1.77 -			
    1.78 -				
    1.79  	}	
    1.80 +
    1.81 +inline RFs::TNameValidParam::TNameValidParam(TBool aUseSessionPath)
    1.82 +	{
    1.83 +  	iError = ErrNone;
    1.84 +  	iUseSessionPath = aUseSessionPath;
    1.85 +  	iInvalidCharPos = 0;
    1.86 +  	}
    1.87 +
    1.88 +
    1.89 +
    1.90 +inline RFs::TNameValidParam::TError RFs::TNameValidParam::ErrorCode()const
    1.91 +
    1.92 +/**
    1.93 +returns the error code.
    1.94 +@see TError 
    1.95 +*/ 
    1.96 +	{
    1.97 +	return iError;
    1.98 +	}
    1.99 +
   1.100 +/**
   1.101 +Allows the user to set, whether he wants to use the session path for filling
   1.102 +up missing parts of the name that he passes to RFs::IsValidName(TDesC& aName, TNameValidParam& aParam).
   1.103 +If aUseSessionPath is EFalse, then the sessionpath is not used to validate aName.
   1.104 +*/
   1.105 +inline void RFs::TNameValidParam::UseSessionPath(TBool aUseSessionPath)
   1.106 +	{
   1.107 +	iUseSessionPath = aUseSessionPath;
   1.108 +	}
   1.109 +
   1.110 +/**
   1.111 +if the error code returned by TNameValidParam::ErrorCode() is TError::ErrBadCharacter,
   1.112 +then this returns the position of the rightmost invalid character.
   1.113 +For eg: "a>bcd>" would have the iInvalidCharPos=6 and not 2.
   1.114 +However preference is given to wild characters whil reporting the invalid character position
   1.115 +For eg: "a*bcd>" would return the iInvalidCharPos= 2 and not 6. 
   1.116 +if any other error code is returned then this value is 0.
   1.117 +*/
   1.118 +inline TUint RFs::TNameValidParam::InvalidCharPos()const
   1.119 +	{
   1.120 +	return iInvalidCharPos;
   1.121 +	}
   1.122 +	
   1.123 +
   1.124 +
   1.125 +
   1.126 +//-------------------------------------------------------------------------------------------------------------------
   1.127 +TVolFormatParam::TVolFormatParam() 
   1.128 +                :iUId((TUint32)KUId), iFSysNameHash(0)
   1.129 +    {
   1.130 +    Init();
   1.131 +    }
   1.132 +
   1.133 +/** resets all data to the "not set" values */
   1.134 +void TVolFormatParam::Init()
   1.135 +    {
   1.136 +    iFSysNameHash = 0;
   1.137 +    iParamsSet = EFalse;
   1.138 +    Mem::FillZ(iData, sizeof(iData));
   1.139 +    }
   1.140 +
   1.141 +/** 
   1.142 +    Calculates the file system name hash. For use in conjunction with this class only
   1.143 +    The file system name hash is a standard CRC32 on the up-cased name.
   1.144 +    
   1.145 +    @param  aFsName given name.
   1.146 +    @return CRC32 name hash value
   1.147 +
   1.148 +*/    
   1.149 +TUint32 TVolFormatParam::CalcFSNameHash(const TDesC& aFsName) 
   1.150 +    {
   1.151 +    TUint32 nameHash = 0;
   1.152 +        
   1.153 +    if(aFsName.Length() > 0)
   1.154 +        {
   1.155 +        TFullName fsName;
   1.156 +        fsName.Copy(aFsName);
   1.157 +        fsName.UpperCase();
   1.158 +        Mem::Crc32(nameHash, fsName.Ptr(), fsName.Length());
   1.159 +        }
   1.160 +
   1.161 +    return nameHash;
   1.162 +    }
   1.163 +
   1.164 +
   1.165 +/** sets the file system name hash corresponding to aFsName */
   1.166 +void TVolFormatParam::SetFileSystemName(const TDesC& aFsName)
   1.167 +    {
   1.168 +    iFSysNameHash = CalcFSNameHash(aFsName);
   1.169 +    }    
   1.170 +
   1.171 +/** @return file system name hash that was wet by SetFileSystemName() */
   1.172 +TUint32 TVolFormatParam::FSNameHash() const 
   1.173 +    {
   1.174 +    return iFSysNameHash;
   1.175 +    }
   1.176 +
   1.177 +/** @return ETrue if the user has set at least one parameter apart from the file sysetm name, i.e. SetVal() was called */
   1.178 +TBool TVolFormatParam::SomeParamsSet() const 
   1.179 +    {
   1.180 +    return iParamsSet;
   1.181 +    }
   1.182 +
   1.183 +/** 
   1.184 +    assign a data slot some integer value.
   1.185 +    @param  index of the slot 0..KMaxDataSlots-1
   1.186 +    @aVal   value to set
   1.187 +*/
   1.188 +void TVolFormatParam::SetVal(TUint aIndex, TUint32 aVal)
   1.189 +    {
   1.190 +    ASSERT(aIndex < KMaxDataSlots); 
   1.191 +    iData[aIndex] = aVal; 
   1.192 +    iParamsSet= ETrue;
   1.193 +    }
   1.194 +
   1.195 +/**
   1.196 +    @param  index of the slot 0..KMaxDataSlots-1
   1.197 +    @return data from the specified slot
   1.198 +*/
   1.199 +TUint32 TVolFormatParam::GetVal(TUint aIndex) const 
   1.200 +    {
   1.201 +    ASSERT(aIndex< KMaxDataSlots); 
   1.202 +    return iData[aIndex];
   1.203 +    }
   1.204 +
   1.205 +
   1.206 +
   1.207 +
   1.208 +
   1.209 +
   1.210 +