[1366] | 1 | |
---|
[622] | 2 | /* |
---|
| 3 | * ---------------------------------------------------------------------- |
---|
| 4 | * INTERFACE: C Rappture Buffer Header |
---|
| 5 | * |
---|
| 6 | * ====================================================================== |
---|
| 7 | * AUTHOR: Derrick Kearney, Purdue University |
---|
| 8 | * Copyright (c) 2004-2007 Purdue Research Foundation |
---|
| 9 | * |
---|
| 10 | * See the file "license.terms" for information on usage and |
---|
| 11 | * redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
---|
| 12 | * ====================================================================== |
---|
| 13 | */ |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | #ifndef _RAPPTURE_BUFFER_C_H |
---|
| 17 | #define _RAPPTURE_BUFFER_C_H |
---|
| 18 | |
---|
| 19 | #include "RpOutcomeCInterface.h" |
---|
| 20 | |
---|
| 21 | #ifdef __cplusplus |
---|
| 22 | extern "C" { |
---|
| 23 | #endif // ifdef __cplusplus |
---|
| 24 | |
---|
| 25 | typedef struct { |
---|
| 26 | void* _buf; |
---|
| 27 | /* |
---|
| 28 | const char* (*bytes)(); |
---|
| 29 | unsigned int (*size)(); |
---|
| 30 | // void (*clear)(); |
---|
| 31 | int (*append)(const char*, int); |
---|
| 32 | int (*read)(const char*, int); |
---|
| 33 | int (*seek)(int, int); |
---|
| 34 | int (*tell)(); |
---|
| 35 | // void (*rewind); |
---|
[1366] | 36 | bool (*load)(Outcome &result, const char*); |
---|
| 37 | bool (*dump)(Outcome &result, const char*); |
---|
| 38 | bool (*encode)(Outcome &result, bool, bool); |
---|
| 39 | bool (*decode)(Outcome &result, bool, bool); |
---|
[622] | 40 | */ |
---|
| 41 | }RapptureBuffer; |
---|
| 42 | |
---|
| 43 | int RapptureBufferInit(RapptureBuffer* buf); |
---|
| 44 | int RapptureBufferNew(RapptureBuffer* buf); |
---|
| 45 | int RapptureBufferFree(RapptureBuffer* buf); |
---|
| 46 | const char* RapptureBufferBytes(RapptureBuffer* buf); |
---|
| 47 | unsigned int RapptureBufferSize(RapptureBuffer* buf); |
---|
| 48 | int RapptureBufferAppend(RapptureBuffer* buf, const char* bytes, int size); |
---|
| 49 | int RapptureBufferRead(RapptureBuffer* buf, const char* bytes, int size); |
---|
| 50 | int RapptureBufferSeek(RapptureBuffer* buf, int offset, int whence); |
---|
| 51 | int RapptureBufferTell(RapptureBuffer* buf); |
---|
| 52 | RapptureOutcome RapptureBufferLoad(RapptureBuffer* buf, const char* filename); |
---|
| 53 | RapptureOutcome RapptureBufferDump(RapptureBuffer* buf, const char* filename); |
---|
[1366] | 54 | RapptureOutcome RapptureBufferEncode(RapptureBuffer* buf, int compress, |
---|
| 55 | int base64 ); |
---|
| 56 | RapptureOutcome RapptureBufferDecode(RapptureBuffer* buf, |
---|
| 57 | int decompress, int base64 ); |
---|
[622] | 58 | |
---|
| 59 | #ifdef __cplusplus |
---|
| 60 | } |
---|
| 61 | #endif // ifdef __cplusplus |
---|
| 62 | |
---|
| 63 | #endif // ifndef _RAPPTURE_BUFFER_C_H |
---|