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

Class error_codecvt

test/path_unit_test.cpp:1009–1049  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1007// test_error_handling -------------------------------------------------------------//
1008
1009class error_codecvt :
1010 public std::codecvt< wchar_t, char, std::mbstate_t >
1011{
1012public:
1013 explicit error_codecvt() :
1014 std::codecvt< wchar_t, char, std::mbstate_t >()
1015 {
1016 }
1017
1018protected:
1019 virtual bool do_always_noconv() const throw() { return false; }
1020 virtual int do_encoding() const throw() { return 0; }
1021
1022 virtual std::codecvt_base::result do_in(std::mbstate_t&, const char*, const char*, const char*&, wchar_t*, wchar_t*, wchar_t*&) const
1023 {
1024 static std::codecvt_base::result r = std::codecvt_base::noconv;
1025 if (r == std::codecvt_base::partial)
1026 r = std::codecvt_base::error;
1027 else if (r == std::codecvt_base::error)
1028 r = std::codecvt_base::noconv;
1029 else
1030 r = std::codecvt_base::partial;
1031 return r;
1032 }
1033
1034 virtual std::codecvt_base::result do_out(std::mbstate_t&, const wchar_t*, const wchar_t*, const wchar_t*&, char*, char*, char*&) const
1035 {
1036 static std::codecvt_base::result r = std::codecvt_base::noconv;
1037 if (r == std::codecvt_base::partial)
1038 r = std::codecvt_base::error;
1039 else if (r == std::codecvt_base::error)
1040 r = std::codecvt_base::noconv;
1041 else
1042 r = std::codecvt_base::partial;
1043 return r;
1044 }
1045
1046 virtual std::codecvt_base::result do_unshift(std::mbstate_t&, char*, char*, char*&) const { return ok; }
1047 virtual int do_length(std::mbstate_t&, const char*, const char*, std::size_t) const { return 0; }
1048 virtual int do_max_length() const throw() { return 0; }
1049};
1050
1051void test_error_handling()
1052{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected