source: gsdl/trunk/runtime-src/src/w32server/parse.h@ 18313

Last change on this file since 18313 was 3810, checked in by sjboddie, 21 years ago

Removed some hard string length limits in local library server code

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1/**********************************************************************
2 *
3 * parse.h
4 * Copyright (C) 1996
5 *
6 * A component of the fnord webserver written by [email protected].
7 *
8 * Altered for use with the Greenstone digital library software by the
9 * New Zealand Digital Library Project at the University of Waikato,
10 * New Zealand.
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 *
26 *********************************************************************/
27
28#include "text_t.h"
29
30/*
31Module Name: Parse
32Purpose: General string parsing. These are functions that are not in string.h,
33 but are found in many other libraries and high level languages.
34Public Functions:
35 Left
36 Right
37
38 Trim
39 TrimLeft
40 TrimRight
41
42 GetWord
43 GetLastWord
44
45 Split Path
46 GetExtention
47*/
48
49/*
50Function Name: Left
51Purpose: Copies the leftmost x number of charactors of a string to a buffer
52Parameters:
53 DestStr - Destination buffer for substring
54 SourceStr - Source string to make substing from
55 Len - Length of substring
56
57Notes: If Len is greater than strlen(SourceStr) a memory error may occur.
58*/
59void Left(char *DestStr, const char *SourceStr, const int Len);
60
61/*
62Function Name: Right
63Purpose: Copies the rightmost x number of charactors of a string to a buffer
64Parameters:
65 DestStr - Destination buffer for substring
66 SourceStr - Source string to make substing from
67 Len - Length of substring
68
69Notes: If Len is greater than strlen(SourceStr) then a memory error may
70 occur.
71*/
72void Right(char *DestStr, const char *SourceStr, const int Len);
73
74/*
75Function Name: TrimLeft
76Purpose: Removes spaces and tabs from the left end of a string.
77Parameters:
78 TargetString - String to be trimmed
79*/
80void TrimLeft(char *TargetStr);
81
82/*
83Function Name: TrimRight
84Purpose: Removes spaces and tabs from the right end of a string.
85Parameters:
86 TargetString - String to be trimmed
87*/
88void TrimRight(char *TargetStr);
89
90/*
91Function Name: Trim
92Purpose: Removes spaces and tabs from both ends of a string.
93Parameters:
94 TargetString - String to be trimmed
95*/
96void Trim(char *TargetStr);
97
98/*
99Function Name: GetWord
100Purpose: Gets leftmost substring without a space in the string between the iterators
101 'here' and 'end'. Sets 'DestStr' to the substring. Sets the 'next' iterator
102 to the next non-space charactor in the string. ' ' and '\t' and considered
103 spaces
104Parameters:
105 DestString - Destination buffer for substring
106 first - First character in source string
107 last - end iterator (one past last character) of source string
108 next - At end of function call is set to the location of next non-space
109 charactor in source string
110*/
111void GetWord(text_t &DestStr, text_t::const_iterator first,
112 text_t::const_iterator last, text_t::const_iterator &next);
113
114/*
115Function Name: GetLastWord
116Purpose: Gets rightmost substring without a space sets Start to be the first
117 character of the substring in the original string.
118Parameters:
119 DestString - Destination buffer for substring
120 first and last - Source string to make substing from
121 Start - where the DestString starts at in the source string
122*/
123void GetLastWord(text_t &DestStr, text_t::const_iterator first, text_t::const_iterator last,
124 text_t::const_iterator &Start);
125
126
127/*
128Function Name: Split Path
129Purpose: Splits a path string into directory and file name
130Parameters:
131 Path - Path string (example "c:\Fnord\SomeFile.Ext")
132 Dir - Directory part of the Path (example "c:\Fnord\")
133 FileName - File name part of the path (example "SomeFile.Ext")
134*/
135void SplitPath(char *Path, char *Dir, char *FileName);
136
137/*
138Function Name: Get Extention
139Purpose: Splits a path string into directory and file name
140Parameters:
141 Path - Path string or file name (example "c:\Fnord\SomeFile.Ext")
142 Extention - Extention part of the path (example "Ext")
143*/
144void GetExtention(char *Path, char *Extention);
145
146/*
147Function Name: Translate Escape String
148Purpose: Translates all URL escape sequences, such as "%20" where "20" is
149 the resulting charactor in hexidecimal
150Parameters:
151 TargetStr - String that may contain URL escape sequences. All sequences
152 are decoded on return.
153*/
154void TranslateEscapeString(char *TargetStr);
155
156/*
157Function Name: Hex Value
158Purpose: Returns the value of a hexidecimal digit character as an integer
159Parameters:
160 c - Charactor to translate
161*/
162int HexVal(char c);
Note: See TracBrowser for help on using the repository browser.