OpenTTD Source  20241120-master-g6d3adc6169
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 
16 #define NBSP "\u00a0"
17 
19 #define LRM "\u200e"
20 
31 };
32 
33 /* The following are directional formatting codes used to get the LTR and RTL strings right:
34  * http://www.unicode.org/unicode/reports/tr9/#Directional_Formatting_Codes */
35 static const char32_t CHAR_TD_LRM = 0x200E;
36 static const char32_t CHAR_TD_RLM = 0x200F;
37 static const char32_t CHAR_TD_LRE = 0x202A;
38 static const char32_t CHAR_TD_RLE = 0x202B;
39 static const char32_t CHAR_TD_LRO = 0x202D;
40 static const char32_t CHAR_TD_RLO = 0x202E;
41 static const char32_t CHAR_TD_PDF = 0x202C;
42 
45  SVS_NONE = 0,
47  SVS_ALLOW_NEWLINE = 1 << 1,
55 };
57 
58 
59 
60 typedef std::vector<std::string> StringList;
61 
62 #endif /* STRING_TYPE_H */
DECLARE_ENUM_AS_BIT_SET(GenderEthnicity) enum CompanyManagerFaceVariable
Bitgroups of the CompanyManagerFace variable.
Type (helpers) for enums.
CharSetFilter
Valid filter types for IsValidChar.
Definition: string_type.h:24
@ CS_NUMERAL_SPACE
Only numbers and spaces.
Definition: string_type.h:27
@ CS_HEXADECIMAL
Only hexadecimal characters.
Definition: string_type.h:30
@ CS_NUMERAL
Only numeric ones.
Definition: string_type.h:26
@ CS_NUMERAL_SIGNED
Only numbers and '-' for negative values.
Definition: string_type.h:28
@ CS_ALPHA
Only alphabetic values.
Definition: string_type.h:29
@ CS_ALPHANUMERAL
Both numeric and alphabetic and spaces and stuff.
Definition: string_type.h:25
static const char32_t CHAR_TD_RLE
The following text is embedded right-to-left.
Definition: string_type.h:38
static const char32_t CHAR_TD_LRO
Force the following characters to be treated as left-to-right characters.
Definition: string_type.h:39
StringValidationSettings
Settings for the string validation.
Definition: string_type.h:44
@ SVS_ALLOW_CONTROL_CODE
Allow the special control codes.
Definition: string_type.h:48
@ SVS_NONE
Allow nothing and replace nothing.
Definition: string_type.h:45
@ SVS_REPLACE_TAB_CR_NL_WITH_SPACE
Replace tabs ('\t'), carriage returns ('\r') and newlines (' ') with spaces.
Definition: string_type.h:54
@ SVS_ALLOW_NEWLINE
Allow newlines; replaces '\r ' with ' ' during processing.
Definition: string_type.h:47
@ SVS_REPLACE_WITH_QUESTION_MARK
Replace the unknown/bad bits with question marks.
Definition: string_type.h:46
static const char32_t CHAR_TD_LRM
The next character acts like a left-to-right character.
Definition: string_type.h:35
static const char32_t CHAR_TD_RLO
Force the following characters to be treated as right-to-left characters.
Definition: string_type.h:40
static const char32_t CHAR_TD_LRE
The following text is embedded left-to-right.
Definition: string_type.h:37
static const char32_t CHAR_TD_RLM
The next character acts like a right-to-left character.
Definition: string_type.h:36
std::vector< std::string > StringList
Type for a list of strings.
Definition: string_type.h:60
static const char32_t CHAR_TD_PDF
Restore the text-direction state to before the last LRE, RLE, LRO or RLO.
Definition: string_type.h:41