|
1 /* |
|
2 * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved. |
|
3 * Copyright (c) 1999 |
|
4 * Boris Fomitchev |
|
5 * |
|
6 * This material is provided "as is", with absolutely no warranty expressed |
|
7 * or implied. Any use is at your own risk. |
|
8 * |
|
9 * Permission to use or copy this software for any purpose is hereby granted |
|
10 * without fee, provided the above notices are retained on all copies. |
|
11 * Permission to modify the code and to distribute modified code is granted, |
|
12 * provided the above notices are retained, and a notice that the code was |
|
13 * modified is included with the above copyright notice. |
|
14 * |
|
15 */ |
|
16 |
|
17 #ifndef _STLP_CWCHAR_H |
|
18 # define _STLP_CWCHAR_H |
|
19 |
|
20 #ifndef _STLP_NO_WCHAR_T |
|
21 #ifdef __cplusplus |
|
22 # include <cwchar> |
|
23 #else |
|
24 # include <wchar.h> |
|
25 #endif |
|
26 #endif |
|
27 |
|
28 # if defined (__MRC__) || defined (__SC__) || defined (__BORLANDC__) || defined(__FreeBSD__) || (defined (__GNUC__) && defined (__APPLE__) || defined( __Lynx__ )) || defined (_STLP_NO_WCHAR_T) |
|
29 |
|
30 #ifdef __SYMBIAN32__ |
|
31 # include <stddef.h> |
|
32 #else |
|
33 # include _STLP_NATIVE_C_HEADER(stddef.h) |
|
34 #endif |
|
35 # if defined (__FreeBSD__) || defined (__Lynx__) |
|
36 # ifndef _WINT_T |
|
37 typedef long int wint_t; |
|
38 # define _WINT_T |
|
39 # endif /* _WINT_T */ |
|
40 # endif |
|
41 # endif |
|
42 |
|
43 # if defined ( _STLP_OWN_IOSTREAMS ) && defined (_STLP_NO_NATIVE_MBSTATE_T) && ! defined (_STLP_NO_MBSTATE_T) && ! defined (_MBSTATE_T) && ! defined (__mbstate_t_defined) |
|
44 # define _STLP_USE_OWN_MBSTATE_T |
|
45 # define _MBSTATE_T |
|
46 # endif |
|
47 |
|
48 # ifdef _STLP_USE_OWN_MBSTATE_T |
|
49 |
|
50 #ifndef __SYMBIAN32__ //no more using the structure __stl_mbstate_t. usinfg _mb_state_t from _types.h. |
|
51 // to be compatible across different SUN platforms |
|
52 #ifdef __sun |
|
53 # define __stl_mbstate_t __mbstate_t |
|
54 #endif |
|
55 |
|
56 struct __stl_mbstate_t; |
|
57 |
|
58 # ifdef __cplusplus |
|
59 struct __stl_mbstate_t { |
|
60 __stl_mbstate_t( long __st = 0 ) { _M_state[0] = __st ; } |
|
61 __stl_mbstate_t& operator=(const long __st) { |
|
62 _M_state[0] = __st; |
|
63 return *this; |
|
64 } |
|
65 __stl_mbstate_t(const __stl_mbstate_t& __x) {_M_state[0]= __x._M_state[0]; } |
|
66 __stl_mbstate_t& operator=(const __stl_mbstate_t& __x) { |
|
67 _M_state[0]= __x._M_state[0]; |
|
68 return *this; |
|
69 } |
|
70 # if defined (__sun) |
|
71 # ifdef _LP64 |
|
72 long _M_state[4]; |
|
73 # else |
|
74 int _M_state[6]; |
|
75 # endif |
|
76 # else |
|
77 long _M_state[1]; |
|
78 # endif |
|
79 }; |
|
80 |
|
81 inline bool operator==(const __stl_mbstate_t& __x, const __stl_mbstate_t& __y) { |
|
82 return ( __x._M_state[0] == __y._M_state[0] ); |
|
83 } |
|
84 |
|
85 inline bool operator!=(const __stl_mbstate_t& __x, const __stl_mbstate_t& __y) { |
|
86 return ( __x._M_state[0] == __y._M_state[0] ); |
|
87 } |
|
88 # endif |
|
89 |
|
90 |
|
91 #endif //#if __SYMBIAN32__ |
|
92 _STLP_BEGIN_NAMESPACE |
|
93 //typedef __mbstate_t __stl_mbstate_t; |
|
94 //typedef __mbstate_t mbstate_t; |
|
95 |
|
96 _STLP_END_NAMESPACE |
|
97 |
|
98 # endif /* _STLP_USE_OWN_MBSTATE_T */ |
|
99 |
|
100 #if !defined (_STLP_NO_WCHAR_T) |
|
101 # ifndef WCHAR_MIN |
|
102 # define WCHAR_MIN 0 |
|
103 // SUNpro has some bugs with casts. wchar_t is size of int there anyway. |
|
104 # if defined (__SUNPRO_CC) || defined (__DJGPP) |
|
105 # define WCHAR_MAX (~0) |
|
106 # else |
|
107 # define WCHAR_MAX ((wchar_t)~0) |
|
108 # endif |
|
109 # endif |
|
110 #endif |
|
111 |
|
112 # if defined (_STLP_IMPORT_VENDOR_CSTD) && ! defined (_STLP_VENDOR_GLOBAL_CSTD) |
|
113 _STLP_BEGIN_NAMESPACE |
|
114 using namespace _STLP_VENDOR_CSTD; |
|
115 _STLP_END_NAMESPACE |
|
116 #endif /* _STLP_IMPORT_VENDOR_CSTD */ |
|
117 |
|
118 #endif /* _STLP_CWCHAR_H */ |
|
119 |