nlib
StringPrep.h
Go to the documentation of this file.
1 
2 #pragma once
3 #ifndef INCLUDE_NN_NLIB_UNICODE_STRINGPREP_H_
4 #define INCLUDE_NN_NLIB_UNICODE_STRINGPREP_H_
5 
6 #include "nn/nlib/Config.h"
7 
8 NLIB_NAMESPACE_BEGIN
9 namespace unicode {
10 
12  size_t n;
13  uint32_t code[4];
14 };
15 
17  // See RFC3454
18  public:
19  NLIB_VIS_PUBLIC static bool InTableA1(uint32_t utf32) NLIB_NOEXCEPT;
20 
21  NLIB_VIS_PUBLIC static bool InTableB1(uint32_t utf32) NLIB_NOEXCEPT;
22  NLIB_VIS_PUBLIC static bool MapTableB2(uint32_t utf32, StringPrepMapResult* m) NLIB_NOEXCEPT;
23  NLIB_VIS_PUBLIC static bool MapTableB3(uint32_t utf32, StringPrepMapResult* m) NLIB_NOEXCEPT;
24 
25  static bool InTableC11(uint32_t utf32) NLIB_NOEXCEPT { return utf32 == 0x0020; }
26  NLIB_VIS_PUBLIC static bool InTableC12(uint32_t utf32) NLIB_NOEXCEPT;
27  static bool InTableC21(uint32_t utf32) NLIB_NOEXCEPT {
28  return utf32 < 0x0020 || utf32 == 0x007F;
29  }
30  NLIB_VIS_PUBLIC static bool InTableC22(uint32_t utf32) NLIB_NOEXCEPT;
31 
32  NLIB_VIS_PUBLIC static bool InTableC3(uint32_t utf32) NLIB_NOEXCEPT;
33  NLIB_VIS_PUBLIC static bool InTableC4(uint32_t utf32) NLIB_NOEXCEPT;
34  static bool InTableC5(uint32_t utf32) NLIB_NOEXCEPT {
35  return utf32 >= 0xD800 && utf32 <= 0xDFFF;
36  }
37  static bool InTableC6(uint32_t utf32) NLIB_NOEXCEPT {
38  return utf32 >= 0xFFF9 && utf32 <= 0xFFFD;
39  }
40  static bool InTableC7(uint32_t utf32) NLIB_NOEXCEPT {
41  return utf32 >= 0x2FF0 && utf32 <= 0x2FFB;
42  }
43  NLIB_VIS_PUBLIC static bool InTableC8(uint32_t utf32) NLIB_NOEXCEPT;
44  static bool InTableC9(uint32_t utf32) NLIB_NOEXCEPT {
45  return utf32 == 0xE0001 || (utf32 >= 0xE0020 && utf32 <= 0xE007F);
46  }
47  NLIB_VIS_PUBLIC static bool InTableD1(uint32_t utf32) NLIB_NOEXCEPT;
48  NLIB_VIS_PUBLIC static bool InTableD2(uint32_t utf32) NLIB_NOEXCEPT;
49 };
50 
51 } // namespace unicode
52 NLIB_NAMESPACE_END
53 
54 #endif // INCLUDE_NN_NLIB_UNICODE_STRINGPREP_H_
static bool InTableC9(uint32_t utf32) noexcept
Determines whether the character is described in RFC 3454, C.9 (Tagging characters).
Definition: StringPrep.h:44
Implements various tables defined in RFC3454.
Definition: StringPrep.h:16
#define NLIB_VIS_PUBLIC
Symbols for functions and classes are made available outside of the library.
Definition: Platform_unix.h:61
Data structure to store mapping results from StringPrep.
Definition: StringPrep.h:11
static bool InTableC11(uint32_t utf32) noexcept
Determines whether the character is described in RFC 3454, C.1.1 (ASCII space characters).
Definition: StringPrep.h:25
size_t n
Number of characters stored in StringPrepMapResult::code.
Definition: StringPrep.h:12
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
Definition: Config.h:86
A file that contains the configuration information for each development environment.
static bool InTableC5(uint32_t utf32) noexcept
Determines whether the character is described in RFC 3454, C.5 (Surrogate codes). ...
Definition: StringPrep.h:34
static bool InTableC6(uint32_t utf32) noexcept
Determines whether the character is described in RFC 3454, C.6 (Inappropriate for plain text)...
Definition: StringPrep.h:37
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.
Definition: Config.h:211
static bool InTableC21(uint32_t utf32) noexcept
Determines whether the character is described in RFC 3454, C.2.1 (ASCII control characters).
Definition: StringPrep.h:27
static bool InTableC7(uint32_t utf32) noexcept
Determines whether the character is described in RFC 3454, C.7 (Inappropriate for canonical represent...
Definition: StringPrep.h:40