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

Last change on this file since 55 was 45, checked in by umoeller, 24 years ago

Misc. changes.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 7.5 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 XSTRING *pstrReplaceWith);
119 typedef ULONG XWPENTRY XSTRRPL(PXSTRING pxstr,
120 ULONG ulFirstReplOfs,
121 ULONG cReplLen,
122 const XSTRING *pstrReplaceWith);
123 typedef XSTRRPL *PXSTRRPL;
124
125 PSZ XWPENTRY xstrFindWord(const XSTRING *pxstr,
126 ULONG ulOfs,
127 const XSTRING *pstrFind,
128 size_t *pShiftTable,
129 PBOOL pfRepeatFind,
130 const char *pcszBeginChars,
131 const char *pcszEndChars);
132 typedef PSZ XWPENTRY XSTRFINDWORD(const XSTRING *pxstr,
133 ULONG ulOfs,
134 const XSTRING *pstrFind,
135 size_t *pShiftTable,
136 PBOOL pfRepeatFind,
137 const char *pcszBeginChars,
138 const char *pcszEndChars);
139 typedef XSTRFINDWORD *PXSTRFINDWORD;
140
141 ULONG XWPENTRY xstrFindReplace(PXSTRING pxstr,
142 PULONG pulOfs,
143 const XSTRING *pstrSearch,
144 const XSTRING *pstrReplace,
145 size_t *pShiftTable,
146 PBOOL pfRepeatFind);
147 typedef ULONG XWPENTRY XSTRFINDREPLACE(PXSTRING pxstr,
148 PULONG pulOfs,
149 const XSTRING *pstrSearch,
150 const XSTRING *pstrReplace,
151 size_t *pShiftTable,
152 PBOOL pfRepeatFind);
153 typedef XSTRFINDREPLACE *PXSTRFINDREPLACE;
154
155 ULONG XWPENTRY xstrFindReplaceC(PXSTRING pxstr,
156 PULONG pulOfs,
157 const char *pcszSearch,
158 const char *pcszReplace);
159 typedef ULONG XWPENTRY XSTRFINDREPLACEC(PXSTRING pxstr,
160 PULONG pulOfs,
161 const char *pcszSearch,
162 const char *pcszReplace);
163 typedef XSTRFINDREPLACEC *PXSTRFINDREPLACEC;
164
165 ULONG XWPENTRY xstrEncode(PXSTRING pxstr, const char *pcszEncode);
166 typedef ULONG XWPENTRY XSTRENCODE(PXSTRING pxstr, const char *pcszEncode);
167 typedef XSTRENCODE *PXSTRENCODE;
168
169 ULONG XWPENTRY xstrDecode(PXSTRING pxstr);
170 typedef ULONG XWPENTRY XSTRDECODE(PXSTRING pxstr);
171 typedef XSTRDECODE *PXSTRDECODE;
172
173 // V0.9.9 (2001-01-29) [lafaix]: constants added
174 #define CRLF2LF TRUE
175 #define LF2CRLF FALSE
176
177 VOID XWPENTRY xstrConvertLineFormat(PXSTRING pxstr, BOOL fToCFormat);
178 typedef VOID XWPENTRY XSTRCONVERTLINEFORMAT(PXSTRING pxstr, BOOL fToCFormat);
179 typedef XSTRCONVERTLINEFORMAT *PXSTRCONVERTLINEFORMAT;
180
181#endif
182
183#if __cplusplus
184}
185#endif
186
Note: See TracBrowser for help on using the repository browser.