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