Nazara Engine  0.4
A fast, complete, cross-platform API designed for game development
Unicode.hpp
1 // Copyright (C) 2017 Jérôme Leclercq
2 // This file is part of the "Nazara Engine - Core module"
3 // For conditions of distribution and use, see copyright notice in Config.hpp
4 
5 #pragma once
6 
7 #ifndef NAZARA_UNICODE_HPP
8 #define NAZARA_UNICODE_HPP
9 
10 #include <Nazara/Prerequesites.hpp>
11 #include <Nazara/Core/Config.hpp>
12 
13 namespace Nz
14 {
15  class NAZARA_CORE_API Unicode
16  {
17  public:
18  Unicode() = delete;
19  ~Unicode() = delete;
20  /*
21  Unicode category:
22  -Values between 0x01 and 0x80 specify the category
23  -Values between 0x100 and 0x10000 specify the subcategory
24  */
25  enum Category : UInt16
26  {
27  // Category not handled by Nazara
28  Category_NoCategory = 0,
29 
30  // Letters
31  Category_Letter = 0x01, // L
32  Category_Letter_Lowercase = Category_Letter | 0x0100, // Ll
33  Category_Letter_Modifier = Category_Letter | 0x0200, // Lm
34  Category_Letter_Other = Category_Letter | 0x0400, // Lo
35  Category_Letter_Titlecase = Category_Letter | 0x0800, // Lt
36  Category_Letter_Uppercase = Category_Letter | 0x1000, // Lu
37 
38  // Marks
39  Category_Mark = 0x02, // M
40  Category_Mark_Enclosing = Category_Mark | 0x100, // Me
41  Category_Mark_NonSpacing = Category_Mark | 0x200, // Mn
42  Category_Mark_SpacingCombining = Category_Mark | 0x400, // Mc
43 
44  // Numbers
45  Category_Number = 0x04, // N
46  Category_Number_DecimalDigit = Category_Number | 0x100, // Nd
47  Category_Number_Letter = Category_Number | 0x200, // Nl
48  Category_Number_Other = Category_Number | 0x400, // No
49 
50  // Others
51  Category_Other = 0x08, // C
52  Category_Other_Control = Category_Other | 0x0100, // Cc
53  Category_Other_Format = Category_Other | 0x0200, // Cf
54  Category_Other_NotAssigned = Category_Other | 0x0400, // Cn
55  Category_Other_PrivateUse = Category_Other | 0x0800, // Co
56  Category_Other_Surrogate = Category_Other | 0x1000, // Cs
57 
58  // Ponctuations
59  Category_Punctuation = 0x10, // P
60  Category_Punctuation_Close = Category_Punctuation | 0x0100, // Pe
61  Category_Punctuation_Connector = Category_Punctuation | 0x0200, // Pc
62  Category_Punctuation_Dash = Category_Punctuation | 0x0400, // Pd
63  Category_Punctuation_FinalQuote = Category_Punctuation | 0x0800, // Pf
64  Category_Punctuation_InitialQuote = Category_Punctuation | 0x1000, // Pi
65  Category_Punctuation_Open = Category_Punctuation | 0x2000, // Ps
66  Category_Punctuation_Other = Category_Punctuation | 0x4000, // Po
67 
68  // Spaces
69  Category_Separator = 0x20, // Z
70  Category_Separator_Line = Category_Separator | 0x0100, // Zl
71  Category_Separator_Paragraph = Category_Separator | 0x0200, // Zp
72  Category_Separator_Space = Category_Separator | 0x0400, // Zs
73 
74  // Symbols
75  Category_Symbol = 0x40, // S
76  Category_Symbol_Currency = Category_Symbol | 0x0100, // Sc
77  Category_Symbol_Math = Category_Symbol | 0x0200, // Sm
78  Category_Symbol_Modifier = Category_Symbol | 0x0400, // Sk
79  Category_Symbol_Other = Category_Symbol | 0x0800 // So
80  };
81 
82  enum Direction : UInt8
83  {
84  Direction_Arabic_Letter, // AL
85  Direction_Arabic_Number, // AN
86  Direction_Boundary_Neutral, // BN
87  Direction_Common_Separator, // CS
88  Direction_European_Number, // EN
89  Direction_European_Separator, // ES
90  Direction_European_Terminator, // ET
91  Direction_Left_To_Right, // L
92  Direction_Left_To_Right_Embedding, // LRE
93  Direction_Left_To_Right_Override, // LRO
94  Direction_Nonspacing_Mark, // NSM
95  Direction_Other_Neutral, // ON
96  Direction_Paragraph_Separator, // B
97  Direction_Pop_Directional_Format, // PDF
98  Direction_Right_To_Left, // R
99  Direction_Right_To_Left_Embedding, // RLE
100  Direction_Right_To_Left_Override, // RLO
101  Direction_Segment_Separator, // S
102  Direction_White_Space // WS
103  };
104 
105  static Category GetCategory(char32_t character);
106  static Direction GetDirection(char32_t character);
107  static char32_t GetLowercase(char32_t character);
108  static char32_t GetTitlecase(char32_t character);
109  static char32_t GetUppercase(char32_t character);
110  };
111 }
112 
113 #endif // NAZARA_UNICODE_HPP
TODO: Inherit SoundEmitter from Node.
Definition: Algorithm.hpp:12
Core class that represents a Unicode character.
Definition: Unicode.hpp:15