Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef UT_BYTEBUF_H
00023 #define UT_BYTEBUF_H
00024
00025
00026
00027
00028
00029 #include <stdio.h>
00030 #include <gsf/gsf-input.h>
00031
00032
00033
00034
00035
00036 #ifndef UT_TYPES_H
00037 #include "ut_types.h"
00038 #endif
00039
00040
00041
00042
00043
00044
00045
00046
00047 #ifndef abi_std_truncate
00048 #define abi_std_truncate truncate
00049 #endif
00050 #ifdef truncate
00051 #undef truncate
00052 #endif
00053
00054 class ABI_EXPORT UT_ByteBuf
00055 {
00056 public:
00057 UT_ByteBuf(UT_uint32 iChunk = 0);
00058 ~UT_ByteBuf();
00059
00060 bool append(const UT_Byte * pValue, UT_uint32 length);
00061 bool ins(UT_uint32 position, const UT_Byte * pValue, UT_uint32 length);
00062 bool ins(UT_uint32 position, UT_uint32 length);
00063 bool del(UT_uint32 position, UT_uint32 amount);
00064 bool overwrite(UT_uint32 position, const UT_Byte * pValue, UT_uint32 length);
00065 void truncate(UT_uint32 position);
00066 UT_uint32 getLength(void) const;
00067 const UT_Byte * getPointer(UT_uint32 position) const;
00068 bool writeToFile(const char* pszFileName) const;
00069 bool writeToURI(const char* pszURI) const;
00070 bool insertFromFile(UT_uint32 iPosition, const char* pszFilename);
00071 bool insertFromURI(UT_uint32 iPosition, const char* pszURI);
00072 bool insertFromInput(UT_uint32 iPosition, GsfInput * fp);
00073 bool insertFromFile(UT_uint32 iPosition, FILE * fp);
00074 private:
00075 bool _byteBuf(UT_uint32 spaceNeeded);
00076
00077 UT_Byte * m_pBuf;
00078 UT_uint32 m_iSize;
00079 UT_uint32 m_iSpace;
00080 UT_uint32 m_iChunk;
00081 };
00082
00083 #endif