00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef ACE_WCHAR_H
00014 #define ACE_WCHAR_H
00015
00016 #if !defined (ACE_LACKS_PRAGMA_ONCE)
00017 # pragma once
00018 #endif
00019
00020
00021
00022
00023 #if defined (ACE_LEGACY_MODE)
00024
00025 # if defined (ACE_HAS_MOSTLY_UNICODE_APIS)
00026 # define ACE_USES_WCHAR
00027 # endif
00028 # if defined (ACE_HAS_UNICODE)
00029 # define ACE_HAS_WCHAR
00030 # endif
00031
00032
00033
00034 # define ASYS_TCHAR ACE_TCHAR
00035 # define ASYS_TEXT ACE_TEXT
00036 # define ASYS_ONLY_MULTIBYTE_STRING ACE_TEXT_ALWAYS_CHAR
00037 # define ASYS_MULTIBYTE_STRING ACE_TEXT_CHAR_TO_TCHAR
00038 # define ASYS_WIDE_STRING ACE_TEXT_CHAR_TO_TCHAR
00039 # define ACE_WIDE_STRING ACE_TEXT_CHAR_TO_TCHAR
00040
00041 # if defined (ACE_USES_WCHAR)
00042 # define ASYS_ONLY_WIDE_STRING(STRING) STRING
00043 # else
00044 # define ASYS_ONLY_WIDE_STRING(STRING) \
00045 ACE_Ascii_To_Wide (STRING).wchar_rep ()
00046 # endif
00047
00048 # define ACE_TEXT_STRING ACE_TString
00049
00050 #endif
00051
00052 #if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
00053 # if !defined (ACE_HAS_WCHAR)
00054 # define ACE_HAS_WCHAR
00055 # endif
00056 # include <wchar.h>
00057 #endif
00058
00059 #if defined (ACE_HAS_WCHAR)
00060 # if defined (ACE_VXWORKS)
00061 # include <types/vxTypes.h>
00062 # include <stdlib.h>
00063 # include <string.h>
00064 # if !defined (__RTP__)
00065 # define wint_t unsigned int
00066 # else
00067 # include <wchar.h>
00068 # include <wctype.h>
00069 # endif
00070 # elif defined (ACE_OPENVMS)
00071 # include <wchar.h>
00072 # include <wctype.h>
00073 # elif defined (ACE_HAS_STANDARD_CPP_LIBRARY) && \
00074 (ACE_HAS_STANDARD_CPP_LIBRARY != 0)
00075 # include <cwchar>
00076 # include <cwctype>
00077 # elif defined (ACE_HAS_WINCE)
00078 # include <wtypes.h>
00079 # elif !defined (__BORLANDC__)
00080 # include <wchar.h>
00081 # endif
00082 #endif
00083
00084 #if defined (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB) && \
00085 (ACE_USES_STD_NAMESPACE_FOR_STDC_LIB != 0)
00086 using std::size_t;
00087 #endif
00088
00089
00090
00091 #if defined (ACE_HAS_WCHAR) && !defined (ACE_LACKS_NATIVE_WCHAR_T)
00092 # if !defined (ACE_WSTRING_HAS_USHORT_SUPPORT)
00093 # define ACE_WSTRING_HAS_USHORT_SUPPORT
00094 # endif
00095 #endif
00096
00097
00098 #if !defined (ACE_USES_L_PREFIX)
00099 # define ACE_USES_L_PREFIX 1
00100 #endif
00101
00102
00103
00104 # if !defined (ACE_TEXT_WIDE)
00105 # if (ACE_USES_L_PREFIX == 1)
00106 # define ACE_TEXT_WIDE_I(STRING) L##STRING
00107 # else
00108 # define ACE_TEXT_WIDE_I(STRING) STRING
00109 # endif
00110 # define ACE_TEXT_WIDE(STRING) ACE_TEXT_WIDE_I (STRING)
00111 # endif
00112
00113 #if defined (ACE_USES_WCHAR)
00114 typedef wchar_t ACE_TCHAR;
00115 typedef char ACE_ANTI_TCHAR;
00116 # define ACE_LIB_TEXT(STRING) ACE_TEXT_WIDE (STRING)
00117 # define ACE_TEXT_ALWAYS_CHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep ()
00118 # define ACE_TEXT_ALWAYS_WCHAR(STRING) STRING
00119 # define ACE_TEXT_CHAR_TO_TCHAR(STRING) ACE_Ascii_To_Wide (STRING).wchar_rep ()
00120 # define ACE_TEXT_WCHAR_TO_TCHAR(STRING) STRING
00121 # define ACE_TEXT_ANTI_TO_TCHAR(STRING) ACE_Ascii_To_Wide (STRING).wchar_rep ()
00122 #else
00123 typedef char ACE_TCHAR;
00124 typedef wchar_t ACE_ANTI_TCHAR;
00125 # define ACE_LIB_TEXT(STRING) STRING
00126 # define ACE_TEXT_ALWAYS_CHAR(STRING) STRING
00127 # define ACE_TEXT_ALWAYS_WCHAR(STRING) ACE_Ascii_To_Wide (STRING).wchar_rep ()
00128 # define ACE_TEXT_CHAR_TO_TCHAR(STRING) STRING
00129 # define ACE_TEXT_WCHAR_TO_TCHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep ()
00130 # define ACE_TEXT_ANTI_TO_TCHAR(STRING) ACE_Wide_To_Ascii (STRING).char_rep ()
00131 #endif
00132
00133 #if defined (ACE_LEGACY_MODE)
00134 # define ACE_TEXT TEXT
00135 #else
00136 # define ACE_TEXT ACE_LIB_TEXT
00137 #endif
00138
00139
00140
00141
00142
00143
00144 #if defined (ACE_HAS_XPG4_MULTIBYTE_CHAR)
00145
00146 # if !defined (ACE_LACKS_ITOW)
00147 # define ACE_LACKS_ITOW
00148 # endif
00149
00150 # if !defined (ACE_LACKS_WCSICMP)
00151 # define ACE_LACKS_WCSICMP
00152 # endif
00153
00154 # if !defined (ACE_LACKS_WCSNICMP)
00155 # define ACE_LACKS_WCSNICMP
00156 # endif
00157
00158 # if !defined (ACE_LACKS_WCSDUP)
00159 # define ACE_LACKS_WCSDUP
00160 # endif
00161
00162 #endif
00163
00164 #if defined ACE_HAS_WCHAR
00165
00166 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177 class ACE_Wide_To_Ascii
00178 {
00179 public:
00180
00181 ACE_Wide_To_Ascii (const wchar_t *s);
00182
00183
00184 ~ACE_Wide_To_Ascii (void);
00185
00186
00187 char *char_rep (void);
00188
00189
00190 static char *convert (const wchar_t *wstr);
00191
00192 private:
00193
00194 char *s_;
00195
00196
00197 ACE_Wide_To_Ascii (void);
00198 ACE_Wide_To_Ascii (ACE_Wide_To_Ascii &);
00199 ACE_Wide_To_Ascii& operator= (ACE_Wide_To_Ascii &);
00200 };
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211 class ACE_Ascii_To_Wide
00212 {
00213 public:
00214
00215 ACE_Ascii_To_Wide (const char *s);
00216
00217
00218 ~ACE_Ascii_To_Wide (void);
00219
00220
00221 wchar_t *wchar_rep (void);
00222
00223
00224 static wchar_t *convert (const char *str);
00225
00226 private:
00227
00228 wchar_t *s_;
00229
00230
00231 ACE_Ascii_To_Wide (void);
00232 ACE_Ascii_To_Wide (ACE_Ascii_To_Wide &);
00233 ACE_Ascii_To_Wide operator= (ACE_Ascii_To_Wide &);
00234 };
00235
00236 #if defined (ACE_LEGACY_MODE)
00237 typedef ACE_Ascii_To_Wide ACE_OS_CString;
00238 typedef ACE_Wide_To_Ascii ACE_OS_WString;
00239 #endif
00240
00241 ACE_END_VERSIONED_NAMESPACE_DECL
00242
00243 #endif
00244
00245 #if defined (ACE_WIN32)
00246 #if defined (ACE_USES_WCHAR)
00247 #define ACE_TEXT_SERVICE_TABLE_ENTRY SERVICE_TABLE_ENTRYW
00248 #define ACE_TEXT_STARTUPINFO STARTUPINFOW
00249 #define ACE_TEXT_WIN32_FIND_DATA WIN32_FIND_DATAW
00250
00251 #define ACE_TEXT_CreateEvent ::CreateEventW
00252 #define ACE_TEXT_CreateFile ::CreateFileW
00253 #define ACE_TEXT_CreateFileMapping ::CreateFileMappingW
00254 #define ACE_TEXT_CreateMutex ::CreateMutexW
00255 #define ACE_TEXT_CreateProcess ::CreateProcessW
00256 #define ACE_TEXT_CreateSemaphore ::CreateSemaphoreW
00257 #define ACE_TEXT_CreateService ::CreateServiceW
00258 #define ACE_TEXT_ExpandEnvironmentStrings ::ExpandEnvironmentStringsW
00259 #define ACE_TEXT_FindFirstChangeNotification ::FindFirstChangeNotificationW
00260 #define ACE_TEXT_FindFirstFile ::FindFirstFileW
00261 #define ACE_TEXT_FindNextFile ::FindNextFileW
00262 #define ACE_TEXT_FormatMessage ::FormatMessageW
00263 #define ACE_TEXT_FreeEnvironmentStrings ::FreeEnvironmentStringsW
00264 #define ACE_TEXT_GetComputerName ::GetComputerNameW
00265 #define ACE_TEXT_GetEnvironmentStrings ::GetEnvironmentStringsW
00266 #define ACE_TEXT_GetFileAttributes ::GetFileAttributesW
00267 #define ACE_TEXT_GetModuleFileName ::GetModuleFileNameW
00268 #define ACE_TEXT_GetTempPath ::GetTempPathW
00269 #define ACE_TEXT_GetUserName ::GetUserNameW
00270 #define ACE_TEXT_LoadLibrary ::LoadLibraryW
00271 #define ACE_TEXT_MoveFileEx ::MoveFileExW
00272 #define ACE_TEXT_WaitNamedPipe ::WaitNamedPipeW
00273 #define ACE_TEXT_OpenFileMapping ::OpenFileMappingW
00274 #define ACE_TEXT_OpenSCManager ::OpenSCManagerW
00275 #define ACE_TEXT_OpenService ::OpenServiceW
00276 #define ACE_TEXT_OutputDebugString ::OutputDebugStringW
00277 #define ACE_TEXT_RegisterEventSource ::RegisterEventSourceW
00278 #define ACE_TEXT_RegisterServiceCtrlHandler ::RegisterServiceCtrlHandlerW
00279 #define ACE_TEXT_RegConnectRegistry ::RegConnectRegistryW
00280 #define ACE_TEXT_RegCreateKeyEx ::RegCreateKeyExW
00281 #define ACE_TEXT_RegDeleteKey ::RegDeleteKeyW
00282 #define ACE_TEXT_RegDeleteValue ::RegDeleteValueW
00283 #define ACE_TEXT_RegEnumKeyEx ::RegEnumKeyExW
00284 #define ACE_TEXT_RegEnumValue ::RegEnumValueW
00285 #define ACE_TEXT_RegCreateKey ::RegCreateKeyW
00286 #define ACE_TEXT_RegOpenKey ::RegOpenKeyW
00287 #define ACE_TEXT_RegOpenKeyEx ::RegOpenKeyExW
00288 #define ACE_TEXT_RegQueryValueEx ::RegQueryValueExW
00289 #define ACE_TEXT_RegSetValueEx ::RegSetValueExW
00290 #define ACE_TEXT_ReportEvent ::ReportEventW
00291 #define ACE_TEXT_SearchPath ::SearchPathW
00292 #define ACE_TEXT_StartService ::StartServiceW
00293 #define ACE_TEXT_StartServiceCtrlDispatcher ::StartServiceCtrlDispatcherW
00294
00295 #else
00296 #define ACE_TEXT_SERVICE_TABLE_ENTRY SERVICE_TABLE_ENTRYA
00297 #define ACE_TEXT_STARTUPINFO STARTUPINFOA
00298 #define ACE_TEXT_WIN32_FIND_DATA WIN32_FIND_DATAA
00299
00300 #define ACE_TEXT_CreateEvent ::CreateEventA
00301 #define ACE_TEXT_CreateFile ::CreateFileA
00302 #define ACE_TEXT_CreateFileMapping ::CreateFileMappingA
00303 #define ACE_TEXT_CreateMutex ::CreateMutexA
00304 #define ACE_TEXT_CreateProcess ::CreateProcessA
00305 #define ACE_TEXT_CreateSemaphore ::CreateSemaphoreA
00306 #define ACE_TEXT_CreateService ::CreateServiceA
00307 #define ACE_TEXT_ExpandEnvironmentStrings ::ExpandEnvironmentStringsA
00308 #define ACE_TEXT_FindFirstChangeNotification ::FindFirstChangeNotificationA
00309 #define ACE_TEXT_FindFirstFile ::FindFirstFileA
00310 #define ACE_TEXT_FindNextFile ::FindNextFileA
00311 #define ACE_TEXT_FormatMessage ::FormatMessageA
00312 #define ACE_TEXT_FreeEnvironmentStrings ::FreeEnvironmentStringsA
00313 #define ACE_TEXT_GetComputerName ::GetComputerNameA
00314 #define ACE_TEXT_GetEnvironmentStrings ::GetEnvironmentStringsA
00315 #define ACE_TEXT_GetFileAttributes ::GetFileAttributesA
00316 #define ACE_TEXT_GetModuleFileName ::GetModuleFileNameA
00317 #define ACE_TEXT_GetTempPath ::GetTempPathA
00318 #define ACE_TEXT_GetUserName ::GetUserNameA
00319 #define ACE_TEXT_LoadLibrary ::LoadLibraryA
00320 #define ACE_TEXT_MoveFileEx ::MoveFileExA
00321 #define ACE_TEXT_WaitNamedPipe ::WaitNamedPipeA
00322 #define ACE_TEXT_OpenFileMapping ::OpenFileMappingA
00323 #define ACE_TEXT_OpenSCManager ::OpenSCManagerA
00324 #define ACE_TEXT_OpenService ::OpenServiceA
00325 #define ACE_TEXT_OutputDebugString ::OutputDebugStringA
00326 #define ACE_TEXT_RegisterEventSource ::RegisterEventSourceA
00327 #define ACE_TEXT_RegisterServiceCtrlHandler ::RegisterServiceCtrlHandlerA
00328 #define ACE_TEXT_RegConnectRegistry ::RegConnectRegistryA
00329 #define ACE_TEXT_RegCreateKeyEx ::RegCreateKeyExA
00330 #define ACE_TEXT_RegDeleteKey ::RegDeleteKeyA
00331 #define ACE_TEXT_RegDeleteValue ::RegDeleteValueA
00332 #define ACE_TEXT_RegEnumKeyEx ::RegEnumKeyExA
00333 #define ACE_TEXT_RegEnumValue ::RegEnumValueA
00334 #define ACE_TEXT_RegCreateKey ::RegCreateKeyA
00335 #define ACE_TEXT_RegOpenKey ::RegOpenKeyA
00336 #define ACE_TEXT_RegOpenKeyEx ::RegOpenKeyExA
00337 #define ACE_TEXT_RegQueryValueEx ::RegQueryValueExA
00338 #define ACE_TEXT_RegSetValueEx ::RegSetValueExA
00339 #define ACE_TEXT_ReportEvent ::ReportEventA
00340 #define ACE_TEXT_SearchPath ::SearchPathA
00341 #define ACE_TEXT_StartService ::StartServiceA
00342 #define ACE_TEXT_StartServiceCtrlDispatcher ::StartServiceCtrlDispatcherA
00343 #endif
00344 #endif
00345
00346 #include "ace/ace_wchar.inl"
00347
00348 #endif