sl@0: /* sl@0: * Copyright (c) 1999 sl@0: * Silicon Graphics Computer Systems, Inc. sl@0: * sl@0: * Copyright (c) 1999 sl@0: * Boris Fomitchev sl@0: * sl@0: * This material is provided "as is", with absolutely no warranty expressed sl@0: * or implied. Any use is at your own risk. sl@0: * sl@0: * Permission to use or copy this software for any purpose is hereby granted sl@0: * without fee, provided the above notices are retained on all copies. sl@0: * Permission to modify the code and to distribute modified code is granted, sl@0: * provided the above notices are retained, and a notice that the code was sl@0: * modified is included with the above copyright notice. sl@0: * sl@0: */ sl@0: # include "stlport_prefix.h" sl@0: sl@0: # ifndef _STLP_NO_MBSTATE_T sl@0: sl@0: #include sl@0: #include sl@0: sl@0: _STLP_BEGIN_NAMESPACE sl@0: sl@0: //---------------------------------------------------------------------- sl@0: // codecvt sl@0: sl@0: _STLP_EXP_DECLSPEC codecvt::~codecvt() {} sl@0: sl@0: _STLP_EXP_DECLSPEC int codecvt::do_length(const mbstate_t&, sl@0: const char* from, sl@0: const char* end, sl@0: size_t mx) const sl@0: { sl@0: return (int)(min) ( __STATIC_CAST(size_t, (end - from)), mx); sl@0: } sl@0: sl@0: _STLP_EXP_DECLSPEC int codecvt::do_max_length() const _STLP_NOTHROW sl@0: { sl@0: return 1; sl@0: } sl@0: sl@0: bool _STLP_EXP_DECLSPEC sl@0: codecvt::do_always_noconv() const _STLP_NOTHROW sl@0: { sl@0: return true; sl@0: } sl@0: sl@0: _STLP_EXP_DECLSPEC int sl@0: codecvt::do_encoding() const _STLP_NOTHROW sl@0: { sl@0: return 1; sl@0: } sl@0: sl@0: sl@0: _STLP_EXP_DECLSPEC codecvt_base::result sl@0: codecvt::do_unshift(mbstate_t& /* __state */, sl@0: char* __to, sl@0: char* /* __to_limit */, sl@0: char*& __to_next) const sl@0: { __to_next = __to; return noconv; } sl@0: sl@0: _STLP_EXP_DECLSPEC codecvt_base::result sl@0: codecvt::do_in (mbstate_t& /* __state */ , sl@0: const char* __from, sl@0: const char* /* __from_end */, sl@0: const char*& __from_next, sl@0: char* __to, sl@0: char* /* __to_end */, sl@0: char*& __to_next) const sl@0: { __from_next = __from; __to_next = __to; return noconv; } sl@0: sl@0: _STLP_EXP_DECLSPEC codecvt_base::result sl@0: codecvt::do_out(mbstate_t& /* __state */, sl@0: const char* __from, sl@0: const char* /* __from_end */, sl@0: const char*& __from_next, sl@0: char* __to, sl@0: char* /* __to_limit */, sl@0: char*& __to_next) const sl@0: { __from_next = __from; __to_next = __to; return noconv; } sl@0: sl@0: sl@0: # ifndef _STLP_NO_WCHAR_T sl@0: //---------------------------------------------------------------------- sl@0: // codecvt sl@0: sl@0: _STLP_EXP_DECLSPEC codecvt::~codecvt() {} sl@0: sl@0: sl@0: _STLP_EXP_DECLSPEC codecvt::result sl@0: codecvt::do_out(state_type& /* state */, sl@0: const intern_type* from, sl@0: const intern_type* from_end, sl@0: const intern_type*& from_next, sl@0: extern_type* to, sl@0: extern_type* to_limit, sl@0: extern_type*& to_next) const sl@0: { sl@0: ptrdiff_t len = (min) (from_end - from, to_limit - to); sl@0: copy(from, from + len, to); sl@0: from_next = from + len; sl@0: to_next = to + len; sl@0: return ok; sl@0: } sl@0: sl@0: _STLP_EXP_DECLSPEC codecvt::result sl@0: codecvt::do_in (state_type& /* state */, sl@0: const extern_type* from, sl@0: const extern_type* from_end, sl@0: const extern_type*& from_next, sl@0: intern_type* to, sl@0: intern_type* to_limit, sl@0: intern_type*& to_next) const sl@0: { sl@0: ptrdiff_t len = (min) (from_end - from, to_limit - to); sl@0: copy(from, from + len, to); sl@0: from_next = from + len; sl@0: to_next = to + len; sl@0: return ok; sl@0: } sl@0: sl@0: _STLP_EXP_DECLSPEC codecvt::result sl@0: codecvt::do_unshift(state_type& /* state */, sl@0: extern_type* to, sl@0: extern_type* , sl@0: extern_type*& to_next) const sl@0: { sl@0: to_next = to; sl@0: return noconv; sl@0: } sl@0: sl@0: _STLP_EXP_DECLSPEC int codecvt::do_encoding() const _STLP_NOTHROW { sl@0: //return 1; sl@0: return 0;//don't know how many char required to make wchar_t, depends on locale sl@0: } sl@0: sl@0: sl@0: _STLP_EXP_DECLSPEC bool codecvt::do_always_noconv() const _STLP_NOTHROW sl@0: { sl@0: // return true; //gnu bug fix sl@0: return false; sl@0: } sl@0: sl@0: _STLP_EXP_DECLSPEC int codecvt::do_length(const state_type&, sl@0: const extern_type* from, sl@0: const extern_type* end, sl@0: size_t mx) const sl@0: { sl@0: return (int)(min) ((size_t) (end - from), mx); sl@0: } sl@0: sl@0: _STLP_EXP_DECLSPEC int codecvt::do_max_length() const _STLP_NOTHROW { sl@0: return 1; sl@0: } sl@0: # endif /* wchar_t */ sl@0: sl@0: _STLP_END_NAMESPACE sl@0: sl@0: # endif /* _STLP_NO_MBSTATE_T */ sl@0: sl@0: // Local Variables: sl@0: // mode:C++ sl@0: // End: sl@0: