epoc32/include/stdapis/stlportv5/stl/_codecvt.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/stlportv5/stl/_codecvt.h	Wed Mar 31 12:27:01 2010 +0100
     1.3 @@ -0,0 +1,323 @@
     1.4 +/*
     1.5 + * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
     1.6 + *
     1.7 + * Copyright (c) 1999
     1.8 + * Silicon Graphics Computer Systems, Inc.
     1.9 + *
    1.10 + * Copyright (c) 1999 
    1.11 + * Boris Fomitchev
    1.12 + *
    1.13 + * This material is provided "as is", with absolutely no warranty expressed
    1.14 + * or implied. Any use is at your own risk.
    1.15 + *
    1.16 + * Permission to use or copy this software for any purpose is hereby granted 
    1.17 + * without fee, provided the above notices are retained on all copies.
    1.18 + * Permission to modify the code and to distribute modified code is granted,
    1.19 + * provided the above notices are retained, and a notice that the code was
    1.20 + * modified is included with the above copyright notice.
    1.21 + *
    1.22 + */ 
    1.23 +// WARNING: This is an internal header file, included by other C++
    1.24 +// standard library headers.  You should not attempt to use this header
    1.25 +// file directly.
    1.26 +
    1.27 +
    1.28 +#ifndef _STLP_INTERNAL_CODECVT_H
    1.29 +#define _STLP_INTERNAL_CODECVT_H
    1.30 +
    1.31 +# ifndef _STLP_C_LOCALE_H
    1.32 +#  include <stl/c_locale.h>
    1.33 +# endif
    1.34 +# ifndef _STLP_INTERNAL_LOCALE_H
    1.35 +#  include <stl/_locale.h>
    1.36 +# endif
    1.37 +
    1.38 +_STLP_BEGIN_NAMESPACE
    1.39 +
    1.40 +class _STLP_CLASS_DECLSPEC codecvt_base {
    1.41 +public:
    1.42 +  enum result {ok, partial, error, noconv};
    1.43 +};
    1.44 +
    1.45 +template <class _InternT, class _ExternT, class _StateT>
    1.46 +class codecvt : public locale::facet, public codecvt_base {
    1.47 +  typedef _InternT intern_type;
    1.48 +  typedef _ExternT extern_type;
    1.49 +  typedef _StateT state_type;
    1.50 +};
    1.51 + 
    1.52 +template <class _InternT, class _ExternT, class _StateT>
    1.53 +class codecvt_byname : public codecvt<_InternT, _ExternT, _StateT> {};
    1.54 +
    1.55 +_STLP_TEMPLATE_NULL
    1.56 +#ifdef __SYMBIAN32__
    1.57 +class codecvt<char, char, mbstate_t> : public locale::facet, public codecvt_base
    1.58 +#else
    1.59 +class _STLP_CLASS_DECLSPEC codecvt<char, char, mbstate_t> : public locale::facet, public codecvt_base
    1.60 +#endif
    1.61 +{
    1.62 +  friend class _Locale;
    1.63 +public:
    1.64 +  typedef char       intern_type;
    1.65 +  typedef char       extern_type;
    1.66 +  typedef mbstate_t  state_type;
    1.67 +
    1.68 +  explicit codecvt(size_t __refs = 0) : _BaseFacet(__refs) {}
    1.69 +
    1.70 +  result out(state_type&  __state,
    1.71 +             const char*  __from,
    1.72 +             const char*  __from_end,
    1.73 +             const char*& __from_next,
    1.74 +             char*        __to,
    1.75 +             char*        __to_limit, 
    1.76 +             char*&       __to_next) const {
    1.77 +    return do_out(__state, 
    1.78 +                  __from, __from_end, __from_next,
    1.79 +                  __to,   __to_limit, __to_next);
    1.80 +  }
    1.81 +
    1.82 +  result unshift(mbstate_t& __state,
    1.83 +                 char* __to, char* __to_limit, char*& __to_next) const
    1.84 +    { return do_unshift(__state, __to, __to_limit, __to_next); }
    1.85 +    
    1.86 +  result in(state_type&   __state,
    1.87 +            const char*  __from,
    1.88 +            const char*  __from_end,  
    1.89 +            const char*& __from_next,
    1.90 +            char*        __to, 
    1.91 +            char*        __to_limit, 
    1.92 +            char*&       __to_next) const {
    1.93 +    return do_in(__state,
    1.94 +                 __from, __from_end, __from_next,
    1.95 +                 __to,   __to_limit, __to_next);
    1.96 +  }
    1.97 +
    1.98 +  int encoding() const _STLP_NOTHROW { return do_encoding(); }
    1.99 +
   1.100 +  bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); }
   1.101 +
   1.102 +  int length(const state_type& __state,
   1.103 +             const char* __from, const char* __end,
   1.104 +             size_t __max) const
   1.105 +    { return do_length(__state, __from, __end, __max); }
   1.106 +  
   1.107 +  int max_length() const _STLP_NOTHROW { return do_max_length(); }
   1.108 +
   1.109 +#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
   1.110 +    _STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
   1.111 +#else
   1.112 +  _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
   1.113 +#endif
   1.114 +
   1.115 +protected:
   1.116 +_STLP_DECLSPEC  ~codecvt();
   1.117 +
   1.118 +  _STLP_DECLSPEC virtual result do_out(mbstate_t&   /* __state */,
   1.119 +                        const char*  __from,
   1.120 +                        const char*  /* __from_end */,
   1.121 +                        const char*& __from_next,
   1.122 +                        char*        __to,
   1.123 +                        char*        /* __to_limit */,
   1.124 +                        char*&       __to_next) const;
   1.125 +
   1.126 +    _STLP_DECLSPEC virtual result do_in (mbstate_t&   /* __state */ , 
   1.127 +                        const char*  __from,
   1.128 +                        const char*  /* __from_end */,
   1.129 +                        const char*& __from_next,
   1.130 +                        char*        __to,
   1.131 +                        char*        /* __to_end */,
   1.132 +                        char*&       __to_next) const;
   1.133 +
   1.134 +  _STLP_DECLSPEC   virtual result do_unshift(mbstate_t& /* __state */,
   1.135 +                            char*      __to,
   1.136 +                            char*      /* __to_limit */,
   1.137 +                            char*&     __to_next) const;
   1.138 +
   1.139 +  _STLP_DECLSPEC   virtual int do_encoding() const _STLP_NOTHROW;
   1.140 +  _STLP_DECLSPEC   virtual bool do_always_noconv() const _STLP_NOTHROW;
   1.141 +  _STLP_DECLSPEC   virtual int do_length(const mbstate_t&         __state,
   1.142 +                        const  char* __from, 
   1.143 +                        const  char* __end,
   1.144 +                        size_t __max) const;
   1.145 +  _STLP_DECLSPEC   virtual int do_max_length() const _STLP_NOTHROW;
   1.146 +private:
   1.147 +  codecvt(const codecvt<char, char, mbstate_t>&);
   1.148 +  codecvt<char, char, mbstate_t>& operator =(const codecvt<char, char, mbstate_t>&); 
   1.149 +};
   1.150 +
   1.151 +# ifndef _STLP_NO_WCHAR_T
   1.152 + 
   1.153 +_STLP_TEMPLATE_NULL
   1.154 +#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
   1.155 +class codecvt<wchar_t, char, mbstate_t>  : public locale::facet, public codecvt_base
   1.156 +#else
   1.157 +class _STLP_CLASS_DECLSPEC codecvt<wchar_t, char, mbstate_t>  : public locale::facet, public codecvt_base
   1.158 +#endif
   1.159 +{
   1.160 +  friend class _Locale;
   1.161 +public:
   1.162 +  typedef wchar_t    intern_type;
   1.163 +  typedef char       extern_type;
   1.164 +  typedef mbstate_t  state_type;
   1.165 +
   1.166 +  explicit codecvt(size_t __refs = 0) : _BaseFacet(__refs) {}
   1.167 +
   1.168 +  result out(mbstate_t&       __state,
   1.169 +             const wchar_t*  __from,
   1.170 +             const wchar_t*  __from_end,
   1.171 +             const wchar_t*& __from_next,
   1.172 +             char*           __to,
   1.173 +             char*           __to_limit,
   1.174 +             char*&          __to_next) const {
   1.175 +    return do_out(__state,
   1.176 +                  __from, __from_end, __from_next, 
   1.177 +                  __to,   __to_limit, __to_next);
   1.178 +  }
   1.179 +
   1.180 +  result unshift(mbstate_t& __state,
   1.181 +                 char*  __to, char*  __to_limit, char*& __to_next) const {
   1.182 +    return do_unshift(__state, __to, __to_limit, __to_next);
   1.183 +  }
   1.184 +    
   1.185 +  result in(mbstate_t&    __state,
   1.186 +            const char*  __from,
   1.187 +            const char*  __from_end,  
   1.188 +            const char*& __from_next,
   1.189 +            wchar_t*     __to, 
   1.190 +            wchar_t*     __to_limit, 
   1.191 +            wchar_t*&    __to_next) const {
   1.192 +    return do_in(__state, 
   1.193 +                 __from, __from_end, __from_next,
   1.194 +                 __to,  __to_limit, __to_next);
   1.195 +  }
   1.196 +
   1.197 +  int encoding() const _STLP_NOTHROW { return do_encoding(); }
   1.198 +
   1.199 +  bool always_noconv() const _STLP_NOTHROW { return do_always_noconv(); }
   1.200 +
   1.201 +  int length(const mbstate_t&        __state,
   1.202 +             const char* __from,
   1.203 +             const char* __end,
   1.204 +             size_t             __max) const
   1.205 +    { return do_length(__state, __from, __end, __max); }
   1.206 +  
   1.207 +  int max_length() const _STLP_NOTHROW { return do_max_length(); }
   1.208 +
   1.209 +#if defined(__LIBSTD_CPP_SYMBIAN32_WSD__) || defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
   1.210 +	_STLP_STATIC_MEMBER_DECLSPEC static locale::id& GetFacetLocaleId();
   1.211 +#else
   1.212 +  	_STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
   1.213 +#endif
   1.214 +
   1.215 +protected:
   1.216 +    _STLP_DECLSPEC  ~codecvt();
   1.217 +
   1.218 +  _STLP_DECLSPEC   virtual result do_out(mbstate_t&         __state,
   1.219 +                        const wchar_t*  __from,
   1.220 +                        const wchar_t*  __from_end,
   1.221 +                        const wchar_t*& __from_next,
   1.222 +                        char*        __to,
   1.223 +                        char*        __to_limit,
   1.224 +                        char*&       __to_next) const;
   1.225 +
   1.226 +  _STLP_DECLSPEC   virtual result do_in (mbstate_t&         __state,
   1.227 +                        const char*  __from,
   1.228 +                        const char*  __from_end,
   1.229 +                        const char*& __from_next,
   1.230 +                        wchar_t*        __to,
   1.231 +                        wchar_t*        __to_limit,
   1.232 +                        wchar_t*&       __to_next) const;
   1.233 +
   1.234 +  _STLP_DECLSPEC   virtual result do_unshift(mbstate_t&   __state,
   1.235 +                            char*  __to, 
   1.236 +                            char*  __to_limit,
   1.237 +                            char*& __to_next) const;
   1.238 +
   1.239 +  _STLP_DECLSPEC   virtual int do_encoding() const _STLP_NOTHROW;
   1.240 +
   1.241 +  _STLP_DECLSPEC   virtual bool do_always_noconv() const _STLP_NOTHROW;
   1.242 +  
   1.243 +  _STLP_DECLSPEC   virtual int do_length(const mbstate_t& __state,
   1.244 +                        const  char* __from, 
   1.245 +                        const  char* __end,
   1.246 +                        size_t __max) const;
   1.247 +
   1.248 +  _STLP_DECLSPEC   virtual int do_max_length() const _STLP_NOTHROW;
   1.249 +
   1.250 +private:
   1.251 +  codecvt(const codecvt<wchar_t, char, mbstate_t>&);
   1.252 +  codecvt<wchar_t, char, mbstate_t>& operator = (const codecvt<wchar_t, char, mbstate_t>&);  
   1.253 +};
   1.254 +
   1.255 +# endif
   1.256 +
   1.257 +_STLP_TEMPLATE_NULL
   1.258 +class _STLP_CLASS_DECLSPEC codecvt_byname<char, char, mbstate_t>
   1.259 +  : public codecvt<char, char, mbstate_t> {
   1.260 +public:
   1.261 +  explicit _STLP_DECLSPEC codecvt_byname(const char* __name, size_t __refs = 0);
   1.262 +  ~codecvt_byname();
   1.263 +private:
   1.264 +  codecvt_byname(const codecvt_byname<char, char, mbstate_t>&);
   1.265 +  codecvt_byname<char, char, mbstate_t>& operator =(const codecvt_byname<char, char, mbstate_t>&);  
   1.266 +};
   1.267 +
   1.268 +# ifndef _STLP_NO_WCHAR_T
   1.269 +_STLP_TEMPLATE_NULL
   1.270 +class codecvt_byname<wchar_t, char, mbstate_t>
   1.271 +  : public codecvt<wchar_t, char, mbstate_t> 
   1.272 +{
   1.273 +public:
   1.274 +  explicit _STLP_DECLSPEC codecvt_byname(const char * __name, size_t __refs = 0);    
   1.275 +
   1.276 +protected:
   1.277 +    _STLP_DECLSPEC ~codecvt_byname();
   1.278 +
   1.279 +  _STLP_DECLSPEC   virtual result do_out(mbstate_t&         __state,
   1.280 +                        const wchar_t*  __from,
   1.281 +                        const wchar_t*  __from_end,
   1.282 +                        const wchar_t*& __from_next,
   1.283 +                        char*        __to,
   1.284 +                        char*        __to_limit,
   1.285 +                        char*&       __to_next) const;
   1.286 +
   1.287 +  _STLP_DECLSPEC   virtual result do_in (mbstate_t&         __state,
   1.288 +                        const char*  __from,
   1.289 +                        const char*  __from_end,
   1.290 +                        const char*& __from_next,
   1.291 +                        wchar_t*        __to,
   1.292 +                        wchar_t*        __to_limit,
   1.293 +                        wchar_t*&       __to_next) const;
   1.294 +
   1.295 +  _STLP_DECLSPEC   virtual result do_unshift(mbstate_t&   __state,
   1.296 +                            char*  __to, 
   1.297 +                            char*  __to_limit,
   1.298 +                            char*& __to_next) const;
   1.299 +
   1.300 +  _STLP_DECLSPEC   virtual int do_encoding() const _STLP_NOTHROW;
   1.301 +
   1.302 +  _STLP_DECLSPEC   virtual bool do_always_noconv() const _STLP_NOTHROW;
   1.303 +  
   1.304 +  _STLP_DECLSPEC   virtual int do_length(const mbstate_t&         __state,
   1.305 +                        const  char* __from, 
   1.306 +                        const  char* __end,
   1.307 +                        size_t __max) const;
   1.308 +
   1.309 +  _STLP_DECLSPEC   virtual int do_max_length() const _STLP_NOTHROW;
   1.310 +
   1.311 +private:
   1.312 +  _Locale_ctype* _M_ctype;
   1.313 +  codecvt_byname(const codecvt_byname<wchar_t, char, mbstate_t>&);
   1.314 +  codecvt_byname<wchar_t, char, mbstate_t>& operator =(const codecvt_byname<wchar_t, char, mbstate_t>&);  
   1.315 +};
   1.316 +
   1.317 +# endif
   1.318 +
   1.319 +_STLP_END_NAMESPACE
   1.320 +
   1.321 +#endif /* _STLP_INTERNAL_CODECVT_H */
   1.322 +
   1.323 +// Local Variables:
   1.324 +// mode:C++
   1.325 +// End:
   1.326 +