source: trunk/gsdl/src/w32server/parse.h@ 2286

Last change on this file since 2286 was 2286, checked in by sjboddie, 23 years ago

Had a bit of a tidy up in the fnord webserver code. The main change of note
was the removal of our reliance on the MAX_URL_SIZE constant. URLs and post
data of any length should now work.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.7 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/*
29Module Name: Parse
30Purpose: General string parsing. These are functions that are not in string.h,
31 but are found in many other libraries and high level languages.
32Public Functions:
33 Left
34 Right
35
36 Trim
37 TrimLeft
38 TrimRight
39
40 GetWord
41 GetLastWord
42
43 Split Path
44 GetExtention
45*/
46
47/*
48Function Name: Left
49Purpose: Copies the leftmost x number of charactors of a string to a buffer
50Parameters:
51 DestStr - Destination buffer for substring
52 SourceStr - Source string to make substing from
53 Len - Length of substring
54
55Notes: If Len is greater than strlen(SourceStr) a memory error may occur.
56*/
57void Left(char *DestStr, const char *SourceStr, const int Len);
58
59/*
60Function Name: Right
61Purpose: Copies the rightmost x number of charactors of a string to a buffer
62Parameters:
63 DestStr - Destination buffer for substring
64 SourceStr - Source string to make substing from
65 Len - Length of substring
66
67Notes: If Len is greater than strlen(SourceStr) then a memory error may
68 occur.
69*/
70void Right(char *DestStr, const char *SourceStr, const int Len);
71
72/*
73Function Name: TrimLeft
74Purpose: Removes spaces and tabs from the left end of a string.
75Parameters:
76 TargetString - String to be trimmed
77*/
78void TrimLeft(char *TargetStr);
79
80/*
81Function Name: TrimRight
82Purpose: Removes spaces and tabs from the right end of a string.
83Parameters:
84 TargetString - String to be trimmed
85*/
86void TrimRight(char *TargetStr);
87
88/*
89Function Name: Trim
90Purpose: Removes spaces and tabs from both ends of a string.
91Parameters:
92 TargetString - String to be trimmed
93*/
94void Trim(char *TargetStr);
95
96/*
97Function Name: GetWord
98Purpose: Gets leftmost substring without a space, starts at any position at
99 the start string and sets End to be the next non-space charactor in the
100 string. ' ' and '\t' and considered spaces
101Parameters:
102 DestString - Destination buffer for substring
103 SourceString - Source string to make substing from
104 Start - 0 based string index to start at
105 End - At end of function call is set to the location of next non-space
106 charactor
107
108Notes: If Start is greater than strlen(SourceStr) then a memory error may
109 occur.
110*/
111void GetWord(char *DestStr, const char *SourceStr,
112 const int Start, int &End);
113
114/*
115Function Name: GetLastWord
116Purpose: Gets rightmost substring without a space sets Start to be the 0 based
117 index of where the substring starts in the original string.
118Parameters:
119 DestString - Destination buffer for substring
120 SourceString - Source string to make substing from
121 Start - 0 based string index where the DestString starts at
122*/
123void GetLastWord(char *DestString, const char *SourceStr, int &Start);
124
125
126/*
127Function Name: Split Path
128Purpose: Splits a path string into directory and file name
129Parameters:
130 Path - Path string (example "c:\Fnord\SomeFile.Ext")
131 Dir - Directory part of the Path (example "c:\Fnord\")
132 FileName - File name part of the path (example "SomeFile.Ext")
133*/
134void SplitPath(char *Path, char *Dir, char *FileName);
135
136/*
137Function Name: Get Extention
138Purpose: Splits a path string into directory and file name
139Parameters:
140 Path - Path string or file name (example "c:\Fnord\SomeFile.Ext")
141 Extention - Extention part of the path (example "Ext")
142*/
143void GetExtention(char *Path, char *Extention);
144
145/*
146Function Name: Translate Escape String
147Purpose: Translates all URL escape sequences, such as "%20" where "20" is
148 the resulting charactor in hexidecimal
149Parameters:
150 TargetStr - String that may contain URL escape sequences. All sequences
151 are decoded on return.
152*/
153void TranslateEscapeString(char *TargetStr);
154
155/*
156Function Name: Hex Value
157Purpose: Returns the value of a hexidecimal digit character as an integer
158Parameters:
159 c - Charactor to translate
160*/
161int HexVal(char c);
Note: See TracBrowser for help on using the repository browser.