u5e
UnicodeTextC++Library
utf32ne.hpp
1 #ifndef INCLUDED_U5E_UTF32NE
2 #define INCLUDED_U5E_UTF32NE
3 
4 #include <type_traits>
5 #include <u5e/encoding_assertion.hpp>
6 #include <u5e/codepoint.hpp>
7 
8 namespace u5e {
9  /**
10  * \brief Architecture-specific type to interface UTF32BE or UTF32LE
11  *
12  * utf32ne is not an encoding. It is a type that should be used to
13  * interface with either UTF32BE or with UTF32LE depending on what
14  * the native endianess is.
15  *
16  * Because utf32 with the native endianess can be used natively,
17  * there's no special logic and everything is delegated to the
18  * native types.
19  */
20  class utf32ne {
21  public:
22  //@{
23  /**
24  * Delegate to the underlying iterator
25  */
26  template <typename NativeString>
27  using iterator = typename NativeString::iterator;
28 
29  template <typename NativeString>
30  using const_iterator = typename NativeString::const_iterator;
31 
32  template <typename NativeString>
33  static typename NativeString::const_iterator
34  native_const_iterator(typename NativeString::const_iterator it) {
35  return it;
36  }
37 
38  template <typename InputNativeIterator, typename OutputNativeString>
39  static void append_from_utf32ne
40  (InputNativeIterator first, InputNativeIterator last,
41  OutputNativeString& output) {
42  output.append(first, last);
43  }
44 
45  //@}
46  };
47 }
48 
49 #endif
main u5e namespace
static void append_from_utf32ne(InputNativeIterator first, InputNativeIterator last, OutputNativeString &output)
Definition: utf32ne.hpp:40
static NativeString::const_iterator native_const_iterator(typename NativeString::const_iterator it)
Definition: utf32ne.hpp:34
Architecture-specific type to interface UTF32BE or UTF32LE.
Definition: utf32ne.hpp:20