diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2020-12-15 22:23:46 +0300 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2021-02-25 13:39:56 +0300 |
commit | 949a9f572341b6cd07690f0b78b1b1941d320055 (patch) | |
tree | a4b9a32fb5a4cd6a46a17718cc854697df49c920 /xsd-frontend/types.cxx | |
parent | 061b59ec50c40e8757c5e9237f45a2c7ade36d62 (diff) |
Switch to build2
Diffstat (limited to 'xsd-frontend/types.cxx')
-rw-r--r-- | xsd-frontend/types.cxx | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/xsd-frontend/types.cxx b/xsd-frontend/types.cxx deleted file mode 100644 index b4a8cc9..0000000 --- a/xsd-frontend/types.cxx +++ /dev/null @@ -1,60 +0,0 @@ -// file : xsd-frontend/types.cxx -// license : GNU GPL v2 + exceptions; see accompanying LICENSE file - -#include <cstdlib> // std::mbstowcs - -#include <xsd-frontend/types.hxx> - -namespace XSDFrontend -{ - // NonRepresentable - // - char const* NonRepresentable:: - what () const throw () - { - return "character is not representable in the narrower encoding"; - } - - // StringTemplate - // - - // Specialization for char to wchar_t conversion. - // - template <> - void StringTemplate<wchar_t, char>:: - from_narrow (char const* s) - { - size_type size (std::mbstowcs (0, s, 0) + 1); - - // I dare to change the guts! - // - resize (size - 1); - - wchar_t* p (const_cast<wchar_t*> (data ())); - - std::mbstowcs (p, s, size); - } - - // Specialization for wchar_t to char conversion. - // - template <> - StringTemplate<char> StringTemplate<wchar_t, char>:: - to_narrow () const - { - size_type size (std::wcstombs (0, c_str (), 0)); - - if (size == size_type (-1)) - throw NonRepresentable (); - - // I dare to change the guts! - // - StringTemplate<char> r; - r.resize (size); - - char* p (const_cast<char*> (r.data ())); - - std::wcstombs (p, c_str (), size + 1); - - return r; - } -} |