MCPcopy Create free account
hub / github.com/boostorg/filesystem / error_codecvt

Class error_codecvt

test/path_unit_test.cpp:845–883  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

843 // test_error_handling -------------------------------------------------------------//
844
845 class error_codecvt
846 : public std::codecvt< wchar_t, char, std::mbstate_t >
847 {
848 public:
849 explicit error_codecvt()
850 : std::codecvt<wchar_t, char, std::mbstate_t>() {}
851 protected:
852
853 virtual bool do_always_noconv() const throw() { return false; }
854 virtual int do_encoding() const throw() { return 0; }
855
856 virtual std::codecvt_base::result do_in(std::mbstate_t&,
857 const char*, const char*, const char*&,
858 wchar_t*, wchar_t*, wchar_t*&) const
859 {
860 static std::codecvt_base::result r = std::codecvt_base::noconv;
861 if (r == std::codecvt_base::partial) r = std::codecvt_base::error;
862 else if (r == std::codecvt_base::error) r = std::codecvt_base::noconv;
863 else r = std::codecvt_base::partial;
864 return r;
865 }
866
867 virtual std::codecvt_base::result do_out(std::mbstate_t &,
868 const wchar_t*, const wchar_t*, const wchar_t*&,
869 char*, char*, char*&) const
870 {
871 static std::codecvt_base::result r = std::codecvt_base::noconv;
872 if (r == std::codecvt_base::partial) r = std::codecvt_base::error;
873 else if (r == std::codecvt_base::error) r = std::codecvt_base::noconv;
874 else r = std::codecvt_base::partial;
875 return r;
876 }
877
878 virtual std::codecvt_base::result do_unshift(std::mbstate_t&,
879 char*, char*, char* &) const { return ok; }
880 virtual int do_length(std::mbstate_t &,
881 const char*, const char*, std::size_t) const { return 0; }
882 virtual int do_max_length() const throw () { return 0; }
883 };
884
885 void test_error_handling()
886 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected