epoc32/include/f32file.inl
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
equal deleted inserted replaced
3:e1b950c65cb4 4:837f303aceeb
     1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // 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
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 //
     7 //
     8 // Initial Contributors:
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
     9 // Nokia Corporation - initial contribution.
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
    74 @see TUidType::MostDerived
    74 @see TUidType::MostDerived
    75 @see TUidType
    75 @see TUidType
    76 */
    76 */
    77     {return(iType.MostDerived());}
    77     {return(iType.MostDerived());}
    78 
    78 
    79 
    79 /**
    80 
    80 Sets 64 bit file size.
    81 
    81 
    82 //	Returns the entire size of the TEntry...
    82 The low word is stored in iSize and high word is stored in private data member iSizeHigh.
    83 inline TInt EntrySize(const TEntry& anEntry)
    83 This is intended to be used by File Systsem Plugin implementations, and not recommended
    84 	{return(sizeof(TUint)+sizeof(TInt)+sizeof(TTime)+sizeof(TInt)+sizeof(TUidType)+anEntry.iName.Size());}
    84 to be called by general clients of the File Server.
    85 
    85 
    86 
    86 @publishedAll
    87 
    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 	}
    88 
    97 
    89 // Class TFindFile
    98 // Class TFindFile
    90 inline const TDesC& TFindFile::File() const
    99 inline const TDesC& TFindFile::File() const
    91 /**
   100 /**
    92 Gets the full file specification of a file which was found by a successful 
   101 Gets the full file specification of a file which was found by a successful 
   129 */
   138 */
   130 	{
   139 	{
   131 	const TUint matchedFlags= aMask & KDriveAttMatchedFlags;  //KDriveAttMatchedFlags = 0xFFF
   140 	const TUint matchedFlags= aMask & KDriveAttMatchedFlags;  //KDriveAttMatchedFlags = 0xFFF
   132 	const TUint matchedAtt = aMask & KDriveAttMatchedAtt;	 //KDriveAttMatchedAtt = 0x0FFF0000
   141 	const TUint matchedAtt = aMask & KDriveAttMatchedAtt;	 //KDriveAttMatchedAtt = 0x0FFF0000
   133 	
   142 	
   134 
       
   135 	switch(matchedAtt)
   143 	switch(matchedAtt)
   136 		{
   144 		{
   137 
       
   138 		case KDriveAttExclude:
   145 		case KDriveAttExclude:
   139 			return matchedFlags==0?KErrArgument:KErrNone;
   146 			return matchedFlags==0?KErrArgument:KErrNone;
   140 			
       
   141 
       
   142 		case KDriveAttExclusive :
   147 		case KDriveAttExclusive :
   143 			return matchedFlags==0?KErrArgument:KErrNone;
   148 			return matchedFlags==0?KErrArgument:KErrNone;
   144 			
       
   145 
       
   146 		case KDriveAttExclude | KDriveAttExclusive:
   149 		case KDriveAttExclude | KDriveAttExclusive:
   147 			return matchedFlags==0?KErrArgument:KErrNone;
   150 			return matchedFlags==0?KErrArgument:KErrNone;
   148 			
       
   149 
       
   150 		case KDriveAttAll:
   151 		case KDriveAttAll:
   151 			return matchedFlags==0?KErrNone:KErrArgument;
   152 			return matchedFlags==0?KErrNone:KErrArgument;
   152 							
       
   153 		case 0:
   153 		case 0:
   154 			return KErrNone;
   154 			return KErrNone;
   155 			
       
   156 		default:
   155 		default:
   157 			return KErrArgument;			
   156 			return KErrArgument;										
   158 							
       
   159 		}
   157 		}
   160 			
       
   161 				
       
   162 	}	
   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