ADTF  v2.14.3
cIndexedFileHelper Class Reference

Helper class to access file information. More...

Public Types

enum  tFieldMask { FM_None = 0x00, FM_Description = 0x01, FM_DateTime = 0x02 }
 Mask which fields of the file header should be updated, see cIndexedFileHelper::UpdateHeader .
 

Static Public Member Functions

static tResult GetHeader (const cString &strFilename, IIndexedFile::tFileHeader *psFileHeader)
 Returns the header of a file. More...
 
static tResult UpdateHeader (const cString &strFilename, const IIndexedFile::tFileHeader *psFileHeader, tUInt32 ui32Mask)
 Update header info. More...
 
static tResult QueryFileInfo (const cString &strFilename, cString &strFileInfo)
 Returns the date and the description of a file in a string. More...
 
static tResult QueryFileInfo (const cString &strFilename, cString &strFileInfo, cStringList &lstExtensions)
 Returns the date and the description of a file in a string. More...
 
static tResult CreateChecksumFile (const cFilename &strFilename, cString &strError)
 Creates an MD5 Checksum file for the given DAT file. More...
 
static tResult CheckFile (const cFilename &strFilename, cString &strError, const cFilename &strMD5File="")
 Checks if a DAT file has been corrupted. More...
 
static tResult ExtractAndCheckDatIfNecessary (const cFilename &strFilename, cFilename &strTmpFilename, cString &strError)
 Checks if strFilename is a compressed dat file, extracts it to a temporary location and returns the path to the temporary file in strTmpFilename. More...
 
static tResult GetExtension (const cString &strFilename, const cString &strExtension, IIndexedFile::tFileExtension *psExtensionInfo, tVoid **ppData)
 Return the requested file extension. More...
 
static tResult WriteExtension (const cString &strFilename, IIndexedFile::tFileExtension *psExtensionInfo, const tVoid *pData)
 Write an extension If the extension already exists, it will be overwritten. More...
 
static tResult IsADTFDatfile (const cFilename &strFilename)
 Check if a particular file is a DAT file. More...
 
static tResult Stream2FileHeader (IIndexedFile::tFileHeader *psFileHeader)
 Convert a file header structure to native byte order. More...
 
static tResult Stream2FileHeaderExtension (const IIndexedFile::tFileHeader *psFileHeader, IIndexedFile::tFileExtension *pHeaderExt, tInt nNumExtensions)
 Convert a file header extension structure to native byte order. More...
 
static tResult Stream2ChunkHeader (const IIndexedFile::tFileHeader *psFileHeader, IIndexedFile::tChunkHeader *psChunk)
 Convert a chunk header structure to native byte order. More...
 
static tResult Stream2ChunkRef (const IIndexedFile::tFileHeader *psFileHeader, IIndexedFile::tChunkRef *psChunkRef)
 Convert a chunk reference structure to native byte order. More...
 
static tResult Stream2StreamRef (const IIndexedFile::tFileHeader *psFileHeader, IIndexedFile::tStreamRef *psStreamRef)
 Convert a stream reference structure to native byte order. More...
 
static tResult Stream2StreamInfoHeader (const IIndexedFile::tFileHeader *psFileHeader, IIndexedFile::tStreamInfoHeader *psStreamInfo)
 Convert a stream info header structure to native byte order. More...
 
static tResult Stream2AdditonalIndexInfo (const IIndexedFile::tFileHeader *psFileHeader, IIndexedFile::tAdditionalIndexInfo *psAdditonalIndexInfo)
 Convert a additional stream info structure to native byte order. More...
 

Detailed Description

Helper class to access file information.

Warning
Do not use this class for cross-platform processing of files!
Note
For cross-platform processing use cIndexedFileReader and cIndexedFileWriter .

Definition at line 29 of file indexedfilehelper.h.

Member Function Documentation

static tResult CheckFile ( const cFilename strFilename,
cString strError,
const cFilename strMD5File = "" 
)
static

Checks if a DAT file has been corrupted.

The check is only performed if an .md5sum file exists, otherwise ERROR_NOERROR is returned.

Parameters
strFilename[in] The name of the DAT file.
strError[out] In case of failure a this will contain a description of the error that occured.
strMD5File[in] Optional filename of an mdsum file.
Returns
Standard result.
static tResult CreateChecksumFile ( const cFilename strFilename,
cString strError 
)
static

Creates an MD5 Checksum file for the given DAT file.

Parameters
strFilename[in] The name of the DAT file.
strError[out] In case of failure a this will contain a description of the error that occured.
Returns
Standard result.
static tResult ExtractAndCheckDatIfNecessary ( const cFilename strFilename,
cFilename strTmpFilename,
cString strError 
)
static

Checks if strFilename is a compressed dat file, extracts it to a temporary location and returns the path to the temporary file in strTmpFilename.

This method caches its earlier results so that the file won't be extracted and checked twice.

If the strFilename is an uncompressed file, the string is passed back unmodified.

Parameters
[in]strFilenameThe input file name.
[out]strTmpFilenameThe name of the temporary file or the strFilename.
[out]strErrorError String if failed.
Returns
Standard result.
static tResult GetExtension ( const cString strFilename,
const cString strExtension,
IIndexedFile::tFileExtension *  psExtensionInfo,
tVoid **  ppData 
)
static

Return the requested file extension.

You have to release the memory for the return value ppData with delete [] ppData;

Parameters
strFilename[in] The input file name.
strExtension[in] The requested file extension.
psExtensionInfo[out] This will be filled with the file extension information.
ppData[out] This will be filled with the file extension data.
Returns
Standard result.
static tResult GetHeader ( const cString strFilename,
IIndexedFile::tFileHeader *  psFileHeader 
)
static

Returns the header of a file.

Parameters
strFilename[in] The filename
psFileHeader[out] This will be filled with the information.
Returns
Standard result.
static tResult IsADTFDatfile ( const cFilename strFilename)
static

Check if a particular file is a DAT file.

Parameters
strFilename[in] Name of the file to check.
Returns
Standard result.
static tResult QueryFileInfo ( const cString strFilename,
cString strFileInfo 
)
static

Returns the date and the description of a file in a string.

Parameters
strFilename[in] The filename.
strFileInfo[out] The info string.
Returns
Standard result.
static tResult QueryFileInfo ( const cString strFilename,
cString strFileInfo,
cStringList lstExtensions 
)
static

Returns the date and the description of a file in a string.

It will also check if the given extension exits.

Parameters
strFilename[in] The filename.
strFileInfo[out] The info string.
lstExtensions[inout] the list of extensions.
Returns
Standard result.
static tResult Stream2AdditonalIndexInfo ( const IIndexedFile::tFileHeader *  psFileHeader,
IIndexedFile::tAdditionalIndexInfo *  psAdditonalIndexInfo 
)
static

Convert a additional stream info structure to native byte order.

Parameters
[in]psFileHeaderThe header
[in]psAdditonalIndexInfoThe additional index info.
Returns
Standard result.
This method is real-time safe.
See The ADTF Real-Time Extension.
static tResult Stream2ChunkHeader ( const IIndexedFile::tFileHeader *  psFileHeader,
IIndexedFile::tChunkHeader *  psChunk 
)
static

Convert a chunk header structure to native byte order.

Parameters
[in]psFileHeaderThe header
[in]psChunkThe chunk header.
Returns
Standard result.
This method is real-time safe.
See The ADTF Real-Time Extension.
static tResult Stream2ChunkRef ( const IIndexedFile::tFileHeader *  psFileHeader,
IIndexedFile::tChunkRef *  psChunkRef 
)
static

Convert a chunk reference structure to native byte order.

Parameters
[in]psFileHeaderThe header
[in]psChunkRefThe chunk reference
Returns
Standard result.
This method is real-time safe.
See The ADTF Real-Time Extension.
static tResult Stream2FileHeader ( IIndexedFile::tFileHeader *  psFileHeader)
static

Convert a file header structure to native byte order.

Parameters
[in]psFileHeaderThe header
Returns
Standard result.
This method is real-time safe.
See The ADTF Real-Time Extension.
static tResult Stream2FileHeaderExtension ( const IIndexedFile::tFileHeader *  psFileHeader,
IIndexedFile::tFileExtension *  pHeaderExt,
tInt  nNumExtensions 
)
static

Convert a file header extension structure to native byte order.

Parameters
[in]psFileHeaderThe header
[in]pHeaderExtThe header extension.
[in]nNumExtensionsThe number of Extensions.
Returns
Standard result.
This method is real-time safe.
See The ADTF Real-Time Extension.
static tResult Stream2StreamInfoHeader ( const IIndexedFile::tFileHeader *  psFileHeader,
IIndexedFile::tStreamInfoHeader *  psStreamInfo 
)
static

Convert a stream info header structure to native byte order.

Parameters
[in]psFileHeaderThe header
[in]psStreamInfoThe stream info.
Returns
Standard result.
This method is real-time safe.
See The ADTF Real-Time Extension.
static tResult Stream2StreamRef ( const IIndexedFile::tFileHeader *  psFileHeader,
IIndexedFile::tStreamRef *  psStreamRef 
)
static

Convert a stream reference structure to native byte order.

Parameters
[in]psFileHeaderThe header
[in]psStreamRefThe stream reference
Returns
Standard result.
This method is real-time safe.
See The ADTF Real-Time Extension.
static tResult UpdateHeader ( const cString strFilename,
const IIndexedFile::tFileHeader *  psFileHeader,
tUInt32  ui32Mask 
)
static

Update header info.

Parameters
strFilename[in] The filename.
psFileHeader[in] The new header info.
ui32Mask[in] Which fields to update, see cIndexedFileHelper::tFieldMask .
Returns
Standard result.
static tResult WriteExtension ( const cString strFilename,
IIndexedFile::tFileExtension *  psExtensionInfo,
const tVoid pData 
)
static

Write an extension If the extension already exists, it will be overwritten.

Warning
The extension 'GUID' is protected and could not be overwritten
Parameters
strFilename[in] The input file name.
psExtensionInfo[in] This will be filled with the file extension information.
pData[in] This will be filled with the file extension data.
Returns
Standard result.

Copyright © Audi Electronics Venture GmbH. All rights reserved. (Generated on Fri Mar 22 2019 by doxygen 1.8.10)