• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //  filesystem windows_file_codecvt.hpp  -----------------------------------------------//
2 
3 //  Copyright Beman Dawes 2009
4 
5 //  Distributed under the Boost Software License, Version 1.0.
6 //  See http://www.boost.org/LICENSE_1_0.txt
7 
8 //  Library home page: http://www.boost.org/libs/filesystem
9 
10 #ifndef BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP
11 #define BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP
12 
13 #include <boost/filesystem/config.hpp>
14 #include <cstddef>
15 #include <locale>
16 
17 //------------------------------------------------------------------------------------//
18 //                                                                                    //
19 //                          class windows_file_codecvt                                //
20 //                                                                                    //
21 //  Warning: partial implementation; even do_in and do_out only partially meet the    //
22 //  standard library specifications as the "to" buffer must hold the entire result.   //
23 //                                                                                    //
24 //------------------------------------------------------------------------------------//
25 
26 class BOOST_SYMBOL_VISIBLE windows_file_codecvt
27   : public std::codecvt< wchar_t, char, std::mbstate_t >
28 {
29 public:
windows_file_codecvt(std::size_t refs=0)30   explicit windows_file_codecvt(std::size_t refs = 0)
31       : std::codecvt<wchar_t, char, std::mbstate_t>(refs) {}
32 protected:
33 
do_always_noconv() const34   virtual bool do_always_noconv() const throw() { return false; }
35 
36   //  seems safest to assume variable number of characters since we don't
37   //  actually know what codepage is active
do_encoding() const38   virtual int do_encoding() const throw() { return 0; }
39 
40   virtual std::codecvt_base::result do_in(std::mbstate_t& state,
41     const char* from, const char* from_end, const char*& from_next,
42     wchar_t* to, wchar_t* to_end, wchar_t*& to_next) const;
43 
44   virtual std::codecvt_base::result do_out(std::mbstate_t & state,
45     const wchar_t* from, const wchar_t* from_end, const wchar_t*& from_next,
46     char* to, char* to_end, char*& to_next) const;
47 
do_unshift(std::mbstate_t &,char *,char *,char * &) const48   virtual std::codecvt_base::result do_unshift(std::mbstate_t&,
49       char* /*from*/, char* /*to*/, char* & /*next*/) const  { return ok; }
50 
do_length(std::mbstate_t &,const char *,const char *,std::size_t) const51   virtual int do_length(std::mbstate_t&,
52     const char* /*from*/, const char* /*from_end*/, std::size_t /*max*/) const  { return 0; }
53 
do_max_length() const54   virtual int do_max_length() const throw () { return 0; }
55 };
56 
57 #endif  // BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP
58