bufferedio.h File Reference

#include <gwenhywfar/gwenhywfarapi.h>
#include <gwenhywfar/inherit.h>
#include <gwenhywfar/error.h>
#include <gwenhywfar/bio_file.h>
#include <gwenhywfar/bio_socket.h>
#include <gwenhywfar/bio_buffer.h>
#include <gwenhywfar/buffer.h>

Go to the source code of this file.

Defines

#define GWEN_BUFFEREDIO_CHAR_EOF   (-2)
#define GWEN_BUFFEREDIO_CHAR_ERROR   (-1)
#define GWEN_BUFFEREDIO_CHAR_NO_DATA   (-3)
#define GWEN_BUFFEREDIO_ERROR_CLOSE   3
#define GWEN_BUFFEREDIO_ERROR_EOF   6
#define GWEN_BUFFEREDIO_ERROR_NO_DATA   7
#define GWEN_BUFFEREDIO_ERROR_PARTIAL   5
#define GWEN_BUFFEREDIO_ERROR_READ   1
#define GWEN_BUFFEREDIO_ERROR_TIMEOUT   4
#define GWEN_BUFFEREDIO_ERROR_TYPE   "BufferedIO"
#define GWEN_BUFFEREDIO_ERROR_WRITE   2
#define GWEN_BUFFEREDIO_FLAGS_CLOSE   0x00000001
#define GWEN_BUFFEREDIO_FLAGS_DEFAULT
#define GWEN_BUFFEREDIO_FLAGS_UNTIL_EMPTY_LINE   0x00000002

Typedefs

typedef struct
GWEN_BUFFEREDIOSTRUCT 
GWEN_BUFFEREDIO
typedef int(* GWEN_BUFFEREDIOCLOSEFN )(GWEN_BUFFEREDIO *dm)
typedef int(* GWEN_BUFFEREDIOREADFN )(GWEN_BUFFEREDIO *dm, char *buffer, int *size, int timeout)
typedef int(* GWEN_BUFFEREDIOWRITEFN )(GWEN_BUFFEREDIO *dm, const char *buffer, int *size, int timeout)

Enumerations

enum  GWEN_BUFFEREDIOLINEMODE { GWEN_LineModeUnix = 0, GWEN_LineModeDOS }

Functions

GWENHYWFAR_API int GWEN_BufferedIO_Abandon (GWEN_BUFFEREDIO *dm)
GWENHYWFAR_API void GWEN_BufferedIO_AddFlags (GWEN_BUFFEREDIO *bt, uint32_t f)
GWENHYWFAR_API int GWEN_BufferedIO_CheckEOF (GWEN_BUFFEREDIO *dm)
GWENHYWFAR_API int GWEN_BufferedIO_Close (GWEN_BUFFEREDIO *dm)
GWENHYWFAR_API int GWEN_BufferedIO_Flush (GWEN_BUFFEREDIO *bt)
GWENHYWFAR_API void GWEN_BufferedIO_free (GWEN_BUFFEREDIO *dm)
GWENHYWFAR_API int GWEN_BufferedIO_GetBytesRead (const GWEN_BUFFEREDIO *dm)
GWENHYWFAR_API int GWEN_BufferedIO_GetBytesWritten (const GWEN_BUFFEREDIO *dm)
GWENHYWFAR_API uint32_t GWEN_BufferedIO_GetFlags (const GWEN_BUFFEREDIO *bt)
GWENHYWFAR_API
GWEN_BUFFEREDIOLINEMODE 
GWEN_BufferedIO_GetLineMode (const GWEN_BUFFEREDIO *dm)
GWENHYWFAR_API int GWEN_BufferedIO_GetLinePos (const GWEN_BUFFEREDIO *dm)
GWENHYWFAR_API int GWEN_BufferedIO_GetLines (const GWEN_BUFFEREDIO *dm)
GWENHYWFAR_API int GWEN_BufferedIO_GetTimeout (const GWEN_BUFFEREDIO *dm)
GWENHYWFAR_API GWEN_BUFFEREDIOGWEN_BufferedIO_new ()
GWENHYWFAR_API int GWEN_BufferedIO_PeekChar (GWEN_BUFFEREDIO *dm)
GWENHYWFAR_API int GWEN_BufferedIO_ReadBufferEmpty (GWEN_BUFFEREDIO *bt)
GWENHYWFAR_API int GWEN_BufferedIO_ReadChar (GWEN_BUFFEREDIO *bio)
GWENHYWFAR_API int GWEN_BufferedIO_ReadLine (GWEN_BUFFEREDIO *bt, char *buffer, unsigned int s)
GWENHYWFAR_API int GWEN_BufferedIO_ReadLine2Buffer (GWEN_BUFFEREDIO *bt, GWEN_BUFFER *buffer)
GWENHYWFAR_API int GWEN_BufferedIO_ReadRaw (GWEN_BUFFEREDIO *bt, char *buffer, unsigned int *bsize)
GWENHYWFAR_API int GWEN_BufferedIO_ReadRawForced (GWEN_BUFFEREDIO *bt, char *buffer, unsigned int *bsize)
GWENHYWFAR_API void GWEN_BufferedIO_SetCloseFn (GWEN_BUFFEREDIO *dm, GWEN_BUFFEREDIOCLOSEFN fn)
GWENHYWFAR_API void GWEN_BufferedIO_SetFlags (GWEN_BUFFEREDIO *bt, uint32_t f)
GWENHYWFAR_API void GWEN_BufferedIO_SetLineMode (GWEN_BUFFEREDIO *dm, GWEN_BUFFEREDIOLINEMODE lm)
GWENHYWFAR_API void GWEN_BufferedIO_SetReadBuffer (GWEN_BUFFEREDIO *bt, char *buffer, int len)
GWENHYWFAR_API void GWEN_BufferedIO_SetReadFn (GWEN_BUFFEREDIO *dm, GWEN_BUFFEREDIOREADFN fn)
GWENHYWFAR_API void GWEN_BufferedIO_SetTimeout (GWEN_BUFFEREDIO *dm, int timeout)
GWENHYWFAR_API void GWEN_BufferedIO_SetWriteBuffer (GWEN_BUFFEREDIO *bt, char *buffer, int len)
GWENHYWFAR_API void GWEN_BufferedIO_SetWriteFn (GWEN_BUFFEREDIO *dm, GWEN_BUFFEREDIOWRITEFN fn)
GWENHYWFAR_API int GWEN_BufferedIO_ShortFlush (GWEN_BUFFEREDIO *bt)
GWENHYWFAR_API void GWEN_BufferedIO_SubFlags (GWEN_BUFFEREDIO *bt, uint32_t f)
GWENHYWFAR_API int GWEN_BufferedIO_Write (GWEN_BUFFEREDIO *bt, const char *buffer)
GWENHYWFAR_API int GWEN_BufferedIO_WriteBufferEmpty (GWEN_BUFFEREDIO *bt)
GWENHYWFAR_API int GWEN_BufferedIO_WriteChar (GWEN_BUFFEREDIO *dm, char c)
GWENHYWFAR_API int GWEN_BufferedIO_WriteLine (GWEN_BUFFEREDIO *bt, const char *buffer)
GWENHYWFAR_API int GWEN_BufferedIO_WriteRaw (GWEN_BUFFEREDIO *bt, const char *buffer, unsigned int *bsize)
GWENHYWFAR_API int GWEN_BufferedIO_WriteRawForced (GWEN_BUFFEREDIO *bt, const char *buffer, unsigned int *bsize)


Define Documentation

#define GWEN_BUFFEREDIO_CHAR_EOF   (-2)

#define GWEN_BUFFEREDIO_CHAR_ERROR   (-1)

#define GWEN_BUFFEREDIO_CHAR_NO_DATA   (-3)

#define GWEN_BUFFEREDIO_ERROR_CLOSE   3

Definition at line 74 of file bufferedio.h.

#define GWEN_BUFFEREDIO_ERROR_EOF   6

Definition at line 77 of file bufferedio.h.

#define GWEN_BUFFEREDIO_ERROR_NO_DATA   7

Definition at line 78 of file bufferedio.h.

#define GWEN_BUFFEREDIO_ERROR_PARTIAL   5

Definition at line 76 of file bufferedio.h.

#define GWEN_BUFFEREDIO_ERROR_READ   1

Definition at line 72 of file bufferedio.h.

#define GWEN_BUFFEREDIO_ERROR_TIMEOUT   4

Definition at line 75 of file bufferedio.h.

#define GWEN_BUFFEREDIO_ERROR_TYPE   "BufferedIO"

Definition at line 71 of file bufferedio.h.

#define GWEN_BUFFEREDIO_ERROR_WRITE   2

Definition at line 73 of file bufferedio.h.

#define GWEN_BUFFEREDIO_FLAGS_CLOSE   0x00000001

If set then GWEN_BufferedIO_Close is enabled

Definition at line 87 of file bufferedio.h.

Referenced by GWEN_BufferedIO_Close().

#define GWEN_BUFFEREDIO_FLAGS_DEFAULT

Value:

Definition at line 90 of file bufferedio.h.

Referenced by GWEN_BufferedIO_new().

#define GWEN_BUFFEREDIO_FLAGS_UNTIL_EMPTY_LINE   0x00000002

Definition at line 88 of file bufferedio.h.

Referenced by GWEN_BufferedIO_PeekChar(), and GWEN_BufferedIO_ReadChar().


Typedef Documentation

typedef struct GWEN_BUFFEREDIOSTRUCT GWEN_BUFFEREDIO

A flexible I/O class with buffer for input or for output.

Definition at line 49 of file bufferedio.h.

Definition at line 110 of file bufferedio.h.

typedef int(* GWEN_BUFFEREDIOREADFN)(GWEN_BUFFEREDIO *dm, char *buffer, int *size, int timeout)

Definition at line 102 of file bufferedio.h.

typedef int(* GWEN_BUFFEREDIOWRITEFN)(GWEN_BUFFEREDIO *dm, const char *buffer, int *size, int timeout)

Definition at line 106 of file bufferedio.h.


Enumeration Type Documentation

Enumerator:
GWEN_LineModeUnix 
GWEN_LineModeDOS 

Definition at line 97 of file bufferedio.h.


Function Documentation

GWENHYWFAR_API int GWEN_BufferedIO_Abandon ( GWEN_BUFFEREDIO dm  ) 

Closes the stream without flushing any buffers. Call this in case of a severe error. The content of the internal buffers will be lost !

Definition at line 415 of file bufferedio.c.

References DBG_INFO_ERR, and GWEN_LOGDOMAIN.

GWENHYWFAR_API void GWEN_BufferedIO_AddFlags ( GWEN_BUFFEREDIO bt,
uint32_t  f 
)

Adds the given flags to the current flags for this bufferedIO. See GWEN_BUFFEREDIO_FLAGS_CLOSE and others for details.

Definition at line 830 of file bufferedio.c.

GWENHYWFAR_API int GWEN_BufferedIO_CheckEOF ( GWEN_BUFFEREDIO dm  ) 

Checks whether the end of stream is reached.

Author:
Martin Preuss<martin@aquamaniac.de>
Returns:
0 if not, !=0 otherwise

Definition at line 123 of file bufferedio.c.

References GWEN_BUFFEREDIO_CHAR_EOF, and GWEN_BufferedIO_PeekChar().

Referenced by GWEN_Buffer__FillBuffer_Bio(), GWEN_BufferedIO_ReadLine(), and GWEN_BufferedIO_ReadLine2Buffer().

GWENHYWFAR_API int GWEN_BufferedIO_Close ( GWEN_BUFFEREDIO dm  ) 

Closes the stream after flushing the output buffer (if needed).

Author:
Martin Preuss<martin@aquamaniac.de>

Definition at line 391 of file bufferedio.c.

References DBG_INFO_ERR, GWEN_BUFFEREDIO_FLAGS_CLOSE, GWEN_BufferedIO_Flush(), and GWEN_LOGDOMAIN.

GWENHYWFAR_API int GWEN_BufferedIO_Flush ( GWEN_BUFFEREDIO bt  ) 

Really writes the content of the write buffer to the stream. This is automatically called upon GWEN_BufferedIO_Close.

Author:
Martin Preuss<martin@aquamaniac.de>

Definition at line 261 of file bufferedio.c.

References DBG_DEBUG, and GWEN_LOGDOMAIN.

Referenced by GWEN_BufferedIO_Close(), GWEN_BufferedIO_WriteChar(), and GWEN_BufferedIO_WriteLine().

GWENHYWFAR_API void GWEN_BufferedIO_free ( GWEN_BUFFEREDIO dm  ) 

Frees a buffered IO context no matter of what type it is.

Author:
Martin Preuss<martin@aquamaniac.de>

Definition at line 69 of file bufferedio.c.

References GWEN_FREE_OBJECT, and GWEN_INHERIT_FINI.

Referenced by GWEN_Buffer_free(), and GWEN_Buffer_SetSourceBIO().

GWENHYWFAR_API int GWEN_BufferedIO_GetBytesRead ( const GWEN_BUFFEREDIO dm  ) 

Returns the number of bytes that have been read so far.

Definition at line 882 of file bufferedio.c.

GWENHYWFAR_API int GWEN_BufferedIO_GetBytesWritten ( const GWEN_BUFFEREDIO dm  ) 

Returns the number of bytes that have been written so far.

Definition at line 889 of file bufferedio.c.

GWENHYWFAR_API uint32_t GWEN_BufferedIO_GetFlags ( const GWEN_BUFFEREDIO bt  ) 

Returns the current flags for this bufferedIO. See GWEN_BUFFEREDIO_FLAGS_CLOSE and others for details.

Definition at line 816 of file bufferedio.c.

GWENHYWFAR_API GWEN_BUFFEREDIOLINEMODE GWEN_BufferedIO_GetLineMode ( const GWEN_BUFFEREDIO dm  ) 

Return the currently used line mode.

Author:
Martin Preuss<martin@aquamaniac.de>

Definition at line 572 of file bufferedio.c.

GWENHYWFAR_API int GWEN_BufferedIO_GetLinePos ( const GWEN_BUFFEREDIO dm  ) 

Returns the position index in the current line that is being read or written.

Definition at line 875 of file bufferedio.c.

GWENHYWFAR_API int GWEN_BufferedIO_GetLines ( const GWEN_BUFFEREDIO dm  ) 

Returns the number of lines that have been read or written so far.

Definition at line 868 of file bufferedio.c.

GWENHYWFAR_API int GWEN_BufferedIO_GetTimeout ( const GWEN_BUFFEREDIO dm  ) 

Returns the currently used timeout value in milliseconds.

Definition at line 586 of file bufferedio.c.

GWENHYWFAR_API GWEN_BUFFEREDIO* GWEN_BufferedIO_new (  ) 

This function should not be used directly. It is used by "inheriting" code (e.g. GWEN_BufferedIO_File_new).

Author:
Martin Preuss<martin@aquamaniac.de>

Definition at line 57 of file bufferedio.c.

References GWEN_BUFFEREDIO_FLAGS_DEFAULT, GWEN_INHERIT_INIT, GWEN_LineModeUnix, and GWEN_NEW_OBJECT.

Referenced by GWEN_BufferedIO_Buffer2_new(), GWEN_BufferedIO_File_new(), and GWEN_BufferedIO_Socket_new().

GWENHYWFAR_API int GWEN_BufferedIO_PeekChar ( GWEN_BUFFEREDIO dm  ) 

Peeks at the next character in the stream. This functions reads the next character without advancing the internal pointers, so the next peek or read will return the very same character.

Author:
Martin Preuss<martin@aquamaniac.de>
Returns:
-1 on error, character otherwise

Definition at line 165 of file bufferedio.c.

References DBG_DEBUG, DBG_ERROR, GWEN_BufferedIO__FillReadBuffer(), GWEN_BUFFEREDIO_CHAR_EOF, GWEN_BUFFEREDIO_CHAR_ERROR, GWEN_BUFFEREDIO_FLAGS_UNTIL_EMPTY_LINE, and GWEN_LOGDOMAIN.

Referenced by GWEN_BufferedIO_CheckEOF().

GWENHYWFAR_API int GWEN_BufferedIO_ReadBufferEmpty ( GWEN_BUFFEREDIO bt  ) 

Returns !=0 if the read buffer is empty, 0 if it is not.

Definition at line 331 of file bufferedio.c.

GWENHYWFAR_API int GWEN_BufferedIO_ReadChar ( GWEN_BUFFEREDIO bio  ) 

Reads the next character from the stream.

Note:
For performance reasons, the given argument is not checked for sanity. During initial development, you should do this for yourself, e.g. by adding assert(bio); before you call this function.
Author:
Martin Preuss<martin@aquamaniac.de>
Returns:
-1 on error, character otherwise

Definition at line 210 of file bufferedio.c.

References DBG_DEBUG, GWEN_BufferedIO__FillReadBuffer(), GWEN_BUFFEREDIO_CHAR_EOF, GWEN_BUFFEREDIO_CHAR_ERROR, GWEN_BUFFEREDIO_FLAGS_UNTIL_EMPTY_LINE, and GWEN_LOGDOMAIN.

Referenced by GWEN_BufferedIO_ReadLine(), and GWEN_BufferedIO_ReadLine2Buffer().

GWENHYWFAR_API int GWEN_BufferedIO_ReadLine ( GWEN_BUFFEREDIO bt,
char *  buffer,
unsigned int  s 
)

Reads a line until a CR (in Unix mode) or a CRLF (DOS mode) is found or the buffer is filled, whichever comes first. The trailing CR or CRLF is not copied into the buffer.

Author:
Martin Preuss<martin@aquamaniac.de>

Definition at line 430 of file bufferedio.c.

References DBG_ERROR, DBG_INFO, GWEN_BUFFEREDIO_CHAR_NO_DATA, GWEN_BufferedIO_CheckEOF(), GWEN_BufferedIO_ReadChar(), GWEN_ERROR_READ, GWEN_LineModeUnix, and GWEN_LOGDOMAIN.

GWENHYWFAR_API int GWEN_BufferedIO_ReadLine2Buffer ( GWEN_BUFFEREDIO bt,
GWEN_BUFFER buffer 
)

Reads a line until a CR (in Unix mode) or a CRLF (DOS mode) is found. The trailing CR or CRLF is not copied into the buffer. This function uses a GWEN_BUFFER to store the data.

Author:
Martin Preuss<martin@aquamaniac.de>

Definition at line 477 of file bufferedio.c.

References DBG_ERROR, DBG_INFO, GWEN_Buffer_AppendByte(), GWEN_BUFFEREDIO_CHAR_NO_DATA, GWEN_BufferedIO_CheckEOF(), GWEN_BufferedIO_ReadChar(), GWEN_ERROR_READ, GWEN_LineModeUnix, and GWEN_LOGDOMAIN.

GWENHYWFAR_API int GWEN_BufferedIO_ReadRaw ( GWEN_BUFFEREDIO bt,
char *  buffer,
unsigned int *  bsize 
)

Reads multiple bytes. If there is some data inside the internal buffers then that data will be returned first. This allows for mixing with character based read functions.

Parameters:
bt The BufferedIO.
buffer The buffer from which bytes should be read.
bsize Pointer to a variable which holds the number of bytes to read. Upon return this variable shows the number of bytes actually read.

Definition at line 638 of file bufferedio.c.

References DBG_DEBUG, DBG_INFO, DBG_INFO_ERR, GWEN_ERROR_EOF, GWEN_ERROR_READ, and GWEN_LOGDOMAIN.

Referenced by GWEN_BufferedIO_ReadRawForced().

GWENHYWFAR_API int GWEN_BufferedIO_ReadRawForced ( GWEN_BUFFEREDIO bt,
char *  buffer,
unsigned int *  bsize 
)

Reads exactly the amount of bytes given or returns an error. If less bytes are read than requested the GWN_BUFFEREDIO error GWEN_BUFFEREDIO_ERROR_PARTIAL is returned (which corresponds to the GWEN_ERROR code GWEN_ERROR_PARTIAL when converted via GWEN_Error_GetSimpleCode). The parameter bsize will be updated in any case.

Definition at line 704 of file bufferedio.c.

References DBG_ERROR, DBG_INFO, DBG_INFO_ERR, GWEN_BufferedIO_ReadRaw(), GWEN_ERROR_PARTIAL, GWEN_ERROR_USER_ABORTED, GWEN_GUI_PROGRESS_ALLOW_EMBED, GWEN_GUI_PROGRESS_DELAY, GWEN_GUI_PROGRESS_SHOW_ABORT, GWEN_GUI_PROGRESS_SHOW_PROGRESS, GWEN_Gui_ProgressAdvance(), GWEN_Gui_ProgressEnd(), GWEN_Gui_ProgressLog(), GWEN_Gui_ProgressStart(), GWEN_LOGDOMAIN, GWEN_LoggerLevel_Error, I18N, and NULL.

Referenced by GWEN_Buffer__FillBuffer_Bio().

GWENHYWFAR_API void GWEN_BufferedIO_SetCloseFn ( GWEN_BUFFEREDIO dm,
GWEN_BUFFEREDIOCLOSEFN  fn 
)

GWENHYWFAR_API void GWEN_BufferedIO_SetFlags ( GWEN_BUFFEREDIO bt,
uint32_t  f 
)

Sets the flags for this bufferedIO. See GWEN_BUFFEREDIO_FLAGS_CLOSE and others for details.

Definition at line 823 of file bufferedio.c.

GWENHYWFAR_API void GWEN_BufferedIO_SetLineMode ( GWEN_BUFFEREDIO dm,
GWEN_BUFFEREDIOLINEMODE  lm 
)

Set the line mode to be used. Currently there are:

  • LineModeUnix (using CR as line terminator)
  • LineModeDOS (using CR/LF as line terminator)
Author:
Martin Preuss<martin@aquamaniac.de>

Definition at line 564 of file bufferedio.c.

GWENHYWFAR_API void GWEN_BufferedIO_SetReadBuffer ( GWEN_BUFFEREDIO bt,
char *  buffer,
int  len 
)

Set the read buffer to be used. If you want to read from a stream this function must be called beforehand! Otherwise the first reading call will fail. (For writing this is not needed.)

Either supply a buffer by the buffer argument, or leave that argument as NULL so that the BufferedIO object will assign a new internal buffer for itself.

Author:
Martin Preuss<martin@aquamaniac.de>
Parameters:
bt The BufferedIO.
buffer Pointer to the buffer to be used. If 0 then this function will allocate a buffer of len size by itself. In any case this function will take ownership of this buffer! This means you should never free this buffer, this will be done by this module itself.
len Length of the buffer (in bytes)

Definition at line 82 of file bufferedio.c.

GWENHYWFAR_API void GWEN_BufferedIO_SetReadFn ( GWEN_BUFFEREDIO dm,
GWEN_BUFFEREDIOREADFN  fn 
)

GWENHYWFAR_API void GWEN_BufferedIO_SetTimeout ( GWEN_BUFFEREDIO dm,
int  timeout 
)

Set the timeout for read- and write operations in milliseconds. Some values have special meanings:

  • GWEN_TIMEOUT_NONE: no timeout (not blocking)
  • GWEN_TIMEOUT_FOREVER: wait forever (blocking)
Author:
Martin Preuss<martin@aquamaniac.de>

Definition at line 579 of file bufferedio.c.

Referenced by GWEN_BufferedIO_Buffer2_new(), GWEN_BufferedIO_File_new(), and GWEN_BufferedIO_Socket_new().

GWENHYWFAR_API void GWEN_BufferedIO_SetWriteBuffer ( GWEN_BUFFEREDIO bt,
char *  buffer,
int  len 
)

Set the write buffer to be used. If you want to write to a stream this function must be called beforehand! Otherwise the first writing call will fail. (For reading this is not needed.)

Either supply a buffer by the buffer argument, or leave that argument as NULL so that the BufferedIO object will assign a new internal buffer for itself.

Author:
Martin Preuss<martin@aquamaniac.de>
Parameters:
bt The BufferedIO.
buffer Pointer to the buffer to be used. If 0 then this function will allocate a buffer of len size by itself. In any case this function will take ownership of this buffer! This means you should never free this buffer, this will be done by this module itself.
len Length of the buffer (in bytes)

Definition at line 103 of file bufferedio.c.

GWENHYWFAR_API void GWEN_BufferedIO_SetWriteFn ( GWEN_BUFFEREDIO dm,
GWEN_BUFFEREDIOWRITEFN  fn 
)

GWENHYWFAR_API int GWEN_BufferedIO_ShortFlush ( GWEN_BUFFEREDIO bt  ) 

Really writes the content of the write buffer to the stream. This function only flushes as much bytes as possible. If after calling this function some bytes still remain inside the write buffer, a warning will be returned (error code=GWEN_BUFFEREDIO_ERROR_PARTIAL, severity=GWEN_ERROR_SEVERITY_WARN). You should then call this function as long as it returns this warning in order to really save the data.

Author:
Martin Preuss<martin@aquamaniac.de>

Definition at line 294 of file bufferedio.c.

References DBG_DEBUG, DBG_INFO_ERR, GWEN_ERROR_PARTIAL, and GWEN_LOGDOMAIN.

Referenced by GWEN_BufferedIO_WriteRaw().

GWENHYWFAR_API void GWEN_BufferedIO_SubFlags ( GWEN_BUFFEREDIO bt,
uint32_t  f 
)

Removes the given flags from the current flags for this bufferedIO. See GWEN_BUFFEREDIO_FLAGS_CLOSE and others for details.

Definition at line 837 of file bufferedio.c.

GWENHYWFAR_API int GWEN_BufferedIO_Write ( GWEN_BUFFEREDIO bt,
const char *  buffer 
)

Writes the content of the buffer to the stream until a null byte is found.

Author:
Martin Preuss<martin@aquamaniac.de>

Definition at line 512 of file bufferedio.c.

References DBG_INFO_ERR, GWEN_BufferedIO_WriteChar(), and GWEN_LOGDOMAIN.

Referenced by GWEN_BufferedIO_WriteLine().

GWENHYWFAR_API int GWEN_BufferedIO_WriteBufferEmpty ( GWEN_BUFFEREDIO bt  ) 

Returns !=0 if the write buffer is empty, 0 if it is not.

Definition at line 340 of file bufferedio.c.

GWENHYWFAR_API int GWEN_BufferedIO_WriteChar ( GWEN_BUFFEREDIO dm,
char  c 
)

Writes a character into the stream.

Author:
Martin Preuss<martin@aquamaniac.de>

Definition at line 349 of file bufferedio.c.

References DBG_INFO_ERR, GWEN_BufferedIO_Flush(), and GWEN_LOGDOMAIN.

Referenced by GWEN_BufferedIO_Write(), and GWEN_BufferedIO_WriteLine().

GWENHYWFAR_API int GWEN_BufferedIO_WriteLine ( GWEN_BUFFEREDIO bt,
const char *  buffer 
)

Writes the content of the given buffer plus appropriate line end character(s) (CR in Unix mode and CR/LF in DOS mode) into the stream. Please note that the buffer should not contain CR or CR/LF characters.

Author:
Martin Preuss<martin@aquamaniac.de>

Definition at line 530 of file bufferedio.c.

References DBG_INFO_ERR, GWEN_BufferedIO_Flush(), GWEN_BufferedIO_Write(), GWEN_BufferedIO_WriteChar(), GWEN_LineModeDOS, and GWEN_LOGDOMAIN.

GWENHYWFAR_API int GWEN_BufferedIO_WriteRaw ( GWEN_BUFFEREDIO bt,
const char *  buffer,
unsigned int *  bsize 
)

Writes the content of the given buffer. If there still is some data inside the internal buffer that data will be flushed first. This allows for mixing calls to this function with calls to the character based write functions.

Parameters:
bt The BufferedIO.
buffer The buffer to which bytes should be written.
bsize Pointer to a variable which holds the number of bytes to write. Upon return this variable shows the number of bytes actually written. Please note that if this function has to flush internal buffers the return value might be 0 (indicating that no error occurred, but the internal buffers still contain some bytes which will be flushed upon the next call to this function).

Definition at line 593 of file bufferedio.c.

References DBG_INFO_ERR, GWEN_BufferedIO_ShortFlush(), GWEN_ERROR_PARTIAL, and GWEN_LOGDOMAIN.

Referenced by GWEN_BufferedIO_WriteRawForced().

GWENHYWFAR_API int GWEN_BufferedIO_WriteRawForced ( GWEN_BUFFEREDIO bt,
const char *  buffer,
unsigned int *  bsize 
)

Writes exactly the amount of bytes given or returns an error. If less bytes are written than requested the GWN_BUFFEREDIO error GWEN_BUFFEREDIO_ERROR_PARTIAL is returned (which corresponds to the GWEN_ERROR code GWEN_ERROR_PARTIAL when converted via GWEN_Error_GetSimpleCode). The parameter bsize will be updated in any case.

Definition at line 763 of file bufferedio.c.

References DBG_ERROR, DBG_ERROR_ERR, DBG_INFO, GWEN_BufferedIO_WriteRaw(), GWEN_ERROR_PARTIAL, GWEN_GUI_PROGRESS_ALLOW_EMBED, GWEN_GUI_PROGRESS_DELAY, GWEN_GUI_PROGRESS_SHOW_ABORT, GWEN_GUI_PROGRESS_SHOW_PROGRESS, GWEN_Gui_ProgressAdvance(), GWEN_Gui_ProgressEnd(), GWEN_Gui_ProgressStart(), GWEN_LOGDOMAIN, I18N, and NULL.


Generated on Thu Aug 20 13:54:39 2009 for gwenhywfar by  doxygen 1.5.9