Eneboo - Documentación para desarrolladores
src/libdigidoc/DigiDocMem.h
Ir a la documentación de este archivo.
00001 #ifndef __DIGIDOC_MEM_H__
00002 #define __DIGIDOC_MEM_H__
00003 //==================================================
00004 // FILE:        DigiDocMem.h
00005 // PROJECT:     Digi Doc
00006 // DESCRIPTION: Digi Doc functions for memory buffer management
00007 // AUTHOR:  Veiko Sinivee, S|E|B IT Partner Estonia
00008 //==================================================
00009 // Copyright (C) AS Sertifitseerimiskeskus
00010 // This library is free software; you can redistribute it and/or
00011 // modify it under the terms of the GNU Lesser General Public
00012 // License as published by the Free Software Foundation; either
00013 // version 2.1 of the License, or (at your option) any later version.
00014 // This library is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00017 // Lesser General Public License for more details.
00018 // GNU Lesser General Public Licence is available at
00019 // http://www.gnu.org/copyleft/lesser.html
00020 //==========< HISTORY >=============================
00021 //      09.09.2004      Veiko Sinivee
00022 //                      Creation
00023 //==================================================
00024 
00025 #include <libdigidoc/DigiDocDefs.h>
00026 
00027 #ifdef  __cplusplus
00028 extern "C" {
00029 #endif
00030 
00031 
00032   typedef struct DigiDocMemBuf_st {
00033     void* pMem; // functions will assign allocated memory address here
00034     long nLen;   // length of data in number of bytes
00035   } DigiDocMemBuf;
00036 
00037   //--------------------------------------------------
00038   // Helper function to append data to a memory buffer
00039   // and grow it as required.
00040   // pBuf - address of memory buffer pointer
00041   // data - new data to be appended
00042   // len - length of data or -1 for zero terminated strings
00043   //--------------------------------------------------
00044   EXP_OPTION int ddocMemAppendData(DigiDocMemBuf* pBuf, const char* data, long len);
00045 
00046   //--------------------------------------------------
00047   // Helper function to assign data to a memory buffer
00048   // and release old content if necessary
00049   // pBuf - address of memory buffer pointer
00050   // data - new data to be appended
00051   // len - length of data or -1 for zero terminated strings
00052   //--------------------------------------------------
00053   EXP_OPTION int ddocMemAssignData(DigiDocMemBuf* pBuf, const char* data, long len);
00054 
00055   //--------------------------------------------------
00056   // Helper function to set buffer length as required
00057   // It will fill acquired mem with zeros.
00058   // pBuf - address of memory buffer pointer
00059   // len - new length of buffer
00060   //--------------------------------------------------
00061   EXP_OPTION int ddocMemSetLength(DigiDocMemBuf* pBuf, long len);
00062 
00063   //--------------------------------------------------
00064   // Helper function to free/cleanup memory buffer
00065   // This does not attempt to release the buffer object
00066   // itself but only it's contents.
00067   // pBuf - memory buffer pointer
00068   //--------------------------------------------------
00069   EXP_OPTION int ddocMemBuf_free(DigiDocMemBuf* pBuf);
00070 
00071   //--------------------------------------------------
00072   // Helper function to assign zero terminated strings
00073   // and release old content if necessary
00074   // dest - destination address
00075   // src - new data to be assigned
00076   //--------------------------------------------------
00077   EXP_OPTION int ddocMemAssignString(char** dest, const char* src);
00078 
00079   //--------------------------------------------------
00080   // Replaces a substring with another substring 
00081   // pBuf1 - memory buffer to search in
00082   // pBuf2 - memory buffer to write converted value to
00083   // search - search value
00084   // replacement - replacement value
00085   //--------------------------------------------------
00086   EXP_OPTION int ddocMemReplaceSubstr(DigiDocMemBuf* pBuf1, DigiDocMemBuf* pBuf2, 
00087                                       const char* search, const char* replacment);
00088   //--------------------------------------------------
00089   // Compares memory buffers
00090   // pBuf1 - memory buffer to value 1
00091   // pBuf2 - memory buffer to value 2
00092   // return 0 if both buffers are equal, 1 if not equal
00093   //--------------------------------------------------
00094   EXP_OPTION int ddocMemCompareMemBufs(DigiDocMemBuf* pBuf1, DigiDocMemBuf* pBuf2);
00095 
00096 
00097 #ifdef  __cplusplus
00098 }
00099 #endif
00100 
00101 #endif // __DIGIDOC_MEM_H__
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'