82 lines
1.3 KiB
C++
82 lines
1.3 KiB
C++
#ifndef _SAMPLE_DATACHUNK_HPP_
|
|
#define _SAMPLE_DATACHUNK_HPP_
|
|
#ifndef _COMMON_WINDOWS_HPP_
|
|
#include <common/windows.hpp>
|
|
#endif
|
|
#ifndef _COMMON_MEMFILE_HPP_
|
|
#include <common/memfile.hpp>
|
|
#endif
|
|
#ifndef _COMMON_OPENFILE_HPP_
|
|
#include <common/openfile.hpp>
|
|
#endif
|
|
#ifndef _SAMPLE_CHUNKID_HPP_
|
|
#include <sample/chunkid.hpp>
|
|
#endif
|
|
|
|
class DataChunk
|
|
{
|
|
public:
|
|
DataChunk(void);
|
|
virtual ~DataChunk();
|
|
bool write(MemFile &memFile)const;
|
|
bool read(FileHandle &handle);
|
|
LONG length(void)const;
|
|
void length(LONG length);
|
|
DWORD size(void)const;
|
|
String toString(void)const;
|
|
private:
|
|
void initChunk(void);
|
|
|
|
ChunkID mChunkID;
|
|
LONG mLengthData;
|
|
};
|
|
|
|
inline
|
|
DataChunk::DataChunk(void)
|
|
{
|
|
initChunk();
|
|
}
|
|
|
|
inline
|
|
DataChunk::~DataChunk()
|
|
{
|
|
}
|
|
|
|
inline
|
|
LONG DataChunk::length(void)const
|
|
{
|
|
return mLengthData;
|
|
}
|
|
|
|
inline
|
|
void DataChunk::length(LONG length)
|
|
{
|
|
mLengthData=length;
|
|
}
|
|
|
|
inline
|
|
DWORD DataChunk::size(void)const
|
|
{
|
|
return mChunkID.size()+sizeof(DWORD);
|
|
}
|
|
|
|
inline
|
|
void DataChunk::initChunk(void)
|
|
{
|
|
mChunkID=String("data");
|
|
return;
|
|
}
|
|
|
|
inline
|
|
String DataChunk::toString(void)const
|
|
{
|
|
String strDataChunk;
|
|
strDataChunk+=String("<DATACHUNK>");
|
|
strDataChunk+=mChunkID.toString();
|
|
strDataChunk+=String(" LengthData=")+String().fromInt(mLengthData).quotes();
|
|
strDataChunk+=String("<DATACHUNK/>");
|
|
return strDataChunk;
|
|
}
|
|
#endif
|
|
|