summaryrefslogtreecommitdiff
path: root/libxsd-frontend/xsd-frontend/types.cxx
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2024-03-06 10:24:46 +0100
committerJörg Frings-Fürst <debian@jff.email>2024-03-06 10:24:46 +0100
commit372a0e99c2f61543d9e14d9933b59d9d1f4cb26e (patch)
treebbadf39aed0610c8f8f7b41fefff47773b8ac205 /libxsd-frontend/xsd-frontend/types.cxx
parent23d41842168ac1a1580111b9c5c73500ceee3d57 (diff)
parent4538829ab86b5a1cd4e845e7eab165029c9d6d46 (diff)
Merge branch 'feature/upstream' into develop
Diffstat (limited to 'libxsd-frontend/xsd-frontend/types.cxx')
-rw-r--r--libxsd-frontend/xsd-frontend/types.cxx61
1 files changed, 0 insertions, 61 deletions
diff --git a/libxsd-frontend/xsd-frontend/types.cxx b/libxsd-frontend/xsd-frontend/types.cxx
deleted file mode 100644
index 49faf92..0000000
--- a/libxsd-frontend/xsd-frontend/types.cxx
+++ /dev/null
@@ -1,61 +0,0 @@
-// file : xsd-frontend/types.cxx
-// copyright : Copyright (c) 2005-2014 Code Synthesis Tools CC
-// 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;
- }
-}