Statistics
| Revision:

svn-gvsig-desktop / tags / v1_0_2_Build_916 / libraries / libjni-gdal / include / cpl_string.h @ 12327

History | View | Annotate | Download (7.04 KB)

1 716 igbrotru
/**********************************************************************
2
 * $Id$
3
 *
4
 * Name:     cpl_string.h
5
 * Project:  CPL - Common Portability Library
6
 * Purpose:  String and StringList functions.
7
 * Author:   Daniel Morissette, danmo@videotron.ca
8
 *
9
 **********************************************************************
10
 * Copyright (c) 1998, Daniel Morissette
11
 *
12
 * Permission is hereby granted, free of charge, to any person obtaining a
13
 * copy of this software and associated documentation files (the "Software"),
14
 * to deal in the Software without restriction, including without limitation
15
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16
 * and/or sell copies of the Software, and to permit persons to whom the
17
 * Software is furnished to do so, subject to the following conditions:
18
 *
19
 * The above copyright notice and this permission notice shall be included
20
 * in all copies or substantial portions of the Software.
21
 *
22
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
25
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
28
 * DEALINGS IN THE SOFTWARE.
29
 **********************************************************************
30
 *
31
 * $Log$
32 7765 nacho
 * Revision 1.3  2006-10-03 07:05:18  nacho
33 716 igbrotru
 * *** empty log message ***
34
 *
35 7765 nacho
 * Revision 1.1  2006/07/18 16:21:00  nacho
36
 * *** empty log message ***
37
 *
38
 * Revision 1.1  2006/06/29 16:23:27  nacho
39
 * *** empty log message ***
40
 *
41
 * Revision 1.2  2006/01/09 12:50:13  nacho
42
 * *** empty log message ***
43
 *
44 3540 nacho
 * Revision 1.1  2005/07/27 08:22:55  igbrotru
45
 * *** empty log message ***
46
 *
47
 * Revision 1.1  2004/12/28 14:06:59  igbrotru
48
 * *** empty log message ***
49
 *
50 716 igbrotru
 * Revision 1.1  2004/10/28 12:08:47  igbrotru
51
 * *** empty log message ***
52
 *
53
 * Revision 1.1  2004/09/27 08:27:48  igbrotru
54
 * *** empty log message ***
55
 *
56
 * Revision 1.1  2004/09/08 12:39:04  igbrotru
57
 * *** empty log message ***
58
 *
59
 * Revision 1.15  2003/07/17 10:15:40  dron
60
 * CSLTestBoolean() added.
61
 *
62
 * Revision 1.14  2003/03/11 21:33:03  warmerda
63
 * added URL encode/decode support, untested
64
 *
65
 * Revision 1.13  2003/01/30 19:15:55  warmerda
66
 * added some docs
67
 *
68
 * Revision 1.12  2002/07/12 22:37:05  warmerda
69
 * added CSLFetchBoolean
70
 *
71
 * Revision 1.11  2002/05/28 18:53:43  warmerda
72
 * added XML escaping support
73
 *
74
 * Revision 1.10  2002/04/26 14:55:26  warmerda
75
 * Added CPLEscapeString() and CPLUnescapeString() (unescape untested)
76
 *
77
 * Revision 1.9  2002/03/05 14:26:57  warmerda
78
 * expanded tabs
79
 *
80
 * Revision 1.8  2002/01/16 03:59:28  warmerda
81
 * added CPLTokenizeString2
82
 *
83
 * Revision 1.7  2000/10/06 15:19:03  warmerda
84
 * added CPLSetNameValueSeparator
85
 *
86
 * Revision 1.6  2000/04/26 18:25:10  warmerda
87
 * implement CPL_DLL
88
 *
89
 * Revision 1.5  2000/03/30 05:38:48  warmerda
90
 * added CPLParseNameValue
91
 *
92
 * Revision 1.4  1999/06/26 14:05:19  warmerda
93
 * Added CSLFindString().
94
 *
95
 * Revision 1.3  1999/02/17 01:41:58  warmerda
96
 * Added CSLGetField
97
 *
98
 * Revision 1.2  1998/12/04 21:40:42  danmo
99
 * Added more Name=Value manipulation fuctions
100
 *
101
 * Revision 1.1  1998/12/03 18:26:02  warmerda
102
 * New
103
 *
104
 **********************************************************************/
105
106
#ifndef _CPL_STRING_H_INCLUDED
107
#define _CPL_STRING_H_INCLUDED
108
109
#include "cpl_vsi.h"
110
#include "cpl_error.h"
111
#include "cpl_conv.h"
112
113
/**
114
 * \file cpl_string.h
115
 *
116
 * Various convenience functions for working with strings and string lists.
117
 *
118
 * A StringList is just an array of strings with the last pointer being
119
 * NULL.  An empty StringList may be either a NULL pointer, or a pointer to
120
 * a pointer memory location with a NULL value.
121
 *
122
 * A common convention for StringLists is to use them to store name/value
123
 * lists.  In this case the contents are treated like a dictionary of
124
 * name/value pairs.  The actual data is formatted with each string having
125
 * the format "<name>:<value>" (though "=" is also an acceptable separator).
126
 * A number of the functions in the file operate on name/value style
127
 * string lists (such as CSLSetNameValue(), and CSLFetchNameValue()).
128
 *
129
 */
130
131
CPL_C_START
132
133
char CPL_DLL **CSLAddString(char **papszStrList, const char *pszNewString);
134
int CPL_DLL CSLCount(char **papszStrList);
135
const char CPL_DLL *CSLGetField( char **, int );
136
void CPL_DLL CSLDestroy(char **papszStrList);
137
char CPL_DLL **CSLDuplicate(char **papszStrList);
138
139
char CPL_DLL **CSLTokenizeString(const char *pszString );
140
char CPL_DLL **CSLTokenizeStringComplex(const char *pszString,
141
                                   const char *pszDelimiter,
142
                                   int bHonourStrings, int bAllowEmptyTokens );
143
char CPL_DLL **CSLTokenizeString2( const char *pszString,
144
                                   const char *pszDelimeter,
145
                                   int nCSLTFlags );
146
147
#define CSLT_HONOURSTRINGS      0x0001
148
#define CSLT_ALLOWEMPTYTOKENS   0x0002
149
#define CSLT_PRESERVEQUOTES     0x0004
150
#define CSLT_PRESERVEESCAPES    0x0008
151
152
int CPL_DLL CSLPrint(char **papszStrList, FILE *fpOut);
153
char CPL_DLL **CSLLoad(const char *pszFname);
154
int CPL_DLL CSLSave(char **papszStrList, const char *pszFname);
155
156
char CPL_DLL **CSLInsertStrings(char **papszStrList, int nInsertAtLineNo,
157
                         char **papszNewLines);
158
char CPL_DLL **CSLInsertString(char **papszStrList, int nInsertAtLineNo,
159
                        char *pszNewLine);
160
char CPL_DLL **CSLRemoveStrings(char **papszStrList, int nFirstLineToDelete,
161
                         int nNumToRemove, char ***ppapszRetStrings);
162
int CPL_DLL CSLFindString( char **, const char * );
163
int CPL_DLL CSLTestBoolean( const char *pszValue );
164
int CPL_DLL CSLFetchBoolean( char **papszStrList, const char *pszKey,
165
                             int bDefault );
166
167
const char CPL_DLL *CPLSPrintf(char *fmt, ...);
168
char CPL_DLL **CSLAppendPrintf(char **papszStrList, char *fmt, ...);
169
170
const char CPL_DLL *
171
      CPLParseNameValue(const char *pszNameValue, char **ppszKey );
172
const char CPL_DLL *
173
      CSLFetchNameValue(char **papszStrList, const char *pszName);
174
char CPL_DLL **
175
      CSLFetchNameValueMultiple(char **papszStrList, const char *pszName);
176
char CPL_DLL **
177
      CSLAddNameValue(char **papszStrList,
178
                      const char *pszName, const char *pszValue);
179
char CPL_DLL **
180
      CSLSetNameValue(char **papszStrList,
181
                      const char *pszName, const char *pszValue);
182
void CPL_DLL CSLSetNameValueSeparator( char ** papszStrList,
183
                                       const char *pszSeparator );
184
185
#define CPLES_BackslashQuotable 0
186
#define CPLES_XML               1
187
#define CPLES_URL               2   /* unescape only for now */
188
189
char CPL_DLL *CPLEscapeString( const char *pszString, int nLength,
190
                               int nScheme );
191
char CPL_DLL *CPLUnescapeString( const char *pszString, int *pnLength,
192
                                 int nScheme );
193
194
CPL_C_END
195
196
#endif /* _CPL_STRING_H_INCLUDED */