#include <QBuffer.h>
Inheritance diagram for FX::QBuffer:
There's little more to say than that this class works with a QByteArray to provide an i/o device working directly with memory. It auto-extends the array if needed etc. It's also thread-safe so multiple threads can use the i/o device at once.
Note that QBuffer ignores CR/LF translation (IO_Translate). Anything dealing with files in TnFOX does though, so the conversion can be done then.
Since there is no reference counted sharing in TnFOX, buffer() and setBuffer() return and take references.
Definition at line 56 of file QBuffer.h.
Public Types | |
typedef FXfval | Offset |
Default | |
Unix | |
MacOS | |
MSDOS | |
NoTranslation | |
UTF8 | |
UTF16 | |
UTF16LE | |
UTF32 | |
UTF32LE | |
enum | CRLFType { Default, Unix, MacOS, MSDOS } |
enum | UnicodeType { NoTranslation, UTF8, UTF16, UTF16LE, UTF32, UTF32LE } |
Public Member Functions | |
QBuffer (FXuval len=0, bool fastbuffer=false) | |
QBuffer (QByteArray &buffer) | |
~QBuffer () | |
bool | isNull () const |
QByteArray & | buffer () const |
void | setBuffer (QByteArray &buffer) |
virtual bool | open (FXuint mode) |
virtual void | close () |
virtual void | flush () |
virtual FXfval | size () const |
virtual void | truncate (FXfval size) |
virtual FXuval | readBlock (char *data, FXuval maxlen) |
virtual FXuval | writeBlock (const char *data, FXuval maxlen) |
virtual FXuval | readBlockFrom (char *data, FXuval maxlen, FXfval pos) |
virtual FXuval | writeBlockTo (FXfval pos, const char *data, FXuval maxlen) |
virtual int | getch () |
virtual int | putch (int c) |
virtual int | ungetch (int c) |
FXuint | flags () const |
FXuint | mode () const |
FXuint | state () const |
CRLFType | crlfFormat () const |
void | setCRLFFormat (CRLFType type) |
UnicodeType | unicodeTranslation () const |
void | setUnicodeTranslation (UnicodeType type) |
bool | isBuffered () const |
bool | isRaw () const |
bool | isTranslated () const |
bool | isUTF16Translated () const |
bool | isUTF32Translated () const |
bool | isReadable () const |
bool | isWriteable () const |
bool | isWritable () const |
bool | isReadWrite () const |
bool | isClosed () const |
bool | isInactive () const |
bool | isOpen () const |
virtual bool | isSynchronous () const |
virtual FXfval | at () const |
virtual bool | at (FXfval newpos) |
virtual bool | atEnd () const |
virtual const FXACL & | permissions () const |
virtual void | setPermissions (const FXACL &) |
FXuval | readBlock (FXuchar *data, FXuval maxlen) |
FXuval | writeBlock (const FXuchar *data, FXuval maxlen) |
virtual FXuval | readLine (char *data, FXuval maxlen) |
FXuval | readBlockFrom (FXuchar *data, FXuval maxlen, FXfval pos) |
FXuval | writeBlockTo (FXfval pos, const FXuchar *data, FXuval maxlen) |
FXfval | shredData (FXfval offset, FXfval len=(FXfval)-1) |
Static Public Member Functions | |
static UnicodeType | determineUnicodeType (FXuchar *data, FXuval len) throw () |
static FXuval | applyCRLF (FXuchar *FXRESTRICT output, const FXuchar *FXRESTRICT input, FXuval outputlen, FXuval &inputlen, CRLFType crlftype=Default, UnicodeType utftype=NoTranslation) |
static FXuval | removeCRLF (FXuchar *FXRESTRICT output, const FXuchar *FXRESTRICT input, FXuval outputlen, FXuval &inputlen, UnicodeType utftype=NoTranslation) |
Protected Member Functions | |
void | setFlags (int f) |
void | setMode (int m) |
void | setState (int s) |
Protected Attributes | |
FXfval | ioIndex |
Friends | |
FXAPI FXStream & | operator<< (FXStream &s, const QBuffer &i) |
FXAPI FXStream & | operator>> (FXStream &s, QBuffer &i) |
FXAPI FXStream & | operator<< (FXStream &s, QIODevice &i) |
FXAPI FXStream & | operator>> (FXStream &s, QIODevice &i) |