userlibandfileserver/fileserver/sfat32/fat_dir_entry.inl
branchRCL_3
changeset 22 2f92ad2dc5db
parent 19 4a8fed1c0ef6
equal deleted inserted replaced
21:e7d2d738d3c2 22:2f92ad2dc5db
    51 inline const TPtrC8 TFatDirEntry::Name() const
    51 inline const TPtrC8 TFatDirEntry::Name() const
    52     {return TPtrC8((TUint8*)&(pDir->iName),KFatDirNameSize);}
    52     {return TPtrC8((TUint8*)&(pDir->iName),KFatDirNameSize);}
    53 /**
    53 /**
    54 @return The attributes for the Directory entry
    54 @return The attributes for the Directory entry
    55 */
    55 */
    56 inline TInt TFatDirEntry::Attributes() const
    56 inline TUint TFatDirEntry::Attributes() const
    57     {return pDir->iAttributes;}
    57     {return pDir->iAttributes;}
    58 /**
    58 /**
    59 @param aOffset This offset will be subtracted from the returned time.
    59 @param aOffset This offset will be subtracted from the returned time.
    60 @return Time of file modification
    60 @return Time of file modification
    61 */
    61 */
    65     return time-=aOffset;
    65     return time-=aOffset;
    66     }
    66     }
    67 /**
    67 /**
    68 @return The Start cluster for the file or directory for this entry 
    68 @return The Start cluster for the file or directory for this entry 
    69 */
    69 */
    70 inline TInt TFatDirEntry::StartCluster() const      
    70 inline TUint32 TFatDirEntry::StartCluster() const      
    71     {
    71     {
    72     const TUint16 KStClustMaskHi = 0x0FFF;  
    72     const TUint16 KStClustMaskHi = 0x0FFF;  
    73     return ((pDir->iStartClusterHi & KStClustMaskHi) << 16) | pDir->iStartClusterLo;
    73     return ((pDir->iStartClusterHi & KStClustMaskHi) << 16) | pDir->iStartClusterLo;
    74     }
    74     }
    75 
    75 
   115 /**
   115 /**
   116 Set the file or directory attributes for this entry
   116 Set the file or directory attributes for this entry
   117 
   117 
   118 @param anAtts The file or directory attributes
   118 @param anAtts The file or directory attributes
   119 */
   119 */
   120 inline void TFatDirEntry::SetAttributes(TInt anAtts)
   120 inline void TFatDirEntry::SetAttributes(TUint anAtts)
   121     {
   121     {
   122     __ASSERT_DEBUG(!(anAtts&~KMaxTUint8),Fault(EFatBadDirEntryParameter));
   122     __ASSERT_DEBUG(!(anAtts&~KMaxTUint8),Fault(EFatBadDirEntryParameter));
   123     pDir->iAttributes=(TUint8)anAtts;
   123     pDir->iAttributes=(TUint8)anAtts;
   124     }
   124     }
   125 /**
   125 /**
   145 /**
   145 /**
   146 Set the start cluster number of the file or directory refered to by the entry
   146 Set the start cluster number of the file or directory refered to by the entry
   147 
   147 
   148 @param aStartCluster The start cluster number
   148 @param aStartCluster The start cluster number
   149 */
   149 */
   150 inline void TFatDirEntry::SetStartCluster(TInt aStartCluster)
   150 inline void TFatDirEntry::SetStartCluster(TUint32 aStartCluster)
   151     {
   151     {
   152     pDir->iStartClusterLo=(TUint16)(aStartCluster);
   152     pDir->iStartClusterLo=(TUint16)(aStartCluster);
   153     pDir->iStartClusterHi=(TUint16)(aStartCluster >> 16);
   153     pDir->iStartClusterHi=(TUint16)(aStartCluster >> 16);
   154     }
   154     }
   155 /**
   155 /**
   190 
   190 
   191 /**
   191 /**
   192     Get VFAT entry ID. Uset by Rugged FAT and Scan Drive to fix broken entries
   192     Get VFAT entry ID. Uset by Rugged FAT and Scan Drive to fix broken entries
   193     Uses 1 byte from "Last Access Date" field, offset 19. Hack.
   193     Uses 1 byte from "Last Access Date" field, offset 19. Hack.
   194 */
   194 */
   195 TUint TFatDirEntry::RuggedFatEntryId() const
   195 TUint16 TFatDirEntry::RuggedFatEntryId() const
   196     {
   196     {
   197     return pDir->iReserved2;
   197     return pDir->iReserved2;
   198     }
   198     }
   199 
   199 
   200 /**
   200 /**
   241     return (iData[0]==0xFF);
   241     return (iData[0]==0xFF);
   242     }
   242     }
   243 
   243 
   244 
   244 
   245 
   245 
       
   246 //-----------------------------------------------------------------------------
       
   247 /**
       
   248     Checks if the entry has the same "modification time" as given (with 2 seconds granularity precision, see FAT specs). 
       
   249     
       
   250     @param  aTime   time to check
       
   251     @param  aOffset time offset
       
   252 
       
   253     @return ETrue if the given time+offset is the same (with 2 second granularity) as the one set in the entry.
       
   254 */
       
   255 inline TBool TFatDirEntry::IsTimeTheSame(TTime aTime, TTimeIntervalSeconds aOffset) const
       
   256     {
       
   257     aTime+=aOffset;
       
   258 
       
   259     const TUint16 time = (TUint16)DosTimeFromTTime(aTime);
       
   260     if(time != pDir->iTime)
       
   261         return EFalse;
       
   262 
       
   263     const TUint16 date = (TUint16)DosDateFromTTime(aTime);
       
   264     return (date == pDir->iDate);
       
   265     }
       
   266 
       
   267 
   246 #endif //FAT_DIR_ENTRY_INL
   268 #endif //FAT_DIR_ENTRY_INL
   247 
   269 
   248 
   270 
   249 
   271 
   250 
   272