u5e
UnicodeTextC++Library
normalization_form_kd_utf32.cpp
1 /**
2  * \page normalization_form_kd_utf32 Example: Normalize a utf32 string in form KD
3  *
4  * This example covers the usage of u5e::filter with
5  * u5e::normalization_form_kd in order to normalize a utf32 string in
6  * the native endianess.
7  *
8  * \code
9  */// Example on how to iterate
10 
11 #include <u5e/utf32ne_string.hpp>
12 #include <u5e/filter.hpp>
13 #include <u5e/normalization_form_kd.hpp>
14 #include <stdio.h>
15 
16 int main(int argc, char **argv) {
17 
18  u5e::utf32ne_string input({ 0xC4, 0xFB03, 'n' });
19  u5e::utf32ne_string output;
22 
23  // print out the codepoints
24  for (u5e::utf32ne_string::const_iterator it = output.codepoint_cbegin();
25  it != output.codepoint_cend(); it++ ) {
26  printf(" U+%06llx", (long long unsigned int)*it);
27  }
28 
29  return 0;
30 }
31 /**
32  * \endcode
33  */
main u5e namespace
int filter(InputIteratorType input_from, InputIteratorType input_to, OutputType &output, Functor operation)
Walks an input iterator through a filter.
Definition: filter.hpp:46
basic_encodedstring< utf32ne, std::basic_string< int > > utf32ne_string
A basic_encodedstring of utf32ne and std::basic_string<int>
basic_encodedstring(const NativeString &s)
basic_grapheme_iterator< basic_encodedstring > grapheme_end()
int normalization_form_kd(basic_grapheme< InputStorageType > grapheme, OutputStorageType &output)
u5e::filter algorithm for normalizing graphemes
basic_grapheme_iterator< basic_encodedstring > grapheme_begin()