ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

codecvt.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1999
00003  * Silicon Graphics Computer Systems, Inc.
00004  *
00005  * Copyright (c) 1999
00006  * Boris Fomitchev
00007  *
00008  * This material is provided "as is", with absolutely no warranty expressed
00009  * or implied. Any use is at your own risk.
00010  *
00011  * Permission to use or copy this software for any purpose is hereby granted
00012  * without fee, provided the above notices are retained on all copies.
00013  * Permission to modify the code and to distribute modified code is granted,
00014  * provided the above notices are retained, and a notice that the code was
00015  * modified is included with the above copyright notice.
00016  *
00017  */
00018 #include "stlport_prefix.h"
00019 
00020 #include <locale>
00021 #include <algorithm>
00022 
00023 _STLP_BEGIN_NAMESPACE
00024 
00025 //----------------------------------------------------------------------
00026 // codecvt<char, char, mbstate_t>
00027 
00028 codecvt<char, char, mbstate_t>::~codecvt() {}
00029 
00030 int codecvt<char, char, mbstate_t>::do_length(state_type&,
00031                                               const  char* from,
00032                                               const  char* end,
00033                                               size_t mx) const
00034 { return (int)(min) ( __STATIC_CAST(size_t, (end - from)), mx); }
00035 
00036 int codecvt<char, char, mbstate_t>::do_max_length() const _STLP_NOTHROW
00037 { return 1; }
00038 
00039 bool
00040 codecvt<char, char, mbstate_t>::do_always_noconv() const _STLP_NOTHROW
00041 { return true; }
00042 
00043 int
00044 codecvt<char, char, mbstate_t>::do_encoding() const _STLP_NOTHROW
00045 { return 1; }
00046 
00047 codecvt_base::result
00048 codecvt<char, char, mbstate_t>::do_unshift(state_type& /* __state */,
00049                                            char*       __to,
00050                                            char*       /* __to_limit */,
00051                                            char*&      __to_next) const
00052 { __to_next = __to; return noconv; }
00053 
00054 codecvt_base::result
00055 codecvt<char, char, mbstate_t>::do_in (state_type&  /* __state */ ,
00056                                        const char*  __from,
00057                                        const char*  /* __from_end */,
00058                                        const char*& __from_next,
00059                                        char*        __to,
00060                                        char*        /* __to_end */,
00061                                        char*&       __to_next) const
00062 { __from_next = __from; __to_next   = __to; return noconv; }
00063 
00064 codecvt_base::result
00065 codecvt<char, char, mbstate_t>::do_out(state_type&  /* __state */,
00066                                        const char*  __from,
00067                                        const char*  /* __from_end */,
00068                                        const char*& __from_next,
00069                                        char*        __to,
00070                                        char*        /* __to_limit */,
00071                                        char*&       __to_next) const
00072 { __from_next = __from; __to_next   = __to; return noconv; }
00073 
00074 
00075 #if !defined (_STLP_NO_WCHAR_T)
00076 //----------------------------------------------------------------------
00077 // codecvt<wchar_t, char, mbstate_t>
00078 
00079 codecvt<wchar_t, char, mbstate_t>::~codecvt() {}
00080 
00081 
00082 codecvt<wchar_t, char, mbstate_t>::result
00083 codecvt<wchar_t, char, mbstate_t>::do_out(state_type&         /* state */,
00084                                           const intern_type*  from,
00085                                           const intern_type*  from_end,
00086                                           const intern_type*& from_next,
00087                                           extern_type*        to,
00088                                           extern_type*        to_limit,
00089                                           extern_type*&       to_next) const {
00090   ptrdiff_t len = (min) (from_end - from, to_limit - to);
00091   copy(from, from + len, to);
00092   from_next = from + len;
00093   to_next   = to   + len;
00094   return ok;
00095 }
00096 
00097 codecvt<wchar_t, char, mbstate_t>::result
00098 codecvt<wchar_t, char, mbstate_t>::do_in (state_type&       /* state */,
00099                                           const extern_type*  from,
00100                                           const extern_type*  from_end,
00101                                           const extern_type*& from_next,
00102                                           intern_type*        to,
00103                                           intern_type*        to_limit,
00104                                           intern_type*&       to_next) const {
00105   ptrdiff_t len = (min) (from_end - from, to_limit - to);
00106   copy(__REINTERPRET_CAST(const unsigned char*, from),
00107        __REINTERPRET_CAST(const unsigned char*, from) + len, to);
00108   from_next = from + len;
00109   to_next   = to   + len;
00110   return ok;
00111 }
00112 
00113 codecvt<wchar_t, char, mbstate_t>::result
00114 codecvt<wchar_t, char, mbstate_t>::do_unshift(state_type&   /* state */,
00115                                               extern_type*  to,
00116                                               extern_type*  ,
00117                                               extern_type*& to_next) const {
00118   to_next = to;
00119   return noconv;
00120 }
00121 
00122 int codecvt<wchar_t, char, mbstate_t>::do_encoding() const _STLP_NOTHROW
00123 { return 1; }
00124 
00125 bool codecvt<wchar_t, char, mbstate_t>::do_always_noconv() const _STLP_NOTHROW
00126 { return true; }
00127 
00128 int codecvt<wchar_t, char, mbstate_t>::do_length(state_type&,
00129                                                  const  extern_type* from,
00130                                                  const  extern_type* end,
00131                                                  size_t mx) const
00132 { return (int)(min) ((size_t) (end - from), mx); }
00133 
00134 int codecvt<wchar_t, char, mbstate_t>::do_max_length() const _STLP_NOTHROW
00135 { return 1; }
00136 #endif /* wchar_t */
00137 
00138 _STLP_END_NAMESPACE
00139 
00140 // Local Variables:
00141 // mode:C++
00142 // End:
00143 

Generated on Sat May 26 2012 04:34:00 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.