14#if defined(OWL5_COMPAT)
18#if defined(__BORLANDC__)
161 return ::GetLastError();
218 return *
reinterpret_cast<uint64*
>(&
ul);
237 if(
ret != 0xFFFFFFFF)
247 if(
ret != 0xFFFFFFFF)
264 if(
ret != 0xFFFFFFFF)
523static int binCVTDoubleMBF (
uint8*,
uint8*,
int,
int,
int)
581static int binCVTDoubleLBF (
uint8*,
uint8*,
int,
int,
int)
644#define BINCHECKRTYPE(type) \
645 if ( (type) <= 0 || (type) > varLastMember) \
648#define BINCHECKWTYPE(type) \
649 if ((type) <= 0 || (type) > varLastMember) \
652#define BINCHECKNBYTES(nBytes) \
661 count +=
bfp->Count*
bfp->Bytes;
867static TBinField ShortField[] = {
871static TBinField LongField[] = {
875static TBinField FloatField[] = {
879static TBinField DoubleField[] = {
883static TBinField Long64Field[] = {
887static TBinField PointField[] = {
891static TBinField RectField[] = {
895static TBinField* FieldTypes[] = {
919#if defined(OWL5_COMPAT)
933bool TFile::SetStatus(
LPCTSTR name,
const TFileStatus & status)
935 return TFileName(
name).SetStatus(status);
941 int size =
static_cast<int>(
file.readUint32());
946 s[size+1] =
_T(
'\0');
1254 return static_cast<uint32>(
n);
1357 while(*Buff && *Buff !=
_T(
'\r') && *Buff !=
_T(
'\n') &&
length < size){
1388 if(*Buff ==
_T(
'\r')){
1392 if(*Buff ==
_T(
'\n')){
1410 struct TTextFileGetString
1428 return CopyText(size, TTextFileGetString(*
this));
1582#include <pshpack1.h>
1593static TBinField ChunkField[] = {
1599static TBinField ListField[] = {
1607static TBinField ChunkField1[] = {
1612static TBinField ListField1[] = {
1689 long size =
info.Offset +
info.Size;
1804#if !defined(qtstruct_h)
1805#include <pshpack1.h>
1855 bool status =
false;
1932 uMode |= ios::binary;
1934 uMode |= ios::in|ios::out;
1947 uMode |= ios::trunc;
1962 sys2StrmMode(
uMode, mode);
1974 return Parent->rdbuf()->is_open();
1986 if(
Parent->rdbuf()->close() ==
nullptr)
#define WARNX(group, condition, level, message)
#define PRECONDITION(condition)
#define DIAG_DEFINE_GROUP_INIT(f, g, e, l)
virtual uint32 Read(void *buffer, uint32 numBytes)
Reads numBytes from the file into buffer. The number of bytes read is returned.
virtual uint32 Length() const
Returns the file length plus the length of unwritten data in the buffer.
virtual ~TBufferedFile()
The buffer is flushed. If ShouldDelete is true the buffer is deleted.
virtual bool Write(const void *buffer, uint32 numBytes)
Writes numBytes of buffer to the file.
uint32 EndPos
Offset in file to the last data byte in the buffer.
virtual bool FlushBuffer()
Flushes the buffer by writing any unwritten data to the file.
uint8 * CurByte
Pointer to current position in the buffer.
virtual uint64 Length64() const
Returns the file length plus the length of unwritten data in the buffer.
virtual void InitBuffer(uint size=DefaultBufferSize)
Allocates a buffer of size bytes.
uint FileBufSize
Size of FileBuffer in bytes.
uint8 * FileBuffer
Buffer used to store data in.
bool BufferEmpty
True if the buffer is empty; false otherwise.
uint32 StartPos
Offset in file to byte 0 of the buffer.
virtual uint64 Seek(int64 offset, TSeekDir origin=beg)
Repositions the file pointer to offset bytes from the specified origin.
virtual uint32 Position() const
Returns the current position of the file pointer.
uint32 CurPos
Offset in file to current position.
bool ShouldDelete
True if the buffer should be deleted.
virtual void SetBuffer(uint8 *buffer, uint size, bool shouldDelete=true)
Flushes the current buffer and then deletes it if ShouldDelete is true.
TDiskFileHandle * Clone() const
virtual bool UnlockRange(uint32 position, uint32 count)
virtual uint64 Seek(int64 offset, TFile::TSeekDir origin=TFile::beg)
virtual bool Write(const void *buffer, uint32 numBytes)
virtual uint64 Position64() const
virtual bool LockRange(uint32 position, uint32 count)
virtual bool GetStatus(TFileStatus &status) const
TDiskFileHandle(const tstring &fileName, uint32 mode)
virtual uint32 Read(void *buffer, uint32 numBytes)
virtual uint32 LastError()
virtual uint64 Length64() const
virtual uint32 Length() const
virtual uint32 Position() const
virtual bool LockRange(uint32 position, uint32 count)=0
virtual bool UnlockRange(uint32 position, uint32 count)=0
The TFile class encapsulates standard file characteristics and operations.
virtual bool Open(const tstring &fileName, const uint32 mode=ReadOnly|PermRead|OpenExisting)
Opens file name with the given mode.
bool IsOpen() const
Returns true if the file is open, false otherwise.
virtual uint64 readUint64()
uint BufSize
Size of Buffer used with structure read/write.
virtual uint64 Seek(int64 offset, TSeekDir origin=beg)
Repositions the file pointer to offset bytes from the specified origin.
bool ShouldClose
Should C++ object close file on dtor.
@ Text
type Text are used in derived classes only default type is Binary
@ PermWrite
Subsequent open operations on the object will succeed only if write access is requested.
@ CreateNew
Creates a new file. The function fails if the specified file already exists.
@ TruncateExist
Opens the file.
@ OpenExisting
Opens the file. The function fails if the file does not exist.
@ PermRead
Subsequent open operations on the object will succeed only if read access is requested.
@ CreateAlways
Creates a new file. The function overwrites the file if it exists.
uint8 * Buffer
Buffer used with structure read/write.
virtual bool Flush()
Performs any pending I/O functions. Returns true if successful; false otherwise.
virtual double readDouble()
virtual bool LockRange(uint32 position, uint32 count)
Locks count bytes, beginning at position of the file.
virtual void writeUint8(const uint8)
virtual uint32 Read(void *buffer, uint32 numBytes)
Reads numBytes from the file into buffer. The number of bytes read is returned.
uint WriteStruct(void *buffer, TBinType btype, TByteOrderType type)
Writes predefined structures to binary file.
virtual float readFloat()
virtual void writeFloat(const float)
virtual uint16 readUint16()
virtual uint32 readUint32()
TFileHandle * Handle
Low-level C file handle.
virtual bool Write(const void *buffer, uint32 numBytes)
Writes numbytes of buffer to the file.
virtual bool UnlockRange(uint32 position, uint32 count)
Unlocks the range at the given Position.
virtual void writeDouble(const double)
uint ReadStruct(void *buffer, TBinType btype, TByteOrderType type)
Read binary predefined structure from file.
virtual ~TFile()
If ShouldClose is true the file is closed.
uint32 GetOpenMode() const
Returns OpenMode.
static uint StructSize(TBinField *fields)
Returns the number of bytes in a binary data structure.
uint32 SeekToBegin()
Repositions the file pointer to the beginning of the file.
virtual uint8 readUint8()
TFile()
Creates a TFile object with a file handle of FileNull.
virtual void writeUint16(const uint16)
TBinType
Binary data type enumerations.
virtual void writeUint32(const uint32)
virtual TFileHandle * GetHandle() const
Returns Handle.
@ cur
Seek from the current position in the file.
@ end
Seek from the end of the file.
@ beg
Seek from the beginning of the file.
virtual bool Close()
Closes the file. Returns true if successful, false otherwise.
virtual void writeUint64(const uint64)
bool GetStatus(TFileStatus &status) const
Fills status with the current file status.
virtual bool NextLine()
Loads the next line in the file. Returns true if successful; false otherwise.
TFileLineIterator()
Protected default constructor. Intializes everything to 0.
virtual ~TFileLineIterator()
Deletes the buffer.
TCHAR * LineBuffer
Buffer lines of text are loaded into.
uint BuffSize
Size of the buffer allocated for loading a line of text.
TTextFile * File
Pointer to the file being iterated through.
The TFileName class constructs filenames.
int GetStatus(TFileStatus &status) const
Get the file status struct for the item associated with this filename.
TFileTime is a class derived from the structure FILETIME.
bool Descent(TQtInfo &info, TQtInfo *parent=0, const TFindFlags=TFindFlags(ffFindChunk|ffReset))
bool Ascent(TQtInfo &info)
bool CreateChunk(TQtInfo &info)
Writes a data structure of the specified type to the associated file.
bool Ascent(TCkInfo &info)
bool CreateChunk(TCkInfo &info, const TCreateFlags=cfCreateChunk)
Writes a data structure of the specified type to the associated file.
bool Descent(TCkInfo &info, TCkInfo *parent=0, const TFindFlags=ffFindAny)
virtual bool Open(const tstring &fileName, const uint32 mode=ReadOnly|PermRead|OpenExisting)
virtual uint32 LastError()
virtual bool Write(const void *buffer, uint32 numBytes)
virtual uint64 Seek(int64 offset, TFile::TSeekDir origin=TFile::beg)
virtual uint64 Position64() const
TStreamHandle(TStreamFile *parent, const tstring &filename, uint32 mode)
virtual bool LockRange(uint32 position, uint32 count)
virtual uint32 Length() const
virtual uint64 Length64() const
TStreamHandle * Clone() const
virtual uint32 Position() const
virtual bool GetStatus(TFileStatus &status) const
virtual bool UnlockRange(uint32 position, uint32 count)
virtual uint32 Read(void *buffer, uint32 numBytes)
The TTextFile class is derived from TBufferedFile and encapsulates standard file characteristics and ...
virtual double readDouble()
virtual uint32 readUint32()
virtual float readFloat()
virtual void writeUint64(const uint64)
virtual uint16 readUint16()
virtual uint64 readUint64()
virtual void writeUint8(const uint8)
virtual void writeUint32(const uint32)
virtual uint8 readUint8()
virtual void writeDouble(const double)
virtual TCHAR * GetString(TCHAR *buffer, uint32 size)
Reads up to size characters and places them in buffer.
virtual void writeFloat(const float)
virtual bool WriteString(LPCTSTR str)
Writes the NULL terminated character string in buffer to the file and adds a terminating \r\n charact...
virtual void writeUint16(const uint16)
The TTime class encapsulates time functions and characteristics.
TXOwl is root class of the ObjectWindows exception hierarchy.
#define BINCHECKRTYPE(type)
#define BINCHECKNBYTES(nBytes)
TByteOrderType
The byte order type.
#define FileNull
Represents a NULL file handle.
TByteOrderType EndianType()
@ boLittle_Endian
LSB at lowest address: Intel //.
@ boBig_Endian
MSB at lowest address: Motorola //.
Object Windows Library (OWLNext Core)
uint16 SwapUint16(uint16 u16)
void __MakeDosTime(const TTime &time, uint16 &fdate, uint16 &ftime)
uint __sys2Atr(uint32 attrib)
int binCVTCharLBF(uint8 *src, uint8 *dst, int, int size, int count)
tstring CopyText(int size, TGetText get_text)
Copies text from a C-string (null-terminated character array) into a string object,...
int(* cvtDispatchFunc)(uint8 *, uint8 *, int, int, int)
uint32 SwapUint32(uint32 u32)
TTime __MakeTTime(uint16 fdate, uint16 ftime)
owl::ipstream & operator>>(owl::ipstream &is, TColor &c)
Extract the color value from a persistent input stream.
int binCVTCharMBF(uint8 *src, uint8 *dst, int, int size, int count)
uint __attr2Sys(uint attrib)
#define COUNTOF(s)
Array element count Important: Only use this with an argument of array type.
The TBinField struct describes a group of like-typed fields in a structure to be read or written usin...
RIFF chunk information data structure.
uint32 Flags
flags used by MMIO functions
uint32 Offset
offset of data portion of chunk
tchar fullName[_MAX_PATH]
QuickTime atom information data structure.
Classes for window system structure and type encapsulation.