OpenTTD Source  12.0-beta2
string_type.h
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6  */
7 
10 #ifndef STRING_TYPE_H
11 #define STRING_TYPE_H
12 
13 #include "core/enum_type.hpp"
14 #include <vector>
15 #include <string>
16 
18 #define NBSP u8"\u00a0"
19 
21 #define LRM u8"\u200e"
22 
32 };
33 
35 typedef char32_t WChar;
36 
37 /* The following are directional formatting codes used to get the LTR and RTL strings right:
38  * http://www.unicode.org/unicode/reports/tr9/#Directional_Formatting_Codes */
39 static const WChar CHAR_TD_LRM = 0x200E;
40 static const WChar CHAR_TD_RLM = 0x200F;
41 static const WChar CHAR_TD_LRE = 0x202A;
42 static const WChar CHAR_TD_RLE = 0x202B;
43 static const WChar CHAR_TD_LRO = 0x202D;
44 static const WChar CHAR_TD_RLO = 0x202E;
45 static const WChar CHAR_TD_PDF = 0x202C;
46 
49  SVS_NONE = 0,
51  SVS_ALLOW_NEWLINE = 1 << 1,
53 };
55 
56 
57 
58 typedef std::vector<std::string> StringList;
59 
60 #endif /* STRING_TYPE_H */
WChar
char32_t WChar
Type for wide characters, i.e.
Definition: string_type.h:35
SVS_ALLOW_NEWLINE
@ SVS_ALLOW_NEWLINE
Allow newlines.
Definition: string_type.h:51
CHAR_TD_LRO
static const WChar CHAR_TD_LRO
Force the following characters to be treated as left-to-right characters.
Definition: string_type.h:43
CS_ALPHA
@ CS_ALPHA
Only alphabetic values.
Definition: string_type.h:30
CHAR_TD_RLO
static const WChar CHAR_TD_RLO
Force the following characters to be treated as right-to-left characters.
Definition: string_type.h:44
CHAR_TD_RLE
static const WChar CHAR_TD_RLE
The following text is embedded right-to-left.
Definition: string_type.h:42
SVS_ALLOW_CONTROL_CODE
@ SVS_ALLOW_CONTROL_CODE
Allow the special control codes.
Definition: string_type.h:52
CHAR_TD_PDF
static const WChar CHAR_TD_PDF
Restore the text-direction state to before the last LRE, RLE, LRO or RLO.
Definition: string_type.h:45
CHAR_TD_LRE
static const WChar CHAR_TD_LRE
The following text is embedded left-to-right.
Definition: string_type.h:41
StringList
std::vector< std::string > StringList
Type for a list of strings.
Definition: string_type.h:58
CHAR_TD_RLM
static const WChar CHAR_TD_RLM
The next character acts like a right-to-left character.
Definition: string_type.h:40
CS_ALPHANUMERAL
@ CS_ALPHANUMERAL
Both numeric and alphabetic and spaces and stuff.
Definition: string_type.h:27
StringValidationSettings
StringValidationSettings
Settings for the string validation.
Definition: string_type.h:48
enum_type.hpp
SVS_NONE
@ SVS_NONE
Allow nothing and replace nothing.
Definition: string_type.h:49
DECLARE_ENUM_AS_BIT_SET
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
Definition: company_manager_face.h:29
CHAR_TD_LRM
static const WChar CHAR_TD_LRM
The next character acts like a left-to-right character.
Definition: string_type.h:39
CS_NUMERAL_SPACE
@ CS_NUMERAL_SPACE
Only numbers and spaces.
Definition: string_type.h:29
CS_HEXADECIMAL
@ CS_HEXADECIMAL
Only hexadecimal characters.
Definition: string_type.h:31
SVS_REPLACE_WITH_QUESTION_MARK
@ SVS_REPLACE_WITH_QUESTION_MARK
Replace the unknown/bad bits with question marks.
Definition: string_type.h:50
CS_NUMERAL
@ CS_NUMERAL
Only numeric ones.
Definition: string_type.h:28
CharSetFilter
CharSetFilter
Valid filter types for IsValidChar.
Definition: string_type.h:26