ADTF
indexedfilehelper.h
Go to the documentation of this file.
1 
7 #ifndef _INDEXEDFILE_HELPER_CLASS_HEADER_
8 #define _INDEXEDFILE_HELPER_CLASS_HEADER_
9 
10 namespace A_UTILS_NS
11 {
12 
13 //*************************************************************************************************
21 class DOEXPORT cIndexedFileHelper
22 {
23  public:
29  typedef enum
30  {
31  FM_None = 0x00,
32  FM_Description = 0x01,
33  FM_DateTime = 0x02
34  } tFieldMask;
35 
36  public:
43  static tResult GetHeader(const cString& strFilename,
44  IIndexedFile::tFileHeader* psFileHeader);
45 
55  static tResult UpdateHeader(const cString& strFilename,
56  const IIndexedFile::tFileHeader* psFileHeader,
57  tUInt32 ui32Mask);
58 
65  static tResult QueryFileInfo(const cString& strFilename,
66  cString& strFileInfo);
67 
76  static tResult QueryFileInfo(const cString& strFilename,
77  cString& strFileInfo,
78  cStringList& lstExtensions);
79 
86  static tResult CreateChecksumFile(const cFilename& strFilename, cString& strError);
87 
96  static tResult CheckFile(const cFilename& strFilename, cString& strError, const cFilename& strMD5File = "");
97 
109  static tResult ExtractAndCheckDatIfNecessary(const cFilename& strFilename, cFilename& strTmpFilename, cString& strError);
110 
122  static tResult GetExtension(const cString& strFilename,
123  const cString& strExtension,
124  IIndexedFile::tFileExtension* psExtensionInfo,
125  tVoid** ppData);
126 
137  static tResult WriteExtension(const cString& strFilename,
138  IIndexedFile::tFileExtension* psExtensionInfo,
139  const tVoid* pData);
140 
147  static tResult IsADTFDatfile(const cFilename& strFilename);
148 
155  static tResult Stream2FileHeader(IIndexedFile::tFileHeader* psFileHeader);
156 
165  static tResult Stream2FileHeaderExtension(const IIndexedFile::tFileHeader* psFileHeader, IIndexedFile::tFileExtension* pHeaderExt, tInt nNumExtensions);
166 
174  static tResult Stream2ChunkHeader(const IIndexedFile::tFileHeader* psFileHeader, IIndexedFile::tChunkHeader* psChunk);
175 
183  static tResult Stream2ChunkRef(const IIndexedFile::tFileHeader* psFileHeader, IIndexedFile::tChunkRef* psChunkRef);
184 
192  static tResult Stream2StreamRef(const IIndexedFile::tFileHeader* psFileHeader, IIndexedFile::tStreamRef* psStreamRef);
193 
201  static tResult Stream2StreamInfoHeader(const IIndexedFile::tFileHeader* psFileHeader, IIndexedFile::tStreamInfoHeader* psStreamInfo);
202 
203 
211  static tResult Stream2AdditonalIndexInfo(const IIndexedFile::tFileHeader* psFileHeader, IIndexedFile::tAdditionalIndexInfo* psAdditonalIndexInfo);
212 };
213 
214 } // namespace
215 
216 //*************************************************************************************************
217 #endif // _INDEXEDFILE_HELPER_CLASS_HEADER_
void tVoid
The tVoid is always the definition for the void (non-type).
int tInt
type definition for signed integer value (platform and compiler dependent type).
uint32_t tUInt32
type definition for unsigned integer values (32bit) (platform and compiler independent type).
File name class.
Definition: filename.h:59
Helper class to access file information.
static tResult WriteExtension(const cString &strFilename, IIndexedFile::tFileExtension *psExtensionInfo, const tVoid *pData)
Write an extension If the extension already exists, it will be overwritten.
static tResult Stream2AdditonalIndexInfo(const IIndexedFile::tFileHeader *psFileHeader, IIndexedFile::tAdditionalIndexInfo *psAdditonalIndexInfo)
Convert a additional stream info structure to native byte order.
static tResult UpdateHeader(const cString &strFilename, const IIndexedFile::tFileHeader *psFileHeader, tUInt32 ui32Mask)
Update header info.
static tResult Stream2ChunkRef(const IIndexedFile::tFileHeader *psFileHeader, IIndexedFile::tChunkRef *psChunkRef)
Convert a chunk reference structure to native byte order.
static tResult CheckFile(const cFilename &strFilename, cString &strError, const cFilename &strMD5File="")
Checks if a DAT file has been corrupted.
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 p...
static tResult Stream2ChunkHeader(const IIndexedFile::tFileHeader *psFileHeader, IIndexedFile::tChunkHeader *psChunk)
Convert a chunk header structure to native byte order.
static tResult IsADTFDatfile(const cFilename &strFilename)
Check if a particular file is a DAT file.
static tResult Stream2StreamRef(const IIndexedFile::tFileHeader *psFileHeader, IIndexedFile::tStreamRef *psStreamRef)
Convert a stream reference structure to native byte order.
static tResult Stream2FileHeaderExtension(const IIndexedFile::tFileHeader *psFileHeader, IIndexedFile::tFileExtension *pHeaderExt, tInt nNumExtensions)
Convert a file header extension structure to native byte order.
static tResult QueryFileInfo(const cString &strFilename, cString &strFileInfo)
Returns the date and the description of a file in a string.
static tResult Stream2StreamInfoHeader(const IIndexedFile::tFileHeader *psFileHeader, IIndexedFile::tStreamInfoHeader *psStreamInfo)
Convert a stream info header structure to native byte order.
static tResult GetExtension(const cString &strFilename, const cString &strExtension, IIndexedFile::tFileExtension *psExtensionInfo, tVoid **ppData)
Return the requested file extension.
static tResult QueryFileInfo(const cString &strFilename, cString &strFileInfo, cStringList &lstExtensions)
Returns the date and the description of a file in a string.
static tResult GetHeader(const cString &strFilename, IIndexedFile::tFileHeader *psFileHeader)
Returns the header of a file.
static tResult Stream2FileHeader(IIndexedFile::tFileHeader *psFileHeader)
Convert a file header structure to native byte order.
static tResult CreateChecksumFile(const cFilename &strFilename, cString &strError)
Creates an MD5 Checksum file for the given DAT file.
ADTF A_UTIL Namespace - Within adtf this is used as adtf::util or adtf_util.
Definition: d_ptr.h:11