# string_type.h

Go to the documentation of this file.

    00001 /* $Id: string_type.h 23940 2012-02-12 19:46:40Z smatz $ */
    00002
    00003 /*
    00004  * This file is part of OpenTTD.
    00005  * 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.
    00006  * 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.
    00007  * 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/>.
    00008  */
    00009
    00012 #ifndef STRING_TYPE_H
    00013 #define STRING_TYPE_H
    00014
    00015 #include "core/enum_type.hpp"
    00016
    00018 #define NBSP "\xC2\xA0"
    00019
    00021 #define LRM "\xE2\x80\x8E"
    00022
    00026 enum CharSetFilter {
    00027   CS_ALPHANUMERAL,
    00028   CS_NUMERAL,
    00029   CS_NUMERAL_SPACE,
    00030   CS_ALPHA,
    00031   CS_HEXADECIMAL,
    00032 };
    00033
    00035 typedef uint32 WChar;
    00036
    00037 /* The following are directional formatting codes used to get the LTR and RTL strings right:
    00038  * http://www.unicode.org/unicode/reports/tr9/#Directional_Formatting_Codes */
    00039 static const WChar CHAR_TD_LRM = 0x200E;
    00040 static const WChar CHAR_TD_RLM = 0x200F;
    00041 static const WChar CHAR_TD_LRE = 0x202A;
    00042 static const WChar CHAR_TD_RLE = 0x202B;
    00043 static const WChar CHAR_TD_LRO = 0x202D;
    00044 static const WChar CHAR_TD_RLO = 0x202E;
    00045 static const WChar CHAR_TD_PDF = 0x202C;
    00046
    00048 enum StringValidationSettings {
    00049   SVS_NONE                       = 0,
    00050   SVS_REPLACE_WITH_QUESTION_MARK = 1 << 0,
    00051   SVS_ALLOW_NEWLINE              = 1 << 1,
    00052   SVS_ALLOW_CONTROL_CODE         = 1 << 2,
    00053 };
    00054 DECLARE_ENUM_AS_BIT_SET(StringValidationSettings)
    00055
    00056 #endif /* STRING_TYPE_H */