PDF Toolbox
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
PdfTools_Toolbox_PtxSys.h File Reference
#include <stdarg.h>
#include <stdio.h>

Go to the source code of this file.

Classes

struct  TPtxSys_StreamDescriptor
 Structure that groups a set of callbacks that model streams. More...
 

Macros

#define PtxSys_PathStreamDescriptor_Create   PtxSys_PathStreamDescriptor_CreateA
 

Typedefs

typedef pos_t(STDCALLTGetLength) (void *handle)
 
typedef int(STDCALLTSeek) (void *handle, pos_t iPos)
 
typedef pos_t(STDCALLTTell) (void *handle)
 
typedef size_t(STDCALLTRead) (void *handle, void *pData, size_t nSize)
 
typedef size_t(STDCALLTWrite) (void *handle, const void *pData, size_t nSize)
 
typedef void(STDCALLTRelease) (void *handle)
 
typedef struct TPtxSys_StreamDescriptor TPtxSys_StreamDescriptor
 Structure that groups a set of callbacks that model streams.
 

Functions

static pos_t STDCALL PtxSysFILEPtrGetLength__ (void *handle)
 Callback implementation for TPtxSys_StreamDescriptor::pfGetLength for FILE*.
 
static int STDCALL PtxSysFILEPtrSeek__ (void *handle, pos_t iPos)
 Callback implementation for TPtxSys_StreamDescriptor::pfSeek for FILE*.
 
static pos_t STDCALL PtxSysFILEPtrTell__ (void *handle)
 Callback implementation for TPtxSys_StreamDescriptor::pfTell for FILE*.
 
static size_t STDCALL PtxSysFILEPtrRead__ (void *handle, void *pData, size_t nSize)
 Callback implementation for TPtxSys_StreamDescriptor::pfRead for FILE*.
 
static size_t STDCALL PtxSysFILEPtrWrite__ (void *handle, const void *pData, size_t nSize)
 Callback implementation for TPtxSys_StreamDescriptor::pfWrite for FILE*.
 
static void STDCALL PtxSysFILEPtrRelease__ (void *handle)
 Callback implementation for TPtxSys_StreamDescriptor::pfRelease for FILE*.
 
static void PtxSysCreateFILEStreamDescriptor (TPtxSys_StreamDescriptor *pDescriptor, FILE *handle, int bCloseOnRelease)
 Initialization function for TPtxSys_StreamDescriptor for FILE*.
 
PDFTOOLS_TOOLBOX_EXPORT BOOL PDFTOOLS_TOOLBOX_CALL PtxSys_PathStreamDescriptor_CreateA (TPtxSys_StreamDescriptor *pDescriptor, const char *szPath, BOOL bIsReadOnly)
 Initialization function for TPtxSys_StreamDescriptor for a given path.
 
PDFTOOLS_TOOLBOX_EXPORT BOOL PDFTOOLS_TOOLBOX_CALL PtxSys_PathStreamDescriptor_CreateW (TPtxSys_StreamDescriptor *pDescriptor, const WCHAR *szPath, BOOL bIsReadOnly)
 Initialization function for TPtxSys_StreamDescriptor for a given path.
 
PDFTOOLS_TOOLBOX_EXPORT void PDFTOOLS_TOOLBOX_CALL PtxSys_PathStreamDescriptor_Close (TPtxSys_StreamDescriptor *pDescriptor)
 Close the underlying file.
 
PDFTOOLS_TOOLBOX_EXPORT BOOL PDFTOOLS_TOOLBOX_CALL PtxSys_MemoryStreamDescriptor_Create (TPtxSys_StreamDescriptor *pDescriptor)
 Initialization function for TPtxSys_StreamDescriptor for the usage as memory streams.
 
PDFTOOLS_TOOLBOX_EXPORT void PDFTOOLS_TOOLBOX_CALL PtxSys_MemoryStreamDescriptor_Close (TPtxSys_StreamDescriptor *pDescriptor)
 Delete the underlying buffer.
 
PDFTOOLS_TOOLBOX_EXPORT pos_t PDFTOOLS_TOOLBOX_CALL PtxSys_StreamDescriptor_GetLength (TPtxSys_StreamDescriptor *pStreamDescriptor)
 
PDFTOOLS_TOOLBOX_EXPORT BOOL PDFTOOLS_TOOLBOX_CALL PtxSys_StreamDescriptor_Seek (TPtxSys_StreamDescriptor *pStreamDescriptor, pos_t iPos)
 
PDFTOOLS_TOOLBOX_EXPORT pos_t PDFTOOLS_TOOLBOX_CALL PtxSys_StreamDescriptor_Tell (TPtxSys_StreamDescriptor *pStreamDescriptor)
 
PDFTOOLS_TOOLBOX_EXPORT size_t PDFTOOLS_TOOLBOX_CALL PtxSys_StreamDescriptor_Read (TPtxSys_StreamDescriptor *pStreamDescriptor, void *pData, size_t nSize)
 
PDFTOOLS_TOOLBOX_EXPORT size_t PDFTOOLS_TOOLBOX_CALL PtxSys_StreamDescriptor_Write (TPtxSys_StreamDescriptor *pStreamDescriptor, const void *pData, size_t nSize)
 
PDFTOOLS_TOOLBOX_EXPORT void PDFTOOLS_TOOLBOX_CALL PtxSys_StreamDescriptor_Release (TPtxSys_StreamDescriptor *pStreamDescriptor)
 

Macro Definition Documentation

◆ PtxSys_PathStreamDescriptor_Create

#define PtxSys_PathStreamDescriptor_Create   PtxSys_PathStreamDescriptor_CreateA

Typedef Documentation

◆ TGetLength

typedef pos_t(STDCALL * TGetLength) (void *handle)

◆ TPtxSys_StreamDescriptor

typedef struct TPtxSys_StreamDescriptor TPtxSys_StreamDescriptor

Structure that groups a set of callbacks that model streams.

◆ TRead

typedef size_t(STDCALL * TRead) (void *handle, void *pData, size_t nSize)

◆ TRelease

typedef void(STDCALL * TRelease) (void *handle)

◆ TSeek

typedef int(STDCALL * TSeek) (void *handle, pos_t iPos)

◆ TTell

typedef pos_t(STDCALL * TTell) (void *handle)

◆ TWrite

typedef size_t(STDCALL * TWrite) (void *handle, const void *pData, size_t nSize)

Function Documentation

◆ PtxSys_MemoryStreamDescriptor_Close()

PDFTOOLS_TOOLBOX_EXPORT void PDFTOOLS_TOOLBOX_CALL PtxSys_MemoryStreamDescriptor_Close ( TPtxSys_StreamDescriptor * pDescriptor)

Delete the underlying buffer.

Parameters
[in]pDescriptorPointer to the TPtxSys_StreamDescriptor that wraps the underlying buffer.

◆ PtxSys_MemoryStreamDescriptor_Create()

PDFTOOLS_TOOLBOX_EXPORT BOOL PDFTOOLS_TOOLBOX_CALL PtxSys_MemoryStreamDescriptor_Create ( TPtxSys_StreamDescriptor * pDescriptor)

Initialization function for TPtxSys_StreamDescriptor for the usage as memory streams.

Parameters
[out]pDescriptorStream descriptor that is initialized.
Returns
TRUE memory stream initalized successfully; FALSE failed to initialize memory stream.

◆ PtxSys_PathStreamDescriptor_Close()

PDFTOOLS_TOOLBOX_EXPORT void PDFTOOLS_TOOLBOX_CALL PtxSys_PathStreamDescriptor_Close ( TPtxSys_StreamDescriptor * pDescriptor)

Close the underlying file.

Parameters
[in]pDescriptorPointer to the TPtxSys_StreamDescriptor that wraps the file.

◆ PtxSys_PathStreamDescriptor_CreateA()

PDFTOOLS_TOOLBOX_EXPORT BOOL PDFTOOLS_TOOLBOX_CALL PtxSys_PathStreamDescriptor_CreateA ( TPtxSys_StreamDescriptor * pDescriptor,
const char * szPath,
BOOL bIsReadOnly )

Initialization function for TPtxSys_StreamDescriptor for a given path.

Parameters
[out]pDescriptorStream descriptor that is initialized.
[in]szPathPath to a file for which a stream descriptor shall be initialized.
[in]bIsReadOnlyIf set TRUE the stream only allows for reading; if set to FALSE the stream allows for reading and writing.
Returns
TRUE file opened successfully; FALSE failed to open the file.

◆ PtxSys_PathStreamDescriptor_CreateW()

PDFTOOLS_TOOLBOX_EXPORT BOOL PDFTOOLS_TOOLBOX_CALL PtxSys_PathStreamDescriptor_CreateW ( TPtxSys_StreamDescriptor * pDescriptor,
const WCHAR * szPath,
BOOL bIsReadOnly )

Initialization function for TPtxSys_StreamDescriptor for a given path.

Parameters
[out]pDescriptorStream descriptor that is initialized.
[in]szPathPath to a file for which a stream descriptor shall be initialized.
[in]bIsReadOnlyIf set TRUE the stream only allows for reading; if set to FALSE the stream allows for reading and writing.
Returns
TRUE file opened successfully; FALSE failed to open the file.

◆ PtxSys_StreamDescriptor_GetLength()

PDFTOOLS_TOOLBOX_EXPORT pos_t PDFTOOLS_TOOLBOX_CALL PtxSys_StreamDescriptor_GetLength ( TPtxSys_StreamDescriptor * pStreamDescriptor)

◆ PtxSys_StreamDescriptor_Read()

PDFTOOLS_TOOLBOX_EXPORT size_t PDFTOOLS_TOOLBOX_CALL PtxSys_StreamDescriptor_Read ( TPtxSys_StreamDescriptor * pStreamDescriptor,
void * pData,
size_t nSize )

◆ PtxSys_StreamDescriptor_Release()

PDFTOOLS_TOOLBOX_EXPORT void PDFTOOLS_TOOLBOX_CALL PtxSys_StreamDescriptor_Release ( TPtxSys_StreamDescriptor * pStreamDescriptor)

◆ PtxSys_StreamDescriptor_Seek()

PDFTOOLS_TOOLBOX_EXPORT BOOL PDFTOOLS_TOOLBOX_CALL PtxSys_StreamDescriptor_Seek ( TPtxSys_StreamDescriptor * pStreamDescriptor,
pos_t iPos )

◆ PtxSys_StreamDescriptor_Tell()

PDFTOOLS_TOOLBOX_EXPORT pos_t PDFTOOLS_TOOLBOX_CALL PtxSys_StreamDescriptor_Tell ( TPtxSys_StreamDescriptor * pStreamDescriptor)

◆ PtxSys_StreamDescriptor_Write()

PDFTOOLS_TOOLBOX_EXPORT size_t PDFTOOLS_TOOLBOX_CALL PtxSys_StreamDescriptor_Write ( TPtxSys_StreamDescriptor * pStreamDescriptor,
const void * pData,
size_t nSize )

◆ PtxSysCreateFILEStreamDescriptor()

static void PtxSysCreateFILEStreamDescriptor ( TPtxSys_StreamDescriptor * pDescriptor,
FILE * handle,
int bCloseOnRelease )
static

Initialization function for TPtxSys_StreamDescriptor for FILE*.

Parameters
[out]pDescriptorFILE* stream descriptor that is initialized.
[in]handleHandle of stream.
[in]bCloseOnReleaseDetermines if the stream needs to be explicitly closed by fclose((FILE*)handle). If set TRUE the stream does not need to be explicitly closed; if set FALSE the stream needs to be explicitly closed.

◆ PtxSysFILEPtrGetLength__()

static pos_t STDCALL PtxSysFILEPtrGetLength__ ( void * handle)
static

Callback implementation for TPtxSys_StreamDescriptor::pfGetLength for FILE*.

Parameters
[in,out]handleHandle of stream.
Returns
Length of stream in bytes. -1 in case of an error.

◆ PtxSysFILEPtrRead__()

static size_t STDCALL PtxSysFILEPtrRead__ ( void * handle,
void * pData,
size_t nSize )
static

Callback implementation for TPtxSys_StreamDescriptor::pfRead for FILE*.

Read from stream into buffer

Parameters
[in,out]handleHandle of stream.
[out]pDataPointer to the buffer to which the data from the stream is written.
[in]nSizeSize in bytes of the stream to be read.
Returns
Number of bytes read; 0 for end of stream, -1 in case of an error.

◆ PtxSysFILEPtrRelease__()

static void STDCALL PtxSysFILEPtrRelease__ ( void * handle)
static

Callback implementation for TPtxSys_StreamDescriptor::pfRelease for FILE*.

Release handle to stream.

Parameters
[in,out]handleHandle of stream.

◆ PtxSysFILEPtrSeek__()

static int STDCALL PtxSysFILEPtrSeek__ ( void * handle,
pos_t iPos )
static

Callback implementation for TPtxSys_StreamDescriptor::pfSeek for FILE*.

Set new stream position.

Parameters
[in,out]handleHandle of stream.
[in]iPosByte position of stream. -1 set position to end of stream.
Returns
1 for success; 0 for failure.

◆ PtxSysFILEPtrTell__()

static pos_t STDCALL PtxSysFILEPtrTell__ ( void * handle)
static

Callback implementation for TPtxSys_StreamDescriptor::pfTell for FILE*.

Get current position of stream.

Parameters
[in,out]handleHandle of stream.
Returns
Current byte position of stream; -1 if position is unknown.

◆ PtxSysFILEPtrWrite__()

static size_t STDCALL PtxSysFILEPtrWrite__ ( void * handle,
const void * pData,
size_t nSize )
static

Callback implementation for TPtxSys_StreamDescriptor::pfWrite for FILE*.

Write to stream from buffer

Parameters
[in,out]handleHandle of stream.
[in]pDataPointer to the buffer from which data is written to the stream.
[in]nSizeSize in bytes to be written.
Returns
Number of bytes written to stream; 0 or -1 indicate an error.