CrystalSpace

Public API Reference

csMemFile Class Reference

Essentially a raw memory buffer which implements the abstract iFile interface. More...

#include <csutil/memfile.h>

Inherits scfImplementation1< csMemFile, iFile >.

List of all members.

Public Types

enum  Disposition {
  DISPOSITION_DELETE, DISPOSITION_PLATFORM_FREE, DISPOSITION_IGNORE, DISPOSITION_CS_FREE,
  DISPOSITION_FREE = DISPOSITION_CS_FREE
}
 

Disposition of memory buffer at destruction time.

More...

Public Member Functions

 csMemFile (const char *, size_t)
 Construct a memory file from an existing memory buffer but do not free.
 csMemFile (iDataBuffer *buf, bool readOnly)
 Construct a memory file from an existing data buffer.
 csMemFile ()
 Construct an empty memory file.
 csMemFile (char *, size_t, Disposition=DISPOSITION_DELETE)
 Construct a memory file from an existing memory buffer and free later.
virtual const char * GetData () const
 Returns a pointer to the memory buffer.
virtual const char * GetName ()
 Returns "#csMemFile".
virtual ~csMemFile ()
 Destructor.

Detailed Description

Essentially a raw memory buffer which implements the abstract iFile interface.

Definition at line 34 of file memfile.h.


Member Enumeration Documentation

Disposition of memory buffer at destruction time.

Enumerator:
DISPOSITION_DELETE 

Deallocate with delete[].

DISPOSITION_PLATFORM_FREE 

Deallocate with platform_free().

DISPOSITION_IGNORE 

Ignore; assume that outside agent owns buffer.

DISPOSITION_CS_FREE 

Deallocate with cs_free().

DISPOSITION_FREE 

Deallocate with platform_free() or cs_free(), depending on whether malloc override is disabled or not.

Definition at line 39 of file memfile.h.


Constructor & Destructor Documentation

csMemFile::csMemFile (  ) 

Construct an empty memory file.

csMemFile::csMemFile ( const char *  ,
size_t   
)

Construct a memory file from an existing memory buffer but do not free.

csMemFile::csMemFile ( char *  ,
size_t  ,
Disposition  = DISPOSITION_DELETE 
)

Construct a memory file from an existing memory buffer and free later.

Note that when writing to the buffer, the original buffer may be discarded and a new one created due required resizing.

csMemFile::csMemFile ( iDataBuffer buf,
bool  readOnly 
)

Construct a memory file from an existing data buffer.

Parameters:
buf The data buffer to use.
readOnly Whether to treat the buffer as read-only. If true, writing to the memory file will create a copy of the buffer. If false, changes will affect the buffer. Note that when writing to the buffer, the original buffer may be discarded and a new one created due required resizing.
virtual csMemFile::~csMemFile (  )  [virtual]

Destructor.


Member Function Documentation

virtual const char* csMemFile::GetData (  )  const [virtual]

Returns a pointer to the memory buffer.

May return 0 if memory file is empty. Use GetSize() for size info.

virtual const char* csMemFile::GetName (  )  [virtual]

Returns "#csMemFile".


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

Generated for Crystal Space 1.4.1 by doxygen 1.7.1