Main Page | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages

cpl_string.h

Go to the documentation of this file.
00001 /**********************************************************************
00002  * $Id: cpl_string.h,v 1.18 2005/04/04 15:23:31 fwarmerdam Exp $
00003  *
00004  * Name:     cpl_string.h
00005  * Project:  CPL - Common Portability Library
00006  * Purpose:  String and StringList functions.
00007  * Author:   Daniel Morissette, danmo@videotron.ca
00008  *
00009  **********************************************************************
00010  * Copyright (c) 1998, Daniel Morissette
00011  *
00012  * Permission is hereby granted, free of charge, to any person obtaining a
00013  * copy of this software and associated documentation files (the "Software"),
00014  * to deal in the Software without restriction, including without limitation
00015  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00016  * and/or sell copies of the Software, and to permit persons to whom the
00017  * Software is furnished to do so, subject to the following conditions:
00018  * 
00019  * The above copyright notice and this permission notice shall be included
00020  * in all copies or substantial portions of the Software.
00021  * 
00022  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00023  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00024  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00025  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00026  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00027  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
00028  * DEALINGS IN THE SOFTWARE.
00029  **********************************************************************
00030  *
00031  * $Log: cpl_string.h,v $
00032  * Revision 1.18  2005/04/04 15:23:31  fwarmerdam
00033  * some functions now CPL_STDCALL
00034  *
00035  * Revision 1.17  2004/08/16 20:23:46  warmerda
00036  * added .csv escaping
00037  *
00038  * Revision 1.16  2004/07/12 21:50:38  warmerda
00039  * Added SQL escaping style
00040  *
00041  * Revision 1.15  2003/07/17 10:15:40  dron
00042  * CSLTestBoolean() added.
00043  *
00044  * Revision 1.14  2003/03/11 21:33:03  warmerda
00045  * added URL encode/decode support, untested
00046  *
00047  * Revision 1.13  2003/01/30 19:15:55  warmerda
00048  * added some docs
00049  *
00050  * Revision 1.12  2002/07/12 22:37:05  warmerda
00051  * added CSLFetchBoolean
00052  *
00053  * Revision 1.11  2002/05/28 18:53:43  warmerda
00054  * added XML escaping support
00055  *
00056  * Revision 1.10  2002/04/26 14:55:26  warmerda
00057  * Added CPLEscapeString() and CPLUnescapeString() (unescape untested)
00058  *
00059  * Revision 1.9  2002/03/05 14:26:57  warmerda
00060  * expanded tabs
00061  *
00062  * Revision 1.8  2002/01/16 03:59:28  warmerda
00063  * added CPLTokenizeString2
00064  *
00065  * Revision 1.7  2000/10/06 15:19:03  warmerda
00066  * added CPLSetNameValueSeparator
00067  *
00068  * Revision 1.6  2000/04/26 18:25:10  warmerda
00069  * implement CPL_DLL
00070  *
00071  * Revision 1.5  2000/03/30 05:38:48  warmerda
00072  * added CPLParseNameValue
00073  *
00074  * Revision 1.4  1999/06/26 14:05:19  warmerda
00075  * Added CSLFindString().
00076  *
00077  * Revision 1.3  1999/02/17 01:41:58  warmerda
00078  * Added CSLGetField
00079  *
00080  * Revision 1.2  1998/12/04 21:40:42  danmo
00081  * Added more Name=Value manipulation fuctions
00082  *
00083  * Revision 1.1  1998/12/03 18:26:02  warmerda
00084  * New
00085  *
00086  **********************************************************************/
00087 
00088 #ifndef _CPL_STRING_H_INCLUDED
00089 #define _CPL_STRING_H_INCLUDED
00090 
00091 #include "cpl_vsi.h"
00092 #include "cpl_error.h"
00093 #include "cpl_conv.h"
00094 
00113 CPL_C_START
00114 
00115 char CPL_DLL **CSLAddString(char **papszStrList, const char *pszNewString);
00116 int CPL_DLL CSLCount(char **papszStrList);
00117 const char CPL_DLL *CSLGetField( char **, int );
00118 void CPL_DLL CPL_STDCALL CSLDestroy(char **papszStrList);
00119 char CPL_DLL **CSLDuplicate(char **papszStrList);
00120 
00121 char CPL_DLL **CSLTokenizeString(const char *pszString );
00122 char CPL_DLL **CSLTokenizeStringComplex(const char *pszString,
00123                                    const char *pszDelimiter,
00124                                    int bHonourStrings, int bAllowEmptyTokens );
00125 char CPL_DLL **CSLTokenizeString2( const char *pszString, 
00126                                    const char *pszDelimeter, 
00127                                    int nCSLTFlags );
00128 
00129 #define CSLT_HONOURSTRINGS      0x0001
00130 #define CSLT_ALLOWEMPTYTOKENS   0x0002
00131 #define CSLT_PRESERVEQUOTES     0x0004
00132 #define CSLT_PRESERVEESCAPES    0x0008
00133 
00134 int CPL_DLL CSLPrint(char **papszStrList, FILE *fpOut);
00135 char CPL_DLL **CSLLoad(const char *pszFname);
00136 int CPL_DLL CSLSave(char **papszStrList, const char *pszFname);
00137 
00138 char CPL_DLL **CSLInsertStrings(char **papszStrList, int nInsertAtLineNo, 
00139                          char **papszNewLines);
00140 char CPL_DLL **CSLInsertString(char **papszStrList, int nInsertAtLineNo, 
00141                         char *pszNewLine);
00142 char CPL_DLL **CSLRemoveStrings(char **papszStrList, int nFirstLineToDelete,
00143                          int nNumToRemove, char ***ppapszRetStrings);
00144 int CPL_DLL CSLFindString( char **, const char * );
00145 int CPL_DLL CSLTestBoolean( const char *pszValue );
00146 int CPL_DLL CSLFetchBoolean( char **papszStrList, const char *pszKey, 
00147                              int bDefault );
00148 
00149 const char CPL_DLL *CPLSPrintf(char *fmt, ...);
00150 char CPL_DLL **CSLAppendPrintf(char **papszStrList, char *fmt, ...);
00151 
00152 const char CPL_DLL *
00153       CPLParseNameValue(const char *pszNameValue, char **ppszKey );
00154 const char CPL_DLL *
00155       CSLFetchNameValue(char **papszStrList, const char *pszName);
00156 char CPL_DLL **
00157       CSLFetchNameValueMultiple(char **papszStrList, const char *pszName);
00158 char CPL_DLL **
00159       CSLAddNameValue(char **papszStrList, 
00160                       const char *pszName, const char *pszValue);
00161 char CPL_DLL **
00162       CSLSetNameValue(char **papszStrList, 
00163                       const char *pszName, const char *pszValue);
00164 void CPL_DLL CSLSetNameValueSeparator( char ** papszStrList, 
00165                                        const char *pszSeparator );
00166 
00167 #define CPLES_BackslashQuotable 0
00168 #define CPLES_XML               1
00169 #define CPLES_URL               2   /* unescape only for now */
00170 #define CPLES_SQL               3
00171 #define CPLES_CSV               4
00172 
00173 char CPL_DLL *CPLEscapeString( const char *pszString, int nLength, 
00174                                int nScheme );
00175 char CPL_DLL *CPLUnescapeString( const char *pszString, int *pnLength,
00176                                  int nScheme );
00177 
00178 CPL_C_END
00179 
00180 #endif /* _CPL_STRING_H_INCLUDED */

Generated on Mon Aug 29 04:05:42 2005 for OGR by doxygen 1.3.6