source: trunk/include/helpers/stringh.h@ 10

Last change on this file since 10 was 7, checked in by umoeller, 25 years ago

Initial checkin of helpers code, which used to be in WarpIN.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 7.3 KB
Line 
1/* $Id: stringh.h 7 2000-10-27 21:27:02Z umoeller $ */
2
3
4/*
5 *@@sourcefile stringh.h:
6 * header file for stringh.c. See notes there.
7 *
8 * Note: Version numbering in this file relates to XWorkplace version
9 * numbering.
10 *
11 *@@include #define INCL_DOSDATETIME
12 *@@include #include <os2.h>
13 *@@include #include "stringh.h"
14 */
15
16/*
17 * Copyright (C) 1997-2000 Ulrich M”ller.
18 * This file is part of the XWorkplace source package.
19 * XWorkplace is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published
21 * by the Free Software Foundation, in version 2 as it comes in the
22 * "COPYING" file of the XWorkplace main distribution.
23 * This program is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU General Public License for more details.
27 */
28
29#if __cplusplus
30extern "C" {
31#endif
32
33#ifndef STRINGH_HEADER_INCLUDED
34 #define STRINGH_HEADER_INCLUDED
35
36 PSZ strhdup(const char *pszSource);
37
38 PSZ strhistr(const char *string1, const char *string2);
39
40 ULONG strhncpy0(PSZ pszTarget,
41 const char *pszSource,
42 ULONG cbSource);
43
44 ULONG strhCount(const char *pszSearch, CHAR c);
45
46 BOOL strhIsDecimal(PSZ psz);
47
48 PSZ strhSubstr(const char *pBegin, const char *pEnd);
49
50 PSZ strhExtract(PSZ pszBuf,
51 CHAR cOpen,
52 CHAR cClose,
53 PSZ *ppEnd);
54
55 PSZ strhQuote(PSZ pszBuf,
56 CHAR cQuote,
57 PSZ *ppEnd);
58
59 ULONG strhStrip(PSZ psz);
60
61 ULONG strhWords(PSZ psz);
62
63 PSZ strhThousandsULong(PSZ pszTarget, ULONG ul, CHAR cThousands);
64
65 PSZ strhThousandsDouble(PSZ pszTarget, double dbl, CHAR cThousands);
66
67 VOID strhFileDate(PSZ pszBuf,
68 FDATE *pfDate,
69 ULONG ulDateFormat,
70 CHAR cDateSep);
71
72 VOID strhFileTime(PSZ pszBuf,
73 FTIME *pfTime,
74 ULONG ulTimeFormat,
75 CHAR cTimeSep);
76
77 VOID strhDateTime(PSZ pszDate,
78 PSZ pszTime,
79 DATETIME *pDateTime,
80 ULONG ulDateFormat,
81 CHAR cDateSep,
82 ULONG ulTimeFormat,
83 CHAR cTimeSep);
84
85 #define STRH_BEGIN_CHARS "\x0d\x0a "
86 #define STRH_END_CHARS "\x0d\x0a /-"
87
88 BOOL strhGetWord(PSZ *ppszStart,
89 const char *pLimit,
90 const char *pcszBeginChars,
91 const char *pcszEndChars, // = "\x0d\x0a /-";
92 PSZ *ppszEnd);
93
94 PSZ strhFindWord(const char *pszBuf,
95 const char *pszSearch,
96 const char *pcszBeginChars,
97 const char *pcszEndChars);
98
99 PSZ strhFindEOL(PSZ pszSearchIn, ULONG *pulOffset);
100
101 PSZ strhFindNextLine(PSZ pszSearchIn, PULONG pulOffset);
102
103 PSZ strhFindKey(PSZ pszSearchIn,
104 PSZ pszKey,
105 BOOL *pfIsAllUpperCase);
106
107 PSZ strhGetParameter(PSZ pszSearchIn, PSZ pszKey, PSZ pszCopyTo, ULONG cbCopyTo);
108
109 PSZ strhSetParameter(PSZ* ppszSearchIn,
110 PSZ pszKey,
111 PSZ pszNewParam,
112 BOOL fRespectCase);
113
114 BOOL strhDeleteLine(PSZ pszSearchIn, PSZ pszKey);
115
116 BOOL strhBeautifyTitle(PSZ psz);
117
118 PSZ strhFindAttribValue(const char *pszSearchIn, const char *pszAttrib);
119
120 PSZ strhGetNumAttribValue(const char *pszSearchIn,
121 const char *pszTag,
122 PLONG pl);
123
124 PSZ strhGetTextAttr(const char *pszSearchIn, const char *pszTag, PULONG pulOffset);
125
126 PSZ strhFindEndOfTag(const char *pszBeginOfTag);
127
128 ULONG strhGetBlock(const char *pszSearchIn,
129 PULONG pulSearchOffset,
130 PSZ pszTag,
131 PSZ *ppszBlock,
132 PSZ *ppszAttribs,
133 PULONG pulOfsBeginTag,
134 PULONG pulOfsBeginBlock);
135
136 /* ******************************************************************
137 * *
138 * Miscellaneous *
139 * *
140 ********************************************************************/
141
142 VOID strhArrayAppend(PSZ *ppszRoot,
143 PSZ pszNew,
144 PULONG pcbRoot);
145
146 PSZ strhCreateDump(PBYTE pb,
147 ULONG ulSize,
148 ULONG ulIndent);
149
150 /* ******************************************************************
151 * *
152 * Wildcard matching *
153 * *
154 ********************************************************************/
155
156 #define FNM_MATCH 0
157 #define FNM_NOMATCH 1
158 #define FNM_ERR 2
159
160 #define FNM_NOESCAPE 16
161 #define FNM_PATHNAME 32
162 #define FNM_PERIOD 64
163
164 #define _FNM_STYLE_MASK 15
165
166 #define _FNM_POSIX 0
167 #define _FNM_OS2 1
168 #define _FNM_DOS 2
169
170 #define _FNM_IGNORECASE 128
171 #define _FNM_PATHPREFIX 256
172
173 BOOL strhMatchOS2(const unsigned char* pcszMask, const unsigned char* pcszName);
174
175 /* ******************************************************************
176 * *
177 * Fast string searches *
178 * *
179 ********************************************************************/
180
181 char* strhfind (const char *string,
182 const char *pattern,
183 BOOL repeat_find);
184
185 char* strhfind_r (const char *string,
186 const char *pattern);
187
188 char* strhfind_rb (const char *string,
189 const char *pattern,
190 size_t *shift,
191 BOOL *repeat_find);
192
193 void* strhmemfind (const void *block,
194 size_t block_size,
195 const void *pattern,
196 size_t pattern_size,
197 BOOL repeat_find);
198
199 void* strhmemfind_r (const void *block,
200 size_t block_size,
201 const void *pattern,
202 size_t pattern_size);
203
204 void* strhmemfind_rb (const void *in_block,
205 size_t block_size,
206 const void *in_pattern,
207 size_t pattern_size,
208 size_t *shift,
209 BOOL *repeat_find);
210
211 char* strhtxtfind (const char *string,
212 const char *pattern);
213
214#endif
215
216#if __cplusplus
217}
218#endif
219
Note: See TracBrowser for help on using the repository browser.