cinder::IoStreamFile Class Reference

#include <Stream.h>

Inherits cinder::IoStream.

List of all members.

Public Types

enum  Endianness { STREAM_BIG_ENDIAN, STREAM_LITTLE_ENDIAN }

Public Member Functions

 ~IoStreamFile ()
size_t readDataAvailable (void *dest, size_t maxSize)
void seekAbsolute (off_t absoluteOffset)
 Sets the current position of the stream to byte absoluteOffset. A negative offset is relative to the end of the file.
void seekRelative (off_t relativeOffset)
 Moves the current position of the stream by relativeOffset bytes.
off_t tell () const
 Returns the current position of the stream measured in bytes **/.
off_t size () const
bool isEof () const
FILE * getFILE ()
template<typename T >
void read (T *t)
template<typename T >
void readEndian (T *t, uint8_t endian)
template<typename T >
void readBig (T *t)
template<typename T >
void readLittle (T *t)
void readFixedString (char *t, size_t maxSize, bool nullTerminate)
void readFixedString (std::string *t, size_t size)
std::string readLine ()
void readData (void *dest, size_t size)
const std::string & getFileName () const
 Returns the file name of the path from which a Stream originated when relevant. Empty string when undefined.
void setFileName (const std::string &aFileName)
 Sets the file name of the path from which a Stream originated when relevant. Empty string when undefined.
template<typename T >
void write (T t)
void write (const Buffer &buffer)
template<typename T >
void writeEndian (T t, uint8_t endian)
template<typename T >
void writeBig (T t)
template<typename T >
void writeLittle (T t)
void writeData (const void *src, size_t size)

Static Public Member Functions

static IoStreamFileRef createRef (FILE *file, bool ownsFile=true, int32_t defaultBufferSize=2048)
 Creates a new IoStreamFileRef from a C-style file pointer FILE as returned by fopen(). If ownsFile the returned stream will destroy the stream upon its own destruction.
static uint8_t getNativeEndianness ()

Public Attributes

return STREAM_BIG_ENDIAN

Protected Member Functions

 IoStreamFile (FILE *aFile, bool aOwnsFile=true, int32_t aDefaultBufferSize=2048)
virtual void IORead (void *t, size_t size)
virtual void IOWrite (const void *t, size_t size)

Protected Attributes

FILE * mFile
bool mOwnsFile
int32_t mBufferSize
int32_t mDefaultBufferSize
shared_ptr< uint8_t > mBuffer
off_t mBufferOffset
off_t mBufferFileOffset
off_t mSize
bool mSizeCached
std::string mFileName

Static Protected Attributes

static const int MINIMUM_BUFFER_SIZE = 8

Member Enumeration Documentation

Enumerator:
STREAM_BIG_ENDIAN 
STREAM_LITTLE_ENDIAN 

Constructor & Destructor Documentation

cinder::IoStreamFile::~IoStreamFile (  ) 
cinder::IoStreamFile::IoStreamFile ( FILE *  aFile,
bool  aOwnsFile = true,
int32_t  aDefaultBufferSize = 2048 
) [protected]

Member Function Documentation

IoStreamFileRef cinder::IoStreamFile::createRef ( FILE *  file,
bool  ownsFile = true,
int32_t  defaultBufferSize = 2048 
) [static]

Creates a new IoStreamFileRef from a C-style file pointer FILE as returned by fopen(). If ownsFile the returned stream will destroy the stream upon its own destruction.

size_t cinder::IoStreamFile::readDataAvailable ( void *  dest,
size_t  maxSize 
) [virtual]

Implements cinder::IStream.

void cinder::IoStreamFile::seekAbsolute ( off_t  absoluteOffset  )  [virtual]

Sets the current position of the stream to byte absoluteOffset. A negative offset is relative to the end of the file.

Implements cinder::StreamBase.

void cinder::IoStreamFile::seekRelative ( off_t  relativeOffset  )  [virtual]

Moves the current position of the stream by relativeOffset bytes.

Implements cinder::StreamBase.

off_t cinder::IoStreamFile::tell (  )  const [virtual]

Returns the current position of the stream measured in bytes **/.

Implements cinder::StreamBase.

off_t cinder::IoStreamFile::size (  )  const [virtual]

Implements cinder::IStream.

bool cinder::IoStreamFile::isEof (  )  const [virtual]

Implements cinder::IStream.

FILE* cinder::IoStreamFile::getFILE (  ) 
void cinder::IoStreamFile::IORead ( void *  t,
size_t  size 
) [protected, virtual]

Implements cinder::IStream.

void cinder::IoStreamFile::IOWrite ( const void *  t,
size_t  size 
) [protected, virtual]

Implements cinder::OStream.

template<typename T >
void cinder::IStream::read ( T *  t  )  [inherited]
template<typename T >
void cinder::IStream::readEndian ( T *  t,
uint8_t  endian 
) [inherited]
template<typename T >
void cinder::IStream::readBig ( T *  t  )  [inherited]
template<typename T >
void cinder::IStream::readLittle ( T *  t  )  [inherited]
void cinder::IStream::readFixedString ( char *  t,
size_t  maxSize,
bool  nullTerminate 
) [inherited]
void cinder::IStream::readFixedString ( std::string *  t,
size_t  size 
) [inherited]
std::string cinder::IStream::readLine (  )  [inherited]
void cinder::IStream::readData ( void *  dest,
size_t  size 
) [inherited]
static uint8_t cinder::StreamBase::getNativeEndianness (  )  [static, inherited]

Returns the platform's endianness as a StreamBase::Endianness

const std::string& cinder::StreamBase::getFileName (  )  const [inherited]

Returns the file name of the path from which a Stream originated when relevant. Empty string when undefined.

void cinder::StreamBase::setFileName ( const std::string &  aFileName  )  [inherited]

Sets the file name of the path from which a Stream originated when relevant. Empty string when undefined.

template<typename T >
void cinder::OStream::write ( t  )  [inherited]
void cinder::OStream::write ( const Buffer buffer  )  [inherited]
template<typename T >
void cinder::OStream::writeEndian ( t,
uint8_t  endian 
) [inherited]
template<typename T >
void cinder::OStream::writeBig ( t  )  [inherited]
template<typename T >
void cinder::OStream::writeLittle ( t  )  [inherited]
void cinder::OStream::writeData ( const void *  src,
size_t  size 
) [inherited]

Member Data Documentation

FILE* cinder::IoStreamFile::mFile [protected]
int32_t cinder::IoStreamFile::mBufferSize [protected]
shared_ptr<uint8_t> cinder::IoStreamFile::mBuffer [protected]
off_t cinder::IoStreamFile::mSize [mutable, protected]
bool cinder::IoStreamFile::mSizeCached [mutable, protected]
const int cinder::IStream::MINIMUM_BUFFER_SIZE = 8 [static, protected, inherited]
std::string cinder::StreamBase::mFileName [protected, inherited]

The documentation for this class was generated from the following files: