text.h
Go to the documentation of this file.
/***************************************************************************
begin : Sat Jun 28 2003
copyright : (C) 2003 by Martin Preuss
email : martin@libchipcard.de
***************************************************************************
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
* MA 02111-1307 USA *
* *
***************************************************************************/
#ifndef GWENHYWFAR_TEXT_H
#define GWENHYWFAR_TEXT_H
#include <gwenhywfar/gwenhywfarapi.h>
#include <gwenhywfar/types.h>
#include <gwenhywfar/logger.h>
#include <gwenhywfar/buffer.h>
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
#define GWEN_TEXT_FUZZY_SHIFT 10
#define GWEN_TEXT_FLAGS_DEL_LEADING_BLANKS 0x00000001
#define GWEN_TEXT_FLAGS_DEL_TRAILING_BLANKS 0x00000002
#define GWEN_TEXT_FLAGS_DEL_MULTIPLE_BLANKS 0x00000004
#define GWEN_TEXT_FLAGS_NEED_DELIMITER 0x00000008
#define GWEN_TEXT_FLAGS_NULL_IS_DELIMITER 0x00000010
#define GWEN_TEXT_FLAGS_DEL_QUOTES 0x00000020
#define GWEN_TEXT_FLAGS_CHECK_BACKSLASH 0x00000040
GWENHYWFAR_API
char *GWEN_Text_GetWord(const char *src,
const char *delims,
char *buffer,
unsigned int maxsize,
uint32_t flags,
const char **next);
GWENHYWFAR_API
int GWEN_Text_GetWordToBuffer(const char *src,
const char *delims,
GWEN_BUFFER *buf,
uint32_t flags,
const char **next);
GWENHYWFAR_API
char *GWEN_Text_Escape(const char *src,
char *buffer,
unsigned int maxsize);
GWENHYWFAR_API
char *GWEN_Text_Unescape(const char *src,
char *buffer,
unsigned int maxsize);
GWENHYWFAR_API
char *GWEN_Text_UnescapeN(const char *src,
unsigned int srclen,
char *buffer,
unsigned int maxsize);
GWENHYWFAR_API
char *GWEN_Text_EscapeTolerant(const char *src,
char *buffer,
unsigned int maxsize);
GWENHYWFAR_API
char *GWEN_Text_UnescapeTolerant(const char *src,
char *buffer,
unsigned int maxsize);
GWENHYWFAR_API
char *GWEN_Text_UnescapeTolerantN(const char *src,
unsigned int srclen,
char *buffer,
unsigned int maxsize);
GWENHYWFAR_API
int GWEN_Text_EscapeToBuffer(const char *src, GWEN_BUFFER *buf);
GWENHYWFAR_API
int GWEN_Text_UnescapeToBuffer(const char *src, GWEN_BUFFER *buf);
GWENHYWFAR_API
int GWEN_Text_EscapeToBufferTolerant(const char *src, GWEN_BUFFER *buf);
GWENHYWFAR_API
int GWEN_Text_EscapeToBufferTolerant2(GWEN_BUFFER *src, GWEN_BUFFER *buf);
GWENHYWFAR_API
int GWEN_Text_UnescapeToBufferTolerant(const char *src, GWEN_BUFFER *buf);
GWENHYWFAR_API
char *GWEN_Text_ToHex(const char *src, unsigned l, char *buffer,
unsigned int maxsize);
GWENHYWFAR_API
int GWEN_Text_ToHexBuffer(const char *src, unsigned l,
GWEN_BUFFER *buf,
unsigned int groupsize,
char delimiter,
int skipLeadingZeroes);
GWENHYWFAR_API
char *GWEN_Text_ToHexGrouped(const char *src,
unsigned l,
char *buffer,
unsigned maxsize,
unsigned int groupsize,
char delimiter,
int skipLeadingZeros);
GWENHYWFAR_API
int GWEN_Text_FromHex(const char *src, char *buffer, unsigned maxsize);
GWENHYWFAR_API
int GWEN_Text_FromHexBuffer(const char *src, GWEN_BUFFER *buf);
GWENHYWFAR_API
int GWEN_Text_FromBcdBuffer(const char *src, GWEN_BUFFER *buf);
GWENHYWFAR_API
int GWEN_Text_ToBcdBuffer(const char *src, unsigned l,
GWEN_BUFFER *buf,
unsigned int groupsize,
char delimiter,
int skipLeadingZeroes);
GWENHYWFAR_API
int GWEN_Text_NumToString(int num, char *buffer, unsigned int bufsize,
int fillchar);
GWENHYWFAR_API
int GWEN_Text_DoubleToBuffer(double num, GWEN_BUFFER *buf);
GWENHYWFAR_API
int GWEN_Text_StringToDouble(const char *s, double *num);
GWENHYWFAR_API
int GWEN_Text_Compare(const char *s1, const char *s2, int ign);
GWENHYWFAR_API
const char *GWEN_Text_StrCaseStr(const char *haystack, const char *needle);
GWENHYWFAR_API
char *GWEN_Text_strndup(const char *s, size_t n);
GWENHYWFAR_API
int GWEN_Text_ComparePattern(const char *w, const char *p, int sensecase);
GWENHYWFAR_API
void GWEN_Text_DumpString(const char *s, unsigned int l,
unsigned int insert);
GWENHYWFAR_API
void GWEN_Text_DumpString2Buffer(const char *s, unsigned int l,
GWEN_BUFFER *mbuf,
unsigned int insert);
GWENHYWFAR_API
void GWEN_Text_LogString(const char *s, unsigned int l,
const char *logDomain,
GWEN_LOGGER_LEVEL lv);
GWENHYWFAR_API
void GWEN_Text_CondenseBuffer(GWEN_BUFFER *buf);
GWENHYWFAR_API
int GWEN_Text_CountUtf8Chars(const char *s, int len);
GWENHYWFAR_API
int GWEN_Text_EscapeXmlToBuffer(const char *src, GWEN_BUFFER *buf);
GWENHYWFAR_API
int GWEN_Text_UnescapeXmlToBuffer(const char *src, GWEN_BUFFER *buf);
GWENHYWFAR_API
double GWEN_Text_CheckSimilarity(const char *s1, const char *s2, int ign);
GWENHYWFAR_API
int GWEN_Text_ConvertCharset(const char *fromCharset,
const char *toCharset,
const char *text, int len,
GWEN_BUFFER *tbuf);
typedef int GWENHYWFAR_CB(*GWEN_TEXT_REPLACE_VARS_CB)(void *cbPtr, const char *name, int index, int maxLen,
GWEN_BUFFER *dstBuf);
GWENHYWFAR_API
int GWEN_Text_ReplaceVars(const char *s, GWEN_BUFFER *dbuf, GWEN_TEXT_REPLACE_VARS_CB fn, void *ptr);
#ifdef __cplusplus
}
#endif
#endif
buffer.h
GWEN_BUFFER
struct GWEN_BUFFER GWEN_BUFFER
A dynamically resizeable text buffer.
Definition buffer.h:38
gwenhywfarapi.h
GWENHYWFAR_API
#define GWENHYWFAR_API
Definition gwenhywfarapi.h:67
GWENHYWFAR_CB
#define GWENHYWFAR_CB
Definition gwenhywfarapi.h:89
logger.h
GWEN_LOGGER_LEVEL
GWEN_LOGGER_LEVEL
Definition logger.h:61
GWEN_Text_ToHexBuffer
GWENHYWFAR_API int GWEN_Text_ToHexBuffer(const char *src, unsigned l, GWEN_BUFFER *buf, unsigned int groupsize, char delimiter, int skipLeadingZeroes)
GWEN_Text_FromHexBuffer
GWENHYWFAR_API int GWEN_Text_FromHexBuffer(const char *src, GWEN_BUFFER *buf)
GWEN_Text_NumToString
GWENHYWFAR_API int GWEN_Text_NumToString(int num, char *buffer, unsigned int bufsize, int fillchar)
GWEN_Text_EscapeToBufferTolerant2
GWENHYWFAR_API int GWEN_Text_EscapeToBufferTolerant2(GWEN_BUFFER *src, GWEN_BUFFER *buf)
GWEN_Text_StrCaseStr
GWENHYWFAR_API const char * GWEN_Text_StrCaseStr(const char *haystack, const char *needle)
GWEN_Text_Unescape
GWENHYWFAR_API char * GWEN_Text_Unescape(const char *src, char *buffer, unsigned int maxsize)
GWEN_Text_UnescapeTolerantN
GWENHYWFAR_API char * GWEN_Text_UnescapeTolerantN(const char *src, unsigned int srclen, char *buffer, unsigned int maxsize)
GWEN_Text_ToBcdBuffer
GWENHYWFAR_API int GWEN_Text_ToBcdBuffer(const char *src, unsigned l, GWEN_BUFFER *buf, unsigned int groupsize, char delimiter, int skipLeadingZeroes)
GWEN_Text_ComparePattern
GWENHYWFAR_API int GWEN_Text_ComparePattern(const char *w, const char *p, int sensecase)
GWEN_TEXT_REPLACE_VARS_CB
int GWENHYWFAR_CB(* GWEN_TEXT_REPLACE_VARS_CB)(void *cbPtr, const char *name, int index, int maxLen, GWEN_BUFFER *dstBuf)
Definition text.h:368
GWEN_Text_ReplaceVars
GWENHYWFAR_API int GWEN_Text_ReplaceVars(const char *s, GWEN_BUFFER *dbuf, GWEN_TEXT_REPLACE_VARS_CB fn, void *ptr)
GWEN_Text_UnescapeToBufferTolerant
GWENHYWFAR_API int GWEN_Text_UnescapeToBufferTolerant(const char *src, GWEN_BUFFER *buf)
GWEN_Text_Compare
GWENHYWFAR_API int GWEN_Text_Compare(const char *s1, const char *s2, int ign)
GWEN_Text_ConvertCharset
GWENHYWFAR_API int GWEN_Text_ConvertCharset(const char *fromCharset, const char *toCharset, const char *text, int len, GWEN_BUFFER *tbuf)
GWEN_Text_GetWordToBuffer
GWENHYWFAR_API int GWEN_Text_GetWordToBuffer(const char *src, const char *delims, GWEN_BUFFER *buf, uint32_t flags, const char **next)
GWEN_Text_StringToDouble
GWENHYWFAR_API int GWEN_Text_StringToDouble(const char *s, double *num)
GWEN_Text_GetWord
GWENHYWFAR_API char * GWEN_Text_GetWord(const char *src, const char *delims, char *buffer, unsigned int maxsize, uint32_t flags, const char **next)
GWEN_Text_strndup
GWENHYWFAR_API char * GWEN_Text_strndup(const char *s, size_t n)
GWEN_Text_UnescapeToBuffer
GWENHYWFAR_API int GWEN_Text_UnescapeToBuffer(const char *src, GWEN_BUFFER *buf)
GWEN_Text_EscapeToBufferTolerant
GWENHYWFAR_API int GWEN_Text_EscapeToBufferTolerant(const char *src, GWEN_BUFFER *buf)
GWEN_Text_ToHex
GWENHYWFAR_API char * GWEN_Text_ToHex(const char *src, unsigned l, char *buffer, unsigned int maxsize)
GWEN_Text_DumpString
GWENHYWFAR_API void GWEN_Text_DumpString(const char *s, unsigned int l, unsigned int insert)
GWEN_Text_CheckSimilarity
GWENHYWFAR_API double GWEN_Text_CheckSimilarity(const char *s1, const char *s2, int ign)
GWEN_Text_UnescapeN
GWENHYWFAR_API char * GWEN_Text_UnescapeN(const char *src, unsigned int srclen, char *buffer, unsigned int maxsize)
GWEN_Text_DumpString2Buffer
GWENHYWFAR_API void GWEN_Text_DumpString2Buffer(const char *s, unsigned int l, GWEN_BUFFER *mbuf, unsigned int insert)
GWEN_Text_DoubleToBuffer
GWENHYWFAR_API int GWEN_Text_DoubleToBuffer(double num, GWEN_BUFFER *buf)
GWEN_Text_EscapeXmlToBuffer
GWENHYWFAR_API int GWEN_Text_EscapeXmlToBuffer(const char *src, GWEN_BUFFER *buf)
GWEN_Text_ToHexGrouped
GWENHYWFAR_API char * GWEN_Text_ToHexGrouped(const char *src, unsigned l, char *buffer, unsigned maxsize, unsigned int groupsize, char delimiter, int skipLeadingZeros)
GWEN_Text_CondenseBuffer
GWENHYWFAR_API void GWEN_Text_CondenseBuffer(GWEN_BUFFER *buf)
GWEN_Text_FromBcdBuffer
GWENHYWFAR_API int GWEN_Text_FromBcdBuffer(const char *src, GWEN_BUFFER *buf)
GWEN_Text_UnescapeTolerant
GWENHYWFAR_API char * GWEN_Text_UnescapeTolerant(const char *src, char *buffer, unsigned int maxsize)
GWEN_Text_LogString
GWENHYWFAR_API void GWEN_Text_LogString(const char *s, unsigned int l, const char *logDomain, GWEN_LOGGER_LEVEL lv)
GWEN_Text_CountUtf8Chars
GWENHYWFAR_API int GWEN_Text_CountUtf8Chars(const char *s, int len)
GWEN_Text_EscapeTolerant
GWENHYWFAR_API char * GWEN_Text_EscapeTolerant(const char *src, char *buffer, unsigned int maxsize)
GWEN_Text_UnescapeXmlToBuffer
GWENHYWFAR_API int GWEN_Text_UnescapeXmlToBuffer(const char *src, GWEN_BUFFER *buf)
GWEN_Text_Escape
GWENHYWFAR_API char * GWEN_Text_Escape(const char *src, char *buffer, unsigned int maxsize)
GWEN_Text_EscapeToBuffer
GWENHYWFAR_API int GWEN_Text_EscapeToBuffer(const char *src, GWEN_BUFFER *buf)
GWEN_Text_FromHex
GWENHYWFAR_API int GWEN_Text_FromHex(const char *src, char *buffer, unsigned maxsize)
types.h