1 /*
2 Copyright (C) 2015-2021, Dirk Krause
3 SPDX-License-Identifier: BSD-3-Clause
4 */
5 
6 /*
7 	WARNING: This file was generated by the dkct program (see
8 	http://dktools.sourceforge.net/ for details).
9 	Changes you make here will be lost if dkct is run again!
10 	You should modify the original source and run dkct on it.
11 	Original source: dk4recwx.cpt
12 */
13 
14 #ifndef DK4RECWX_H_INCLUDED
15 /** Avoid multiple inclusions. */
16 #define DK4RECWX_H_INCLUDED 1
17 
18 
19 /**	@file	dk4recwx.h	Recoding with wxChar.
20 */
21 
22 #ifndef DK4CONF_H_INCLUDED
23 #if DK4_BUILDING_DKTOOLS4
24 #include "dk4conf.h"
25 #else
26 #include <dktools-4/dk4conf.h>
27 #endif
28 #endif
29 
30 #ifndef	DK4_SIZEOF_WXCHAR
31 #ifndef	DK4WXCS_H_INCLUDED
32 #if DK4_BUILDING_DKTOOLS4
33 #include "dk4wxcs.h"
34 #else
35 #include <dktools-4/dk4wxcs.h>
36 #endif
37 #endif
38 #endif
39 
40 #ifndef DK4TYPES_H_INCLUDED
41 #if DK4_BUILDING_DKTOOLS4
42 #include <libdk4base/dk4types.h>
43 #else
44 #include <dktools-4/dk4types.h>
45 #endif
46 #endif
47 
48 #ifndef DK4CONST_H_INCLUDED
49 #if DK4_BUILDING_DKTOOLS4
50 #include <libdk4base/dk4const.h>
51 #else
52 #include <dktools-4/dk4const.h>
53 #endif
54 #endif
55 
56 #ifndef DK4ERROR_H_INCLUDED
57 #if DK4_BUILDING_DKTOOLS4
58 #include <libdk4base/dk4error.h>
59 #else
60 #include <dktools-4/dk4error.h>
61 #endif
62 #endif
63 
64 #ifndef DK4WXCS_H_INCLUDED
65 #if DK4_BUILDING_DKTOOLS4
66 #include "dk4wxcs.h"
67 #else
68 #include <dktools-4/dk4wxcs.h>
69 #endif
70 #endif
71 
72 #if DK4_SIZEOF_WXCHAR == DK4_CHAR_SIZE
73 #ifndef DK4STRD_H_INCLUDED
74 #if DK4_BUILDING_DKTOOLS4
75 #include <libdk4base/dk4strd.h>
76 #else
77 #include <dktools-4/dk4strd.h>
78 #endif
79 #endif
80 #endif
81 
82 
83 #ifndef	WX_WXPREC_H_INCLUDED
84 #include <wx/wxprec.h>
85 #define	WX_WXPREC_H_INCLUDED 1
86 #endif
87 #ifdef __BORLANDC__
88 #pragma hdrstop
89 #endif
90 #ifndef WX_PRECOMP
91 #if	DK4_HAVE_WX_CHARTYPE_H
92 #if	DK4_HAVE_WX_DEFS_H
93 #ifndef	WX_DEFS_H_INCLUDED
94 #include <wx/defs.h>
95 #define	WX_DEFS_H_INCLUDED
96 #endif
97 #endif
98 #ifndef	WX_CHARTYPE_H_INCLUDED
99 #include <wx/chartype.h>
100 #define	WX_CHARTYPE_H_INCLUDED 1
101 #endif
102 #else
103 #if	DK4_HAVE_WX_WXCHAR_H
104 #if	DK4_HAVE_WX_DEFS_H
105 #ifndef	WX_DEFS_H_INCLUDED
106 #include <wx/defs.h>
107 #define	WX_DEFS_H_INCLUDED
108 #endif
109 #endif
110 #ifndef	WX_WXCHAR_H_INCLUDED
111 #include <wx/wxchar.h>
112 #define	WX_WXCHAR_H_INCLUDED 1
113 #endif
114 #else
115 #ifndef	WX_WX_H_INCLUDED
116 #include <wx/wx.h>
117 #define	WX_WX_H_INCLUDED
118 #endif
119 #endif
120 #endif
121 #endif
122 
123 #ifdef __cplusplus
124 extern "C" {
125 #endif
126 
127 /**	Convert UTF-8 encoded char string to wxChar.
128 	@param	dptr	Destination buffer pointer.
129 	@param	dsz	Size of destination buffer (number of wxChar).
130 	@param	sptr	Source string pointer.
131 	@param	erp	Error report, may be NULL.
132 	@return	1 on success, 0 on error.
133 
134 	Error codes:
135 	- DK4_E_INVALID_ARGUMENTS<br>
136 	  if dptr or sptr is NULL or dsz is 0,
137 	- DK4_E_BUFFER_TOO_SMALL<br>
138 	  if the destination buffer is too small,
139 	- DK4_E_SYNTAX<br>
140 	  if the source string can not be decoded properly.
141 */
142 int
143 dk4recwx_utf8_to_wxchar(
144   wxChar	*dptr,
145   size_t	 dsz,
146   const char	*sptr,
147   dk4_er_t	*erp
148 );
149 
150 /**	Convert dkChar string to wxChar.
151 	@param	dptr	Destination buffer pointer.
152 	@param	dsz	Size of destination buffer (number of wxChar).
153 	@param	de	Encoding for wxChar strings.
154 	@param	sptr	Source string pointer.
155 	@param	se	Source string encoding.
156 	@param	erp	Error report, may be NULL.
157 	@return	1 on success, 0 on error.
158 
159 	Error codes:
160 	- DK4_E_INVALID_ARGUMENTS<br>
161 	  if dptr or sptr is NULL or dsz is 0,
162 	- DK4_E_BUFFER_TOO_SMALL<br>
163 	  if the destination buffer is too small,
164 	- DK4_E_SYNTAX<br>
165 	  if the source string can not be decoded properly.
166 */
167 int
168 dk4recwx_dkchar_to_wxchar(
169   wxChar	*dptr,
170   size_t	 dsz,
171   int		 de,
172   const dkChar	*sptr,
173   int		 se,
174   dk4_er_t	*erp
175 );
176 
177 /**	Convert wxChar string to dkChar.
178 	@param	dptr	Destination buffer pointer.
179 	@param	dsz	Size of destination buffer (number of dkChar).
180 	@param	de	Encoding for dkChar strings.
181 	@param	sptr	Source string pointer.
182 	@param	se	Source string encoding.
183 	@param	erp	Error report, may be NULL.
184 	@return	1 on success, 0 on error.
185 
186 	Error codes:
187 	- DK4_E_INVALID_ARGUMENTS<br>
188 	  if dptr or sptr is NULL or dsz is 0,
189 	- DK4_E_BUFFER_TOO_SMALL<br>
190 	  if the destination buffer is too small,
191 	- DK4_E_SYNTAX<br>
192 	  if the source string can not be decoded properly.
193 */
194 int
195 dk4recwx_wxchar_to_dkchar(
196   dkChar	*dptr,
197   size_t	 dsz,
198   int		 de,
199   const wxChar	*sptr,
200   int		 se,
201   dk4_er_t	*erp
202 );
203 
204 /**	Convert wxChar string to char.
205 	@param	dptr	Destination buffer pointer.
206 	@param	dsz	Size of destination buffer.
207 	@param	de	Encoding for char strings.
208 	@param	sptr	Source string pointer.
209 	@param	se	Source string encoding.
210 	@param	erp	Error report, may be NULL.
211 	@return	1 on success, 0 on error.
212 
213 	Error codes:
214 	- DK4_E_INVALID_ARGUMENTS<br>
215 	  if dptr or sptr is NULL or dsz is 0,
216 	- DK4_E_BUFFER_TOO_SMALL<br>
217 	  if the destination buffer is too small,
218 	- DK4_E_SYNTAX<br>
219 	  if the source string can not be decoded properly.
220 */
221 int
222 dk4recwx_wxchar_to_char(
223   char		*dptr,
224   size_t	 dsz,
225   int		 de,
226   const wxChar	*sptr,
227   int		 se,
228   dk4_er_t	*erp
229 );
230 
231 /**	Convert wxChar to unsigned long.
232 	@param	wxc	Character to convert.
233 	@return	Conversion result.
234 */
235 unsigned long
236 dk4recwx_wxchar_to_ul(wxChar wxc);
237 
238 #ifdef __cplusplus
239 }
240 #endif
241 
242 
243 #endif
244