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