]> git.saurik.com Git - wxWidgets.git/blame - include/wx/wxchar.h
Fixed the "Can't open file" message in ReadDIB so that it actually
[wxWidgets.git] / include / wx / wxchar.h
CommitLineData
e35d0039
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: wxchar.h
3// Purpose: Declarations common to wx char/wchar_t usage (wide chars)
4// Author: Joel Farley
5// Modified by:
6// Created: 1998/06/12
7// RCS-ID: $Id$
8// Copyright: (c) wxWindows copyright
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_WXCHAR_H_
13#define _WX_WXCHAR_H_
14
15#ifdef __GNUG__
16#pragma interface "wxchar.h"
17#endif
18
19// only do SBCS or _UNICODE
20#if defined (_MBCS )
21#error "MBCS is not supported by wxChar"
22#endif
23
24// only do Unicode for Windows (VC++), for now
3f4a0c5b 25#if defined(__VISUALC__) && defined(__WIN32__)
e35d0039
JS
26
27#include <tchar.h>
28typedef _TCHAR wxChar;
3f4a0c5b 29typedef _TSCHAR wxSChar;
e35d0039
JS
30typedef _TUCHAR wxUChar;
31
32 // ctype.h functions
33#define wxIsalnum _istalnum
34#define wxIsalpha _istalpha
35#define wxIsctrl _istctrl
36#define wxIsdigit _istdigit
37#define wxIsgraph _istgraph
38#define wxIslower _istlower
39#define wxIsprint _istprint
40#define wxIspunct _istpunct
41#define wxIsspace _istspace
42#define wxIsupper _istupper
43#define wxIsxdigit _istxdigit
44#define wxTolower _totlower
45#define wxToupper _totupper
46
47 // locale.h functons
48#define wxSetlocale _tsetlocale
49
50 // string.h functions
51#define wxStrcat _tcscat
52#define wxStrchr _tcschr
53#define wxStrcmp _tcscmp
54#define wxStrcoll _tcscoll
55#define wxStrcpy _tcscpy
56#define wxStrcspn _tcscspn
57#define wxStrftime _tcsftime
58#define wxStrncat _tcsncat
59#define wxStrncmp _tcsncmp
60#define wxStrncpy _tcsncpy
61#define wxStrpbrk _tcspbrk
62#define wxStrrchr _tcsrchr
63#define wxStrspn _tcsspn
64#define wxStrstr _tcsstr
65#define wxStrtod _tcstod
66#define wxStrtok _tcstok
67#define wxStrtol _tcstol
68#define wxStrtoul _tcstoul
69#define wxStrxfrm _tcsxfrm
70
71 // stdio.h functions
72#define wxFgetc _fgettc
73#define wxFgetchar _fgettchar
74#define wxFgets _fgetts
75#define wxFopen _tfopen
76#define wxFputc _fputtc
77#define wxFputchar _fputtchar
78#define wxFprintf _ftprintf
79#define wxFreopen _tfreopen
80#define wxFscanf _ftscanf
81#define wxGetc _gettc
82#define wxGetchar _gettchar
83#define wxGets _getts
84#define wxPerror _tperror
85#define wxPrintf _tprintf
86#define wxPutc _puttc
87#define wxPutchar _puttchar
88#define wxPuts _putts
89#define wxRemove _tremove
90#define wxRename _trename
91#define wxScanf _tscanf
92#define wxSprintf _stprintf
93#define wxSscanf _stscanf
94#define wxTmpnam _ttmpnam
95#define wxUngetc _tungetc
96#define wxVfprint _vftprintf
97#define wxVprintf _vtprintf
98#define wxVsprintf _vstprintf
99
100 // stdlib.h functions
101#define wxAtoi _ttoi
102#define wxAtol _ttol
103#define wxGetenv _tgetenv
104#define wxSystem _tsystem
105
106 // time.h functions
107#define wxAsctime _tasctime
108#define wxCtime _tctime
109
110// #elif defined(XXX)
111 // #include XXX-specific files here
112 // typeddef YYY wxChar;
113
114 // translate wxZZZ names
115
116#else//!Unicode
117
118// make sure we aren't doing Unicode
119#if defined ( __WXUNICODE__ ) || defined ( _UNICODE )
120#error "Please define your compiler's Unicode conventions in wxChar.h"
121#endif
122
3f4a0c5b
VZ
123typedef char wxChar;
124typedef signed char wxSChar;
125typedef unsigned char wxUChar;
e35d0039 126
3f4a0c5b 127#define _T(x) x
e35d0039
JS
128
129 // ctype.h functions
130#define wxIsalnum isalnum
131#define wxIsalpha isalpha
132#define wxIsctrl isctrl
133#define wxIsdigit isdigit
134#define wxIsgraph isgraph
135#define wxIslower islower
136#define wxIsprint isprint
137#define wxIspunct ispunct
138#define wxIsspace isspace
139#define wxIsupper isupper
140#define wxIsxdigit isxdigit
141#define wxTolower tolower
142#define wxToupper toupper
143
144 // locale.h functons
145#define wxSetlocale setlocale
146
147 // string.h functions
148#define wxStrcat strcat
149#define wxStrchr strchr
150#define wxStrcmp strcmp
151#define wxStrcoll strcoll
152#define wxStrcpy strcpy
153#define wxStrcspn strcspn
154#define wxStrftime strftime
155#define wxStrncat strncat
156#define wxStrncmp strncmp
157#define wxStrncpy strncpy
158#define wxStrpbrk strpbrk
159#define wxStrrchr strrchr
160#define wxStrspn strspn
161#define wxStrstr strstr
162#define wxStrtod strtod
163#define wxStrtok strtok
164#define wxStrtol strtol
165#define wxStrtoul strtoul
166#define wxStrxfrm strxfrm
167
168 // stdio.h functions
169#define wxFgetc fgetc
170#define wxFgetchar fgetchar
171#define wxFgets fgets
172#define wxFopen fopen
173#define wxFputc fputc
174#define wxFputchar fputchar
175#define wxFprintf fprintf
176#define wxFreopen freopen
177#define wxFscanf fscanf
178#define wxGetc getc
179#define wxGetchar getchar
180#define wxGets gets
181#define wxPerror perror
182#define wxPrintf printf
183#define wxPutc putc
184#define wxPutchar putchar
185#define wxPuts puts
186#define wxRemove remove
187#define wxRename rename
188#define wxScanf scanf
189#define wxSprintf sprintf
190#define wxSscanf sscanf
191#define wxTmpnam tmpnam
192#define wxUngetc ungetc
193#define wxVfprint vfprintf
194#define wxVprintf vprintf
195#define wxVsprintf vsprintf
196
197 // stdlib.h functions
198#define wxAtoi atoi
199#define wxAtol atol
200#define wxGetenv getenv
201#define wxSystem system
202
203 // time.h functions
204#define wxAsctime asctime
205#define wxCtime ctime
206
207#endif//Unicode
208
209
210/// checks whether the passed in pointer is NULL and if the string is empty
211inline bool WXDLLEXPORT wxIsEmpty(const wxChar *p) { return !p || !*p; }
212
213/// safe version of strlen() (returns 0 if passed NULL pointer)
214inline size_t WXDLLEXPORT wxStrlen(const wxChar *psz)
3f4a0c5b 215#if defined(__VISUALC__)
e35d0039
JS
216 { return psz ? _tcslen(psz) : 0; }
217#else
218 { return psz ? strlen(psz) : 0; }
219#endif
220
221/// portable strcasecmp/_stricmp
222inline int WXDLLEXPORT wxStricmp(const wxChar *, const wxChar *)
3f4a0c5b 223#if defined(__VISUALC__)
e35d0039
JS
224 { return _tcsicmp(psz1, psz2); }
225#elif defined(__BORLANDC__)
226 { return stricmp(psz1, psz2); }
227#elif defined(__UNIX__) || defined(__GNUWIN32__)
228 { return strcasecmp(psz1, psz2); }
229#else
230 // almost all compilers/libraries provide this function (unfortunately under
231 // different names), that's why we don't implement our own which will surely
232 // be more efficient than this code (uncomment to use):
233 /*
234 register char c1, c2;
235 do {
236 c1 = tolower(*psz1++);
237 c2 = tolower(*psz2++);
238 } while ( c1 && (c1 == c2) );
239
240 return c1 - c2;
241 */
3f4a0c5b 242
e35d0039
JS
243 #error "Please define string case-insensitive compare for your OS/compiler"
244#endif // OS/compiler
245
246#endif
247 //_WX_WXCHAR_H_