1 // Boost.Filesystem mbpath.hpp ---------------------------------------------// 2 3 // Copyright Beman Dawes 2005 4 5 // Use, modification, and distribution is subject to the Boost Software 6 // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 // http://www.boost.org/LICENSE_1_0.txt) 8 9 // Encodes wide character paths as MBCS 10 // See http://../doc/path.htm#mbpath for more information 11 12 #include <boost/filesystem/path.hpp> 13 #include <cwchar> // for std::mbstate_t 14 #include <string> 15 #include <locale> 16 17 namespace user 18 { 19 struct mbpath_traits; 20 21 typedef boost::filesystem::basic_path<std::wstring, mbpath_traits> mbpath; 22 23 struct mbpath_traits 24 { 25 typedef std::wstring internal_string_type; 26 typedef std::string external_string_type; 27 28 static external_string_type to_external( const mbpath & ph, 29 const internal_string_type & src ); 30 31 static internal_string_type to_internal( const external_string_type & src ); 32 33 static void imbue( const std::locale & loc ); 34 }; 35 } // namespace user 36 37 namespace boost 38 { 39 namespace filesystem 40 { 41 template<> struct is_basic_path<user::mbpath> 42 { static const bool value = true; }; 43 } 44 } 45