# text.h

Go to the documentation of this file.

    00001 /***************************************************************************
    00002  $RCSfile: text.h,v $
    00003  -------------------
    00004  cvs         : $Id: text.h,v 1.27 2005/02/23 02:16:57 aquamaniac Exp $
    00005  begin       : Sat Jun 28 2003
    00006  copyright   : (C) 2003 by Martin Preuss
    00007  email       : martin@libchipcard.de
    00008
    00009  ***************************************************************************
    00010  *                                                                         *
    00011  *   This library is free software; you can redistribute it and/or         *
    00012  *   modify it under the terms of the GNU Lesser General Public            *
    00013  *   License as published by the Free Software Foundation; either          *
    00014  *   version 2.1 of the License, or (at your option) any later version.    *
    00015  *                                                                         *
    00016  *   This library is distributed in the hope that it will be useful,       *
    00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
    00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
    00019  *   Lesser General Public License for more details.                       *
    00020  *                                                                         *
    00021  *   You should have received a copy of the GNU Lesser General Public      *
    00022  *   License along with this library; if not, write to the Free Software   *
    00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston,                 *
    00024  *   MA  02111-1307  USA                                                   *
    00025  *                                                                         *
    00026  ***************************************************************************/
    00027
    00028
    00029
    00030 #ifndef GWENHYWFAR_TEXT_H
    00031 #define GWENHYWFAR_TEXT_H
    00032
    00033 #include <gwenhywfar/gwenhywfarapi.h>
    00034 #include <gwenhywfar/types.h>
    00035 #include <gwenhywfar/logger.h>
    00036 #include <gwenhywfar/buffer.h>
    00037 #include <stdio.h>
    00038
    00039
    00040 #ifdef __cplusplus
    00041 extern "C" {
    00042 #endif
    00043
    00044 #define GWEN_TEXT_FUZZY_SHIFT               10
    00045
    00046
    00047 #define GWEN_TEXT_FLAGS_DEL_LEADING_BLANKS  0x00000001
    00048 #define GWEN_TEXT_FLAGS_DEL_TRAILING_BLANKS 0x00000002
    00049 #define GWEN_TEXT_FLAGS_DEL_MULTIPLE_BLANKS 0x00000004
    00050 #define GWEN_TEXT_FLAGS_NEED_DELIMITER      0x00000008
    00051 #define GWEN_TEXT_FLAGS_NULL_IS_DELIMITER   0x00000010
    00052 #define GWEN_TEXT_FLAGS_DEL_QUOTES          0x00000020
    00053 #define GWEN_TEXT_FLAGS_CHECK_BACKSLASH     0x00000040
    00054
    00055
    00072 GWENHYWFAR_API
    00073 char *GWEN_Text_GetWord(const char *src,
    00074                         const char *delims,
    00075                         char *buffer,
    00076                         unsigned int maxsize,
    00077                         GWEN_TYPE_UINT32 flags,
    00078                         const char **next);
    00079
    00080 GWENHYWFAR_API
    00081 int GWEN_Text_GetWordToBuffer(const char *src,
    00082                               const char *delims,
    00083                               GWEN_BUFFER *buf,
    00084                               GWEN_TYPE_UINT32 flags,
    00085                               const char **next);
    00086
    00087
    00093 GWENHYWFAR_API
    00094 char *GWEN_Text_Escape(const char *src,
    00095                        char *buffer,
    00096                        unsigned int maxsize);
    00097
    00098 GWENHYWFAR_API
    00099 char *GWEN_Text_Unescape(const char *src,
    00100                          char *buffer,
    00101                          unsigned int maxsize);
    00102
    00103 GWENHYWFAR_API
    00104 int GWEN_Text_EscapeToBuffer(const char *src, GWEN_BUFFER *buf);
    00105
    00106 GWENHYWFAR_API
    00107 int GWEN_Text_UnescapeToBuffer(const char *src, GWEN_BUFFER *buf);
    00108
    00114 GWENHYWFAR_API
    00115 int GWEN_Text_EscapeToBufferTolerant(const char *src, GWEN_BUFFER *buf);
    00116
    00117 GWENHYWFAR_API
    00118 int GWEN_Text_EscapeToBufferTolerant2(GWEN_BUFFER *src, GWEN_BUFFER *buf);
    00119
    00120
    00125 GWENHYWFAR_API
    00126 int GWEN_Text_UnescapeToBufferTolerant(const char *src, GWEN_BUFFER *buf);
    00127
    00128
    00129 GWENHYWFAR_API
    00130 char *GWEN_Text_ToHex(const char *src, unsigned l, char *buffer,
    00131                       unsigned int maxsize);
    00132
    00140 GWENHYWFAR_API
    00141 int GWEN_Text_ToHexBuffer(const char *src, unsigned l,
    00142                           GWEN_BUFFER *buf,
    00143                           unsigned int groupsize,
    00144                           char delimiter,
    00145                           int skipLeadingZeroes);
    00146
    00151 GWENHYWFAR_API
    00152 char *GWEN_Text_ToHexGrouped(const char *src,
    00153                              unsigned l,
    00154                              char *buffer,
    00155                              unsigned maxsize,
    00156                              unsigned int groupsize,
    00157                              char delimiter,
    00158                              int skipLeadingZeros);
    00159
    00160 GWENHYWFAR_API
    00161 int GWEN_Text_FromHex(const char *src, char *buffer, unsigned maxsize);
    00162
    00166 GWENHYWFAR_API
    00167 int GWEN_Text_FromHexBuffer(const char *src, GWEN_BUFFER *buf);
    00168
    00169
    00173 GWENHYWFAR_API
    00174 int GWEN_Text_FromBcdBuffer(const char *src, GWEN_BUFFER *buf);
    00175
    00176
    00184 GWENHYWFAR_API
    00185 int GWEN_Text_ToBcdBuffer(const char *src, unsigned l,
    00186                           GWEN_BUFFER *buf,
    00187                           unsigned int groupsize,
    00188                           char delimiter,
    00189                           int skipLeadingZeroes);
    00190
    00191
    00197 GWENHYWFAR_API
    00198 int GWEN_Text_NumToString(int num, char *buffer, unsigned int bufsize,
    00199                           int fillchar);
    00200
    00207 GWENHYWFAR_API
    00208 int GWEN_Text_DoubleToBuffer(double num, GWEN_BUFFER *buf);
    00209
    00216 GWENHYWFAR_API
    00217 int GWEN_Text_StringToDouble(const char *s, double *num);
    00218
    00219
    00226 GWENHYWFAR_API
    00227 int GWEN_Text_Compare(const char *s1, const char *s2, int ign);
    00228
    00229
    00237 GWENHYWFAR_API
    00238 int GWEN_Text_ComparePattern(const char *w, const char *p, int sensecase);
    00239
    00240
    00245 GWENHYWFAR_API
    00246 void GWEN_Text_DumpString(const char *s, unsigned l, FILE *f, unsigned insert);
    00247
    00248
    00249 GWENHYWFAR_API
    00250 void GWEN_Text_DumpString2Buffer(const char *s, unsigned l,
    00251                                  GWEN_BUFFER *mbuf,
    00252                                  unsigned insert);
    00253
    00254 GWENHYWFAR_API
    00255 void GWEN_Text_LogString(const char *s, unsigned l,
    00256                          const char *logDomain,
    00257                          GWEN_LOGGER_LEVEL lv);
    00258
    00259
    00264 GWENHYWFAR_API
    00265   void GWEN_Text_CondenseBuffer(GWEN_BUFFER *buf);
    00266
    00267
    00274 GWENHYWFAR_API
    00275   int GWEN_Text_CountUtf8Chars(const char *s, int len);
    00276
    00277
    00282 GWENHYWFAR_API
    00283 int GWEN_Text_EscapeXmlToBuffer(const char *src, GWEN_BUFFER *buf);
    00284
    00288 GWENHYWFAR_API
    00289 int GWEN_Text_UnescapeXmlToBuffer(const char *src, GWEN_BUFFER *buf);
    00290
    00291
    00307 GWENHYWFAR_API
    00308   double GWEN_Text_CheckSimilarity(const char *s1, const char *s2, int ign);
    00309
    00310
    00311
    00312 #ifdef __cplusplus
    00313 }
    00314 #endif
    00315
    00316
    00317 #endif
    00318
    00319
    00320