nlib
UnicodeNormalizer.h
Go to the documentation of this file.
1 
2 /*--------------------------------------------------------------------------------*
3  Project: CrossRoad
4  Copyright (C)Nintendo All rights reserved.
5 
6  These coded instructions, statements, and computer programs contain proprietary
7  information of Nintendo and/or its licensed developers and are protected by
8  national and international copyright laws. They may not be disclosed to third
9  parties or copied or duplicated in any form, in whole or in part, without the
10  prior written consent of Nintendo.
11 
12  The content herein is highly confidential and should be handled accordingly.
13  *--------------------------------------------------------------------------------*/
14 
15 #pragma once
16 #ifndef INCLUDE_NN_NLIB_UNICODE_UNICODENORMALIZER_H_
17 #define INCLUDE_NN_NLIB_UNICODE_UNICODENORMALIZER_H_
18 
19 #include "nn/nlib/Config.h"
20 
21 NLIB_NAMESPACE_BEGIN
22 
23 class InputStream;
24 class OutputStream;
25 class TextWriter;
26 
27 namespace unicode {
28 
30  public:
36  NFC = kNfc,
37  NFD = kNfd,
38  NFKC = kNfkc,
39  NFKD = kNfkd
40  };
41  static errno_t Normalize(InputStream* istr, OutputStream* ostr, NormalizationForm form);
42 
43  static void DumpTable(TextWriter* w); // for debug
44  static uint32_t CheckTable(const uint32_t* data, size_t nwords); // for test
45  static bool CheckNormalizationTxt(const uint32_t* data); // for test
46 };
47 
48 } // namespace unicode
49 NLIB_NAMESPACE_END
50 
51 #endif // INCLUDE_NN_NLIB_UNICODE_UNICODENORMALIZER_H_
Converts using kNfd. Decomposes the unicode string using canonical decomposition, and reorders using canonical ordering. Characters such as voicing marks and acute accent characters are decomposed.
Converts using kNfkc. Decomposes the unicode string using compatibility decomposition, reorders using canonical ordering, and canonically composes. Wide character alphanumeric characters are converted to half-width (standard) alphanumeric characters, and diacritics are decomposed.
#define NLIB_VIS_PUBLIC
Symbols for functions and classes are made available outside of the library.
Definition: Platform_unix.h:89
NormalizationForm
Specifies the unicode normalization format.
Class used to normalize a unicode string.
The base class for input streams. This class cannot be instantiated.
Definition: InputStream.h:29
Convert using kNfc. Decomposes the unicode string using canonical decomposition, reorders using canonical ordering, and canonically composes. In most cases, the resulting string is the same as the source string.
A file that contains the configuration information for each development environment.
The class for writing text to streams.
Definition: TextWriter.h:33
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
Definition: Config.h:229
Converts using kNfkd. Decomposes the unicode string using compatibility decomposition, and reorders using canonical ordering. In addition to decomposing such characters as diacritics and acute accents, this function also performs other conversions such as changing full-width alphanumerics to half-width (standard), and decomposing enclosed alphanumerics.
The base class for output streams. This class cannot be instantiated.
Definition: OutputStream.h:30
int errno_t
Indicates with an int-type typedef that a POSIX error value is returned as the return value...
Definition: NMalloc.h:37