source: trunk/include/helpers/xstring.h@ 73

Last change on this file since 73 was 64, checked in by umoeller, 24 years ago

Sources as for V0.9.11.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 7.6 KB
Line 
1
2/*
3 *@@sourcefile xstring.h:
4 * header file for xstring.c. See notes there.
5 *
6 * Note: Version numbering in this file relates to XWorkplace version
7 * numbering.
8 *
9 *@@include #define INCL_DOSDATETIME
10 *@@include #include <os2.h>
11 *@@include #include "xstring.h"
12 */
13
14/*
15 * Copyright (C) 1999-2000 Ulrich M”ller.
16 * This file is part of the "XWorkplace helpers" source package.
17 * This is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License as published
19 * by the Free Software Foundation, in version 2 as it comes in the
20 * "COPYING" file of the XWorkplace main distribution.
21 * This program is distributed in the hope that it will be useful,
22 * but WITHOUT ANY WARRANTY; without even the implied warranty of
23 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 * GNU General Public License for more details.
25 */
26
27#if __cplusplus
28extern "C" {
29#endif
30
31#ifndef XSTRING_HEADER_INCLUDED
32 #define XSTRING_HEADER_INCLUDED
33
34 #ifndef XWPENTRY
35 #error You must define XWPENTRY to contain the standard linkage for the XWPHelpers.
36 #endif
37
38 /*
39 *@@ XSTRING:
40 *
41 *@@added V0.9.6 (2000-11-01) [umoeller]
42 */
43
44 typedef struct _XSTRING
45 {
46 PSZ psz; // ptr to string or NULL
47 ULONG ulLength; // length of *psz
48 ULONG cbAllocated; // memory allocated in *psz
49 // (>= ulLength + 1)
50 ULONG ulDelta; // allocation delta (0 = none)
51 // V0.9.9 (2001-03-07) [umoeller]
52 } XSTRING, *PXSTRING;
53
54 void XWPENTRY xstrInit(PXSTRING pxstr, ULONG ulPreAllocate);
55 typedef void XWPENTRY XSTRINIT(PXSTRING pxstr, ULONG ulPreAllocate);
56 typedef XSTRINIT *PXSTRINIT;
57
58 void XWPENTRY xstrInitSet(PXSTRING pxstr, PSZ pszNew);
59 typedef void XWPENTRY XSTRINITSET(PXSTRING pxstr, PSZ pszNew);
60 typedef XSTRINITSET *PXSTRINITSET;
61
62 void XWPENTRY xstrInitCopy(PXSTRING pxstr, const char *pcszSource, ULONG ulExtraAllocate);
63 typedef void XWPENTRY XSTRINITCOPY(PXSTRING pxstr, const char *pcszSource, ULONG ulExtraAllocate);
64 typedef XSTRINITCOPY *PXSTRINITCOPY;
65
66 void XWPENTRY xstrClear(PXSTRING pxstr);
67 typedef void XWPENTRY XSTRCLEAR(PXSTRING pxstr);
68 typedef XSTRCLEAR *PXSTRCLEAR;
69
70 ULONG XWPENTRY xstrReserve(PXSTRING pxstr, ULONG ulBytes);
71 typedef ULONG XWPENTRY XSTRRESERVE(PXSTRING pxstr, ULONG ulBytes);
72 typedef XSTRRESERVE *PXSTRRESERVE;
73
74 PXSTRING XWPENTRY xstrCreate(ULONG ulPreAllocate);
75 typedef PXSTRING XWPENTRY XSTRCREATE(ULONG ulPreAllocate);
76 typedef XSTRCREATE *PXSTRCREATE;
77
78 VOID XWPENTRY xstrFree(PXSTRING pxstr);
79 typedef VOID XWPENTRY XSTRFREE(PXSTRING pxstr);
80 typedef XSTRFREE *PXSTRFREE;
81
82 ULONG XWPENTRY xstrset(PXSTRING pxstr, PSZ pszNew);
83 typedef ULONG XWPENTRY XSTRSET(PXSTRING pxstr, PSZ pszNew);
84 typedef XSTRSET *PXSTRSET;
85
86 ULONG XWPENTRY xstrcpy(PXSTRING pxstr, const char *pcszSource, ULONG ulSourceLength);
87 typedef ULONG XWPENTRY XSTRCPY(PXSTRING pxstr, const char *pcszSource, ULONG ulSourceLength);
88 typedef XSTRCPY *PXSTRCPY;
89
90 ULONG XWPENTRY xstrcpys(PXSTRING pxstr, const XSTRING *pcstrSource);
91 typedef ULONG XWPENTRY XSTRCPYS(PXSTRING pxstr, const XSTRING *pcstrSource);
92 typedef XSTRCPYS *PXSTRCPYS;
93
94 ULONG XWPENTRY xstrcat(PXSTRING pxstr, const char *pcszSource, ULONG ulSourceLength);
95 typedef ULONG XWPENTRY XSTRCAT(PXSTRING pxstr, const char *pcszSource, ULONG ulSourceLength);
96 typedef XSTRCAT *PXSTRCAT;
97
98 ULONG XWPENTRY xstrcatc(PXSTRING pxstr, CHAR c);
99 typedef ULONG XWPENTRY XSTRCATC(PXSTRING pxstr, CHAR c);
100 typedef XSTRCATC *PXSTRCATC;
101
102 ULONG XWPENTRY xstrcats(PXSTRING pxstr, const XSTRING *pcstrSource);
103 typedef ULONG XWPENTRY XSTRCATS(PXSTRING pxstr, const XSTRING *pcstrSource);
104 typedef XSTRCATS *PXSTRCATS;
105
106 /*
107 *@@ xstrIsString:
108 * returns TRUE if psz contains something.
109 *
110 *@@added V0.9.6 (2000-10-16) [umoeller]
111 */
112
113 #define xstrIsString(psz) ( (psz != 0) && (*(psz) != 0) )
114
115 ULONG XWPENTRY xstrrpl(PXSTRING pxstr,
116 ULONG ulFirstReplOfs,
117 ULONG cReplLen,
118 const char *pcszReplaceWith,
119 ULONG cReplaceWithLen);
120 typedef ULONG XWPENTRY XSTRRPL(PXSTRING pxstr,
121 ULONG ulFirstReplOfs,
122 ULONG cReplLen,
123 const char *pcszReplaceWith,
124 ULONG cReplaceWithLen);
125 typedef XSTRRPL *PXSTRRPL;
126
127 PSZ XWPENTRY xstrFindWord(const XSTRING *pxstr,
128 ULONG ulOfs,
129 const XSTRING *pstrFind,
130 size_t *pShiftTable,
131 PBOOL pfRepeatFind,
132 const char *pcszBeginChars,
133 const char *pcszEndChars);
134 typedef PSZ XWPENTRY XSTRFINDWORD(const XSTRING *pxstr,
135 ULONG ulOfs,
136 const XSTRING *pstrFind,
137 size_t *pShiftTable,
138 PBOOL pfRepeatFind,
139 const char *pcszBeginChars,
140 const char *pcszEndChars);
141 typedef XSTRFINDWORD *PXSTRFINDWORD;
142
143 ULONG XWPENTRY xstrFindReplace(PXSTRING pxstr,
144 PULONG pulOfs,
145 const XSTRING *pstrSearch,
146 const XSTRING *pstrReplace,
147 size_t *pShiftTable,
148 PBOOL pfRepeatFind);
149 typedef ULONG XWPENTRY XSTRFINDREPLACE(PXSTRING pxstr,
150 PULONG pulOfs,
151 const XSTRING *pstrSearch,
152 const XSTRING *pstrReplace,
153 size_t *pShiftTable,
154 PBOOL pfRepeatFind);
155 typedef XSTRFINDREPLACE *PXSTRFINDREPLACE;
156
157 ULONG XWPENTRY xstrFindReplaceC(PXSTRING pxstr,
158 PULONG pulOfs,
159 const char *pcszSearch,
160 const char *pcszReplace);
161 typedef ULONG XWPENTRY XSTRFINDREPLACEC(PXSTRING pxstr,
162 PULONG pulOfs,
163 const char *pcszSearch,
164 const char *pcszReplace);
165 typedef XSTRFINDREPLACEC *PXSTRFINDREPLACEC;
166
167 ULONG XWPENTRY xstrEncode(PXSTRING pxstr, const char *pcszEncode);
168 typedef ULONG XWPENTRY XSTRENCODE(PXSTRING pxstr, const char *pcszEncode);
169 typedef XSTRENCODE *PXSTRENCODE;
170
171 ULONG XWPENTRY xstrDecode(PXSTRING pxstr);
172 typedef ULONG XWPENTRY XSTRDECODE(PXSTRING pxstr);
173 typedef XSTRDECODE *PXSTRDECODE;
174
175 // V0.9.9 (2001-01-29) [lafaix]: constants added
176 #define CRLF2LF TRUE
177 #define LF2CRLF FALSE
178
179 VOID XWPENTRY xstrConvertLineFormat(PXSTRING pxstr, BOOL fToCFormat);
180 typedef VOID XWPENTRY XSTRCONVERTLINEFORMAT(PXSTRING pxstr, BOOL fToCFormat);
181 typedef XSTRCONVERTLINEFORMAT *PXSTRCONVERTLINEFORMAT;
182
183#endif
184
185#if __cplusplus
186}
187#endif
188
Note: See TracBrowser for help on using the repository browser.