~ubuntu-branches/ubuntu/breezy/ace/breezy

« back to all changes in this revision

Viewing changes to ace/ace_wchar.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad, Benjamin Montgomery, Adam Conrad
  • Date: 2005-09-18 22:51:38 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 sarge) (0.1.2 woody)
  • Revision ID: james.westby@ubuntu.com-20050918225138-seav22q6fyylb536
Tags: 5.4.7-3ubuntu1
[ Benjamin Montgomery ]
* Added a patch for amd64 and powerpc that disables the compiler
  option -fvisibility-inlines-hidden

[ Adam Conrad ]
* Added DPATCH_OPTION_CPP=1 to debian/patches/00options to make
  Benjamin's above changes work correctly with dpatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- C++ -*- */
2
 
 
3
 
//=============================================================================
4
 
/**
5
 
 *  @file    ace_wchar.h
6
 
 *
7
 
 *  ace_wchar.h,v 4.31 2003/05/25 06:02:05 dhinton Exp
8
 
 *
9
 
 *  @author Darrell Brunsch <brunsch@uci.edu>
10
 
 */
11
 
//=============================================================================
12
 
 
13
 
#ifndef ACE_WCHAR_H
14
 
#define ACE_WCHAR_H
15
 
 
16
 
#if !defined (ACE_LACKS_PRAGMA_ONCE)
17
 
# pragma once
18
 
#endif /* ACE_LACKS_PRAGMA_ONCE */
19
 
 
20
 
// These macros have been deprecated and should be replaced by their
21
 
// ACE_TEXT_* equivalents.  These macros are just hacks and may not
22
 
// completely provide the old functionality.
23
 
#if defined (ACE_LEGACY_MODE)
24
 
// Convert the old unicode indicators
25
 
# if defined (ACE_HAS_MOSTLY_UNICODE_APIS)
26
 
#   define ACE_USES_WCHAR
27
 
# endif /* ACE_HAS_MOSTLY_UNICODE_APIS */
28
 
# if defined (ACE_HAS_UNICODE)
29
 
#   define ACE_HAS_WCHAR
30
 
# endif /* ACE_HAS_UNICODE */
31
 
 
32
 
// These are defined to get older stuff to compile
33
 
// FUZZ: disable check_for_tchar
34
 
# define ASYS_TCHAR ACE_TCHAR
35
 
# define ASYS_TEXT ACE_TEXT
36
 
# define ASYS_ONLY_MULTIBYTE_STRING ACE_TEXT_ALWAYS_CHAR
37
 
# define ASYS_MULTIBYTE_STRING ACE_TEXT_CHAR_TO_TCHAR
38
 
# define ASYS_WIDE_STRING ACE_TEXT_CHAR_TO_TCHAR
39
 
# define ACE_WIDE_STRING ACE_TEXT_CHAR_TO_TCHAR
40
 
 
41
 
# if defined (ACE_USES_WCHAR)
42
 
#   define ASYS_ONLY_WIDE_STRING(STRING) STRING
43
 
# else /* ACE_USES_WCHAR */
44
 
#   define ASYS_ONLY_WIDE_STRING(STRING) \
45
 
           ACE_Ascii_To_Wide (STRING).wchar_rep ()
46
 
# endif /* ACE_USES_WCHAR */
47
 
 
48
 
# define ACE_TEXT_STRING ACE_TString
49
 
 
50
 
#endif /* ACE_LEGACY_MODE */
51
 
 
52
 
#if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
53
 
#  include /**/ <wchar.h>
54
 
#endif /* ACE_HAS_XPG4_MULTIBYPTE_CHAR */
55
 
 
56
 
#if defined (ACE_HAS_WCHAR)
57
 
# if defined (VXWORKS)
58
 
#   include /**/ <types/vxTypes.h>  /* For wchar_t */
59
 
#   include /**/ <stdlib.h>         /* For mbstowcs, etc. */
60
 
#   include /**/ <string.h>         /* For strlen */
61
 
#   define wint_t unsigned int      /* VxWorks has wchar_t but not wint_t */
62
 
# elif defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \
63
 
    (ACE_HAS_STANDARD_CPP_LIBRARY != 0)
64
 
#   include /**/ <cwchar>
65
 
#   include /**/ <cwctype>
66
 
# elif defined (ACE_HAS_WINCE)
67
 
#   include /**/ <wtypes.h>
68
 
# elif !defined (__BORLANDC__)
69
 
#   include /**/ <wchar.h>
70
 
# endif /* ACE_HAS_STANDARD_CPP_LIBRARY */
71
 
#endif /* ACE_HAS_WCHAR */
72
 
 
73
 
#if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \
74
 
            (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB != 0)
75
 
using std::size_t;
76
 
#endif /* ACE_USES_STD_NAMESPACE_FOR_STDC_LIB */
77
 
 
78
 
// Since MSVC uses ushort16 = wchar_t, it is the only one
79
 
// that does not need this defined
80
 
 
81
 
#if defined (ACE_HAS_WCHAR) && !defined (_MSC_VER)
82
 
# if !defined (ACE_WSTRING_HAS_USHORT_SUPPORT)
83
 
#  define ACE_WSTRING_HAS_USHORT_SUPPORT
84
 
# endif /* ACE_WSTRING_HAS_USHORT_SUPPORT */
85
 
#endif /* ACE_HAS_WCHAR && !_MSC_VER */
86
 
 
87
 
// Set the default behaviour for ACE_TEXT_WIDE to use the L-prefix
88
 
#if !defined (ACE_USES_L_PREFIX)
89
 
# define ACE_USES_L_PREFIX 1
90
 
#endif /* ACE_USES_L_PREFIX */
91
 
 
92
 
// Define the unicode/wchar related macros correctly
93
 
 
94
 
# if !defined (ACE_TEXT_WIDE)
95
 
#  if (ACE_USES_L_PREFIX == 1)
96
 
#    define ACE_TEXT_WIDE_I(STRING) L##STRING
97
 
#  else /* ACE_USES_L_PREFIX */
98
 
#    define ACE_TEXT_WIDE_I(STRING) STRING
99
 
#  endif /* ACE_USES_L_PREFIX */
100
 
#  define ACE_TEXT_WIDE(STRING) ACE_TEXT_WIDE_I (STRING)
101
 
# endif /* ACE_TEXT_WIDE */
102
 
 
103
 
#if defined (ACE_USES_WCHAR)
104
 
typedef wchar_t ACE_TCHAR;
105
 
typedef char ACE_ANTI_TCHAR;
106
 
# define ACE_LIB_TEXT(STRING) ACE_TEXT_WIDE (STRING)
107
 
# define ACE_TEXT_ALWAYS_CHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep ()
108
 
# define ACE_TEXT_ALWAYS_WCHAR(STRING) STRING
109
 
# define ACE_TEXT_CHAR_TO_TCHAR(STRING) ACE_Ascii_To_Wide (STRING).wchar_rep ()
110
 
# define ACE_TEXT_WCHAR_TO_TCHAR(STRING) STRING
111
 
# define ACE_TEXT_ANTI_TO_TCHAR(STRING) ACE_Ascii_To_Wide (STRING).wchar_rep ()
112
 
#else /* ACE_USES_WCHAR */
113
 
typedef char ACE_TCHAR;
114
 
typedef wchar_t ACE_ANTI_TCHAR;
115
 
# define ACE_LIB_TEXT(STRING) STRING
116
 
# define ACE_TEXT_ALWAYS_CHAR(STRING) STRING
117
 
# define ACE_TEXT_ALWAYS_WCHAR(STRING) ACE_Ascii_To_Wide (STRING).wchar_rep ()
118
 
# define ACE_TEXT_CHAR_TO_TCHAR(STRING) STRING
119
 
# define ACE_TEXT_WCHAR_TO_TCHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep ()
120
 
# define ACE_TEXT_ANTI_TO_TCHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep ()
121
 
#endif /* ACE_USES_WCHAR */
122
 
 
123
 
#if defined (ACE_LEGACY_MODE)
124
 
# define ACE_TEXT TEXT
125
 
#else /* ACE_LEGACY_MODE */
126
 
# define ACE_TEXT ACE_LIB_TEXT
127
 
#endif /* ACE_LEGACY_MODE */
128
 
 
129
 
// The OS_String module defines some wide-char functions that are not
130
 
// universally available. In particular, they're not part of the
131
 
// XPG4 Worldwide Portability Interface wide-character string handling
132
 
// functions. So, if ACE_HAS_XPG4_MULTIBYTE_CHAR is defined, note that
133
 
// these functions are missing.
134
 
#if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
135
 
 
136
 
#  if !defined (ACE_LACKS_ITOW)
137
 
#    define ACE_LACKS_ITOW
138
 
#  endif
139
 
 
140
 
#  if !defined (ACE_LACKS_WCSICMP)
141
 
#    define ACE_LACKS_WCSICMP
142
 
#  endif
143
 
 
144
 
#  if !defined (ACE_LACKS_WCSNICMP)
145
 
#    define ACE_LACKS_WCSNICMP
146
 
#  endif
147
 
 
148
 
#  if !defined (ACE_LACKS_WCSDUP)
149
 
#    define ACE_LACKS_WCSDUP
150
 
#  endif
151
 
 
152
 
#endif /* ACE_HAS_XPG4_MULTIBYTE_CHAR */
153
 
 
154
 
#if defined ACE_HAS_WCHAR
155
 
/**
156
 
 * @class ACE_Wide_To_Ascii
157
 
 *
158
 
 * @brief A lightweight wchar* to char* string conversion class.
159
 
 *
160
 
 * The purpose of this class is to perform conversion from
161
 
 * wchar* to char* strings.  It is not intended for general
162
 
 * purpose use.
163
 
 */
164
 
class ACE_Wide_To_Ascii
165
 
{
166
 
public:
167
 
  /// Ctor must take a wchar string.
168
 
  ACE_Wide_To_Ascii (const wchar_t *s);
169
 
 
170
 
  /// Dtor will free up the memory.
171
 
  ~ACE_Wide_To_Ascii (void);
172
 
 
173
 
  /// Return the internal char* representation.
174
 
  char *char_rep (void);
175
 
 
176
 
  /// Converts an wchar_t string to ascii and returns a new string.
177
 
  static char *convert (const wchar_t *wstr);
178
 
 
179
 
private:
180
 
  /// Internal pointer to the converted string.
181
 
  char *s_;
182
 
 
183
 
  /// Disallow these operation.
184
 
  ACE_Wide_To_Ascii (void);
185
 
  ACE_Wide_To_Ascii (ACE_Wide_To_Ascii &);
186
 
  ACE_Wide_To_Ascii& operator= (ACE_Wide_To_Ascii &);
187
 
};
188
 
 
189
 
/**
190
 
 * @class ACE_Ascii_To_Wide
191
 
 *
192
 
 * @brief A lightweight char* to wchar* string conversion class.
193
 
 *
194
 
 * The purpose of this class is to perform conversion from
195
 
 * char* to wchar* strings.  It is not intended for general
196
 
 * purpose use.
197
 
 */
198
 
class ACE_Ascii_To_Wide
199
 
{
200
 
public:
201
 
  /// Ctor must take a wchar string.
202
 
  ACE_Ascii_To_Wide (const char *s);
203
 
 
204
 
  /// Dtor will free up the memory.
205
 
  ~ACE_Ascii_To_Wide (void);
206
 
 
207
 
  /// Return the internal wchar* representation.
208
 
  wchar_t *wchar_rep (void);
209
 
 
210
 
  /// Converts an char string to unicode/wide and returns a new string.
211
 
  static wchar_t *convert (const char *str);
212
 
 
213
 
private:
214
 
  /// Internal pointer to the converted string.
215
 
  wchar_t *s_;
216
 
 
217
 
  /// Disallow these operation.
218
 
  ACE_Ascii_To_Wide (void);
219
 
  ACE_Ascii_To_Wide (ACE_Ascii_To_Wide &);
220
 
  ACE_Ascii_To_Wide operator= (ACE_Ascii_To_Wide &);
221
 
};
222
 
 
223
 
#if defined (ACE_LEGACY_MODE)
224
 
typedef ACE_Ascii_To_Wide ACE_OS_CString;
225
 
typedef ACE_Wide_To_Ascii ACE_OS_WString;
226
 
#endif /* ACE_LEGACY_MODE */
227
 
 
228
 
#endif /* ACE_HAS_WCHAR */
229
 
 
230
 
#if defined (ACE_WIN32)
231
 
#if defined (ACE_USES_WCHAR)
232
 
#define ACE_TEXT_SERVICE_TABLE_ENTRY             SERVICE_TABLE_ENTRYW
233
 
#define ACE_TEXT_STARTUPINFO                     STARTUPINFOW
234
 
#define ACE_TEXT_WIN32_FIND_DATA                 WIN32_FIND_DATAW
235
 
 
236
 
#define ACE_TEXT_CreateEvent                     ::CreateEventW
237
 
#define ACE_TEXT_CreateFile                      ::CreateFileW
238
 
#define ACE_TEXT_CreateFileMapping               ::CreateFileMappingW
239
 
#define ACE_TEXT_CreateMutex                     ::CreateMutexW
240
 
#define ACE_TEXT_CreateProcess                   ::CreateProcessW
241
 
#define ACE_TEXT_CreateSemaphore                 ::CreateSemaphoreW
242
 
#define ACE_TEXT_CreateService                   ::CreateServiceW
243
 
#define ACE_TEXT_ExpandEnvironmentStrings        ::ExpandEnvironmentStringsW
244
 
#define ACE_TEXT_FindFirstChangeNotification     ::FindFirstChangeNotificationW
245
 
#define ACE_TEXT_FindFirstFile                   ::FindFirstFileW
246
 
#define ACE_TEXT_FindNextFile                    ::FindNextFileW
247
 
#define ACE_TEXT_FormatMessage                   ::FormatMessageW
248
 
#define ACE_TEXT_FreeEnvironmentStrings          ::FreeEnvironmentStringsW
249
 
#define ACE_TEXT_GetComputerName                 ::GetComputerNameW
250
 
#define ACE_TEXT_GetEnvironmentStrings           ::GetEnvironmentStringsW
251
 
#define ACE_TEXT_GetFileAttributes               ::GetFileAttributesW
252
 
#define ACE_TEXT_GetModuleFileName               ::GetModuleFileNameW
253
 
#define ACE_TEXT_GetTempPath                     ::GetTempPathW
254
 
#define ACE_TEXT_GetUserName                     ::GetUserNameW
255
 
#define ACE_TEXT_LoadLibrary                     ::LoadLibraryW
256
 
#define ACE_TEXT_MoveFileEx                      ::MoveFileExW
257
 
#define ACE_TEXT_WaitNamedPipe                   ::WaitNamedPipeW
258
 
#define ACE_TEXT_OpenFileMapping                 ::OpenFileMappingW
259
 
#define ACE_TEXT_OpenSCManager                   ::OpenSCManagerW
260
 
#define ACE_TEXT_OpenService                     ::OpenServiceW
261
 
#define ACE_TEXT_RegisterEventSource             ::RegisterEventSourceW
262
 
#define ACE_TEXT_RegisterServiceCtrlHandler      ::RegisterServiceCtrlHandlerW
263
 
#define ACE_TEXT_RegConnectRegistry              ::RegConnectRegistryW
264
 
#define ACE_TEXT_RegCreateKeyEx                  ::RegCreateKeyExW
265
 
#define ACE_TEXT_RegDeleteKey                    ::RegDeleteKeyW
266
 
#define ACE_TEXT_RegDeleteValue                  ::RegDeleteValueW
267
 
#define ACE_TEXT_RegEnumKeyEx                    ::RegEnumKeyExW
268
 
#define ACE_TEXT_RegEnumValue                    ::RegEnumValueW
269
 
#define ACE_TEXT_RegCreateKey                    ::RegCreateKeyW
270
 
#define ACE_TEXT_RegOpenKey                      ::RegOpenKeyW
271
 
#define ACE_TEXT_RegOpenKeyEx                    ::RegOpenKeyExW
272
 
#define ACE_TEXT_RegQueryValueEx                 ::RegQueryValueExW
273
 
#define ACE_TEXT_RegSetValueEx                   ::RegSetValueExW
274
 
#define ACE_TEXT_ReportEvent                     ::ReportEventW
275
 
#define ACE_TEXT_SearchPath                      ::SearchPathW
276
 
#define ACE_TEXT_StartService                    ::StartServiceW
277
 
#define ACE_TEXT_StartServiceCtrlDispatcher      ::StartServiceCtrlDispatcherW
278
 
 
279
 
#else /* ACE_USES_WCHAR */
280
 
#define ACE_TEXT_SERVICE_TABLE_ENTRY             SERVICE_TABLE_ENTRYA
281
 
#define ACE_TEXT_STARTUPINFO                     STARTUPINFOA
282
 
#define ACE_TEXT_WIN32_FIND_DATA                 WIN32_FIND_DATAA
283
 
 
284
 
#define ACE_TEXT_CreateEvent                     ::CreateEventA
285
 
#define ACE_TEXT_CreateFile                      ::CreateFileA
286
 
#define ACE_TEXT_CreateFileMapping               ::CreateFileMappingA
287
 
#define ACE_TEXT_CreateMutex                     ::CreateMutexA
288
 
#define ACE_TEXT_CreateProcess                   ::CreateProcessA
289
 
#define ACE_TEXT_CreateSemaphore                 ::CreateSemaphoreA
290
 
#define ACE_TEXT_CreateService                   ::CreateServiceA
291
 
#define ACE_TEXT_ExpandEnvironmentStrings        ::ExpandEnvironmentStringsA
292
 
#define ACE_TEXT_FindFirstChangeNotification     ::FindFirstChangeNotificationA
293
 
#define ACE_TEXT_FindFirstFile                   ::FindFirstFileA
294
 
#define ACE_TEXT_FindNextFile                    ::FindNextFileA
295
 
#define ACE_TEXT_FormatMessage                   ::FormatMessageA
296
 
#define ACE_TEXT_FreeEnvironmentStrings          ::FreeEnvironmentStringsA
297
 
#define ACE_TEXT_GetComputerName                 ::GetComputerNameA
298
 
#define ACE_TEXT_GetEnvironmentStrings           ::GetEnvironmentStringsA
299
 
#define ACE_TEXT_GetFileAttributes               ::GetFileAttributesA
300
 
#define ACE_TEXT_GetModuleFileName               ::GetModuleFileNameA
301
 
#define ACE_TEXT_GetTempPath                     ::GetTempPathA
302
 
#define ACE_TEXT_GetUserName                     ::GetUserNameA
303
 
#define ACE_TEXT_LoadLibrary                     ::LoadLibraryA
304
 
#define ACE_TEXT_MoveFileEx                      ::MoveFileExA
305
 
#define ACE_TEXT_WaitNamedPipe                   ::WaitNamedPipeA
306
 
#define ACE_TEXT_OpenFileMapping                 ::OpenFileMappingA
307
 
#define ACE_TEXT_OpenSCManager                   ::OpenSCManagerA
308
 
#define ACE_TEXT_OpenService                     ::OpenServiceA
309
 
#define ACE_TEXT_RegisterEventSource             ::RegisterEventSourceA
310
 
#define ACE_TEXT_RegisterServiceCtrlHandler      ::RegisterServiceCtrlHandlerA
311
 
#define ACE_TEXT_RegConnectRegistry              ::RegConnectRegistryA
312
 
#define ACE_TEXT_RegCreateKeyEx                  ::RegCreateKeyExA
313
 
#define ACE_TEXT_RegDeleteKey                    ::RegDeleteKeyA
314
 
#define ACE_TEXT_RegDeleteValue                  ::RegDeleteValueA
315
 
#define ACE_TEXT_RegEnumKeyEx                    ::RegEnumKeyExA
316
 
#define ACE_TEXT_RegEnumValue                    ::RegEnumValueA
317
 
#define ACE_TEXT_RegCreateKey                    ::RegCreateKeyA
318
 
#define ACE_TEXT_RegOpenKey                      ::RegOpenKeyA
319
 
#define ACE_TEXT_RegOpenKeyEx                    ::RegOpenKeyExA
320
 
#define ACE_TEXT_RegQueryValueEx                 ::RegQueryValueExA
321
 
#define ACE_TEXT_RegSetValueEx                   ::RegSetValueExA
322
 
#define ACE_TEXT_ReportEvent                     ::ReportEventA
323
 
#define ACE_TEXT_SearchPath                      ::SearchPathA
324
 
#define ACE_TEXT_StartService                    ::StartServiceA
325
 
#define ACE_TEXT_StartServiceCtrlDispatcher      ::StartServiceCtrlDispatcherA
326
 
#endif /* ACE_USES_WCHAR */
327
 
#endif /* ACE_WIN32 */
328
 
 
329
 
#include "ace/ace_wchar.inl"
330
 
 
331
 
#endif /* ACE_WCHAR_H */