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