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

Last change on this file since 611 was 611, checked in by sjboddie, 25 years ago

initial commit of windows server code

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