38#include "blocxx/BLOCXX_config.h"
49const UInt32 TEMPFILE_ENUMERATION_SIG = 0x4f57454e;
55 UInt32 enumSig = TEMPFILE_ENUMERATION_SIG;
56 m_Data.write(
reinterpret_cast<const char*
>(&enumSig),
sizeof(enumSig));
59 BLOCXX_THROW(EnumerationException,
"Failed to write signature to "
60 "enumeration tempfile.");
65 m_Data.read(
reinterpret_cast<char*
>(&tmpSig),
sizeof(tmpSig));
68 BLOCXX_THROW(EnumerationException,
"Failed to read signature from "
69 "enumeration tempfile.");
112 if (f.
read(
reinterpret_cast<char*
>(&fileSig),
sizeof(fileSig)) !=
sizeof(fileSig))
117 if (fileSig != TEMPFILE_ENUMERATION_SIG)
120 "enumeration from a file that does not have the correct "
124 off_t whence = f.
seek(-
static_cast<off_t
>(
sizeof(size)), SEEK_END);
129 if (f.
read(
reinterpret_cast<char*
>(&size),
sizeof(size), whence) !=
sizeof(size))
#define BLOCXX_THROW(exType, msg)
Throw an exception using FILE and LINE.
The purpose of the File class is to provide an abstraction layer over the platform dependant function...
int close()
Close the underlying file object.
Int64 seek(Int64 offset, int whence) const
Seek to a given offset within the file.
size_t read(void *bfr, size_t numberOfBytes, Int64 offset=-1L) const
Read from the underlying file.
This String class is an abstract data type that represents as NULL terminated string of characters.
bool usingTempFile() const
size_t numberOfElements() const
virtual ~TempFileEnumerationImplBase()
bool hasMoreElements() const
void throwIfEmpty() const
TempFileEnumerationImplBase()
size_t readSize(String const &filename)
bool usingTempFile() const
void reset()
reset puts the underlying stream object back into its initialized state.
BLOCXX_COMMON_API File openFile(const String &path)
Open a file for read/write and return an File object that can be used for reading and writing.