in UTF-8, and values above 0x10FFFF in UTF-32. Conformant code
63 | must check for illegal sequences.
64 |
65 | When the flag is set to lenient, characters over 0x10FFFF are converted
66 | to the replacement character; otherwise (when the flag is set to strict)
67 | they constitute an error.
68 |
69 | Output parameters:
70 | The value "sourceIllegal" is returned from some routines if the input
71 | sequence is malformed. When "sourceIllegal" is returned, the source
72 | value will point to the illegal value that caused the problem. E.g.,
73 | in UTF-8 when a sequence is malformed, it points to the start of the
74 | malformed sequence.
75 |
76 | Author: Mark E. Davis, 1994.
77 | Rev History: Rick McGowan, fixes & updates May 2001.
78 | Fixes & updates, Sept 2001.
79 |
80 | ------------------------------------------------------------------------ */
81 |
82 | /* ---------------------------------------------------------------------
83 | The following 4 definitions are compiler-specific.
84 | The C standard does not guarantee that wchar_t has at least
85 | 16 bits, so wchar_t is no less portable than unsigned short!
86 | All should be unsigned values to avoid sign extension during
87 | bit mask & shift operations.
88 | ------------------------------------------------------------------------ */
89 |
90 | typedef unsigned int UTF32; /* at least 32 bits */
91 | typedef unsigned short UTF16; /* at least 16 bits */
92 | typedef unsigned char UTF8; /* typically 8 bits */
93 | typedef unsigned char Boolean; /* 0 or 1 */
94 |
95 | /* Some fundamental constants */
96 | #define UNI_REPLACEMENT_CHAR (UTF32)0x0000FFFD
97 | #define UNI_MAX_BMP (UTF32)0x0000FFFF
98 | #define UNI_MAX_UTF16 (UTF32)0x0010FFFF
99 | #define UNI_MAX_UTF32 (UTF32)0x7FFFFFFF
100 | #define UNI_MAX_LEGAL_UTF32 (UTF32)0x0010FFFF
101 |
102 | typedef enum {
103 | conversionOK, /* conversion successful */
104 | sourceExhausted, /* partial character in source, but hit end */
105 | targetExhausted, /* insuff. room in target for conversion */
106 | sourceIllegal /* source sequence is illegal/malformed */
107 | } ConversionResult;
108 |
109 | typedef enum {
110 | strictConversion = 0,
111 | lenientConversion
112 | } ConversionFlags;
113 |
114 | /* This is for C++ and does no harm in C */
115 | #ifdef __cplusplus
116 | extern "C" {
117 | #endif
118 |
119 | ConversionResult ConvertUTF8toUTF16 (
120 | const UTF8** sourceStart, const UTF8* sourceEnd,
121 | UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
122 |
123 | ConversionResult ConvertUTF16toUTF8 (
124 | const UTF16** sourceStart, const UTF16* sourceEnd,
125 | UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
126 |
127 | ConversionResult ConvertUTF8toUTF32 (
128 | const UTF8** sourceStart, const UTF8* sourceEnd,
129 | UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
130 |
131 | ConversionResult ConvertUTF32toUTF8 (
132 | const UTF32** sourceStart, const UTF32* sourceEnd,
133 | UTF8** targetStart, UTF8* targetEnd, ConversionFlags flags);
134 |
135 | ConversionResult ConvertUTF16toUTF32 (
136 | const UTF16** sourceStart, const UTF16* sourceEnd,
137 | UTF32** targetStart, UTF32* targetEnd, ConversionFlags flags);
138 |
139 | ConversionResult ConvertUTF32toUTF16 (
140 | const UTF32** sourceStart, const UTF32* sourceEnd,
141 | UTF16** targetStart, UTF16* targetEnd, ConversionFlags flags);
142 |
143 | Boolean isLegalUTF8Sequence(const UTF8 *source, const UTF8 *sourceEnd);
144 |
145 | #ifdef __cplusplus
146 | }
147 | #endif
148 |
149 | /* --------------------------------------------------------------------- */
150 |
--------------------------------------------------------------------------------
/Manual Map Injector/includes/SimpleIni.h:
--------------------------------------------------------------------------------
1 | /** @mainpage
2 |
3 |
4 | Library | SimpleIni
5 | |
---|
File | SimpleIni.h
6 | |
---|
Author | Brodie Thiesfield
7 | |
---|
Source | https://github.com/brofield/simpleini
8 | |
---|
Version | 4.19
9 | |
---|
10 |
11 | Jump to the @link CSimpleIniTempl CSimpleIni @endlink interface documentation.
12 |
13 | @section intro INTRODUCTION
14 |
15 | This component allows an INI-style configuration file to be used on both
16 | Windows and Linux/Unix. It is fast, simple and source code using this
17 | component will compile unchanged on either OS.
18 |
19 |
20 | @section features FEATURES
21 |
22 | - MIT Licence allows free use in all software (including GPL and commercial)
23 | - multi-platform (Windows CE/9x/NT..10/etc, Linux, MacOSX, Unix)
24 | - loading and saving of INI-style configuration files
25 | - configuration files can have any newline format on all platforms
26 | - liberal acceptance of file format
27 | - key/values with no section
28 | - removal of whitespace around sections, keys and values
29 | - support for multi-line values (values with embedded newline characters)
30 | - optional support for multiple keys with the same name
31 | - optional case-insensitive sections and keys (for ASCII characters only)
32 | - saves files with sections and keys in the same order as they were loaded
33 | - preserves comments on the file, section and keys where possible.
34 | - supports both char or wchar_t programming interfaces
35 | - supports both MBCS (system locale) and UTF-8 file encodings
36 | - system locale does not need to be UTF-8 on Linux/Unix to load UTF-8 file
37 | - support for non-ASCII characters in section, keys, values and comments
38 | - support for non-standard character types or file encodings
39 | via user-written converter classes
40 | - support for adding/modifying values programmatically
41 | - compiles cleanly in the following compilers:
42 | - Windows/VC6 (warning level 3)
43 | - Windows/VC.NET 2003 (warning level 4)
44 | - Windows/VC 2005 (warning level 4)
45 | - Windows/VC 2019 (warning level 4)
46 | - Linux/gcc (-Wall)
47 |
48 |
49 | @section usage USAGE SUMMARY
50 |
51 | -# Decide if you will be using utf8 or MBCS files, and working with the
52 | data in utf8, wchar_t or ICU chars.
53 | -# If you will only be using straight utf8 files and access the data via the
54 | char interface, then you do not need any conversion library and could define
55 | SI_NO_CONVERSION. Note that no conversion also means no validation of the data.
56 | If no converter is specified then the default converter is SI_CONVERT_GENERIC
57 | on Mac/Linux and SI_CONVERT_WIN32 on Windows. If you need widechar support on
58 | Mac/Linux then use either SI_CONVERT_GENERIC or SI_CONVERT_ICU. These are also
59 | supported on all platforms.
60 | -# Define the appropriate symbol for the converter you wish to use and
61 | include the SimpleIni.h header file.
62 | -# Declare an instance of the appropriate class. Note that the following
63 | definitions are just shortcuts for commonly used types. Other types
64 | (PRUnichar, unsigned short, unsigned char) are also possible.
65 |
66 | Interface | Case-sensitive | Load UTF-8 | Load MBCS | Typedef
67 | |
---|
SI_NO_CONVERSION
68 | |
---|
char | No | Yes | No | CSimpleIniA
69 | |
char | Yes | Yes | No | CSimpleIniCaseA
70 | |
SI_CONVERT_GENERIC
71 | |
---|
char | No | Yes | Yes #1 | CSimpleIniA
72 | |
char | Yes | Yes | Yes | CSimpleIniCaseA
73 | |
wchar_t | No | Yes | Yes | CSimpleIniW
74 | |
wchar_t | Yes | Yes | Yes | CSimpleIniCaseW
75 | |
SI_CONVERT_WIN32
76 | |
---|
char | No | No #2 | Yes | CSimpleIniA
77 | |
char | Yes | Yes | Yes | CSimpleIniCaseA
78 | |
wchar_t | No | Yes | Yes | CSimpleIniW
79 | |
wchar_t | Yes | Yes | Yes | CSimpleIniCaseW
80 | |
SI_CONVERT_ICU
81 | |
---|
char | No | Yes | Yes | CSimpleIniA
82 | |
char | Yes | Yes | Yes | CSimpleIniCaseA
83 | |
UChar | No | Yes | Yes | CSimpleIniW
84 | |
UChar | Yes | Yes | Yes | CSimpleIniCaseW
85 | |
86 | #1 On Windows you are better to use CSimpleIniA with SI_CONVERT_WIN32.
87 | #2 Only affects Windows. On Windows this uses MBCS functions and
88 | so may fold case incorrectly leading to uncertain results.
89 | -# Call LoadData() or LoadFile() to load and parse the INI configuration file
90 | -# Access and modify the data of the file using the following functions
91 |
92 | GetAllSections | Return all section names
93 | |
GetAllKeys | Return all key names within a section
94 | |
GetAllValues | Return all values within a section & key
95 | |
GetSection | Return all key names and values in a section
96 | |
GetSectionSize | Return the number of keys in a section
97 | |
GetValue | Return a value for a section & key
98 | |
SetValue | Add or update a value for a section & key
99 | |
Delete | Remove a section, or a key from a section
100 | |
SectionExists | Does a section exist?
101 | |
KeyExists | Does a key exist?
102 | |
103 | -# Call Save() or SaveFile() to save the INI configuration data
104 |
105 | @section iostreams IO STREAMS
106 |
107 | SimpleIni supports reading from and writing to STL IO streams. Enable this
108 | by defining SI_SUPPORT_IOSTREAMS before including the SimpleIni.h header
109 | file. Ensure that if the streams are backed by a file (e.g. ifstream or
110 | ofstream) then the flag ios_base::binary has been used when the file was
111 | opened.
112 |
113 | @section multiline MULTI-LINE VALUES
114 |
115 | Values that span multiple lines are created using the following format.
116 |
117 |
118 | key = <<
122 |
123 | Note the following:
124 | - The text used for ENDTAG can be anything and is used to find
125 | where the multi-line text ends.
126 | - The newline after ENDTAG in the start tag, and the newline
127 | before ENDTAG in the end tag is not included in the data value.
128 | - The ending tag must be on it's own line with no whitespace before
129 | or after it.
130 | - The multi-line value is modified at load so that each line in the value
131 | is delimited by a single '\\n' character on all platforms. At save time
132 | it will be converted into the newline format used by the current
133 | platform.
134 |
135 | @section comments COMMENTS
136 |
137 | Comments are preserved in the file within the following restrictions:
138 | - Every file may have a single "file comment". It must start with the
139 | first character in the file, and will end with the first non-comment
140 | line in the file.
141 | - Every section may have a single "section comment". It will start
142 | with the first comment line following the file comment, or the last
143 | data entry. It ends at the beginning of the section.
144 | - Every key may have a single "key comment". This comment will start
145 | with the first comment line following the section start, or the file
146 | comment if there is no section name.
147 | - Comments are set at the time that the file, section or key is first
148 | created. The only way to modify a comment on a section or a key is to
149 | delete that entry and recreate it with the new comment. There is no
150 | way to change the file comment.
151 |
152 | @section save SAVE ORDER
153 |
154 | The sections and keys are written out in the same order as they were
155 | read in from the file. Sections and keys added to the data after the
156 | file has been loaded will be added to the end of the file when it is
157 | written. There is no way to specify the location of a section or key
158 | other than in first-created, first-saved order.
159 |
160 | @section notes NOTES
161 |
162 | - To load UTF-8 data on Windows 95, you need to use Microsoft Layer for
163 | Unicode, or SI_CONVERT_GENERIC, or SI_CONVERT_ICU.
164 | - When using SI_CONVERT_GENERIC, ConvertUTF.c must be compiled and linked.
165 | - When using SI_CONVERT_ICU, ICU header files must be on the include
166 | path and icuuc.lib must be linked in.
167 | - To load a UTF-8 file on Windows AND expose it with SI_CHAR == char,
168 | you should use SI_CONVERT_GENERIC.
169 | - The collation (sorting) order used for sections and keys returned from
170 | iterators is NOT DEFINED. If collation order of the text is important
171 | then it should be done yourself by either supplying a replacement
172 | SI_STRLESS class, or by sorting the strings external to this library.
173 | - Usage of the header on Windows can be disabled by defining
174 | SI_NO_MBCS. This is defined automatically on Windows CE platforms.
175 | - Not thread-safe so manage your own locking
176 |
177 | @section contrib CONTRIBUTIONS
178 |
179 | - 2010/05/03: Tobias Gehrig: added GetDoubleValue()
180 |
181 | @section licence MIT LICENCE
182 |
183 | The licence text below is the boilerplate "MIT Licence" used from:
184 | http://www.opensource.org/licenses/mit-license.php
185 |
186 | Copyright (c) 2006-2012, Brodie Thiesfield
187 |
188 | Permission is hereby granted, free of charge, to any person obtaining a copy
189 | of this software and associated documentation files (the "Software"), to deal
190 | in the Software without restriction, including without limitation the rights
191 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
192 | copies of the Software, and to permit persons to whom the Software is furnished
193 | to do so, subject to the following conditions:
194 |
195 | The above copyright notice and this permission notice shall be included in
196 | all copies or substantial portions of the Software.
197 |
198 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
199 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
200 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
201 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
202 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
203 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
204 | */
205 |
206 | #ifndef INCLUDED_SimpleIni_h
207 | #define INCLUDED_SimpleIni_h
208 |
209 | #if defined(_MSC_VER) && (_MSC_VER >= 1020)
210 | # pragma once
211 | #endif
212 |
213 | // Disable these warnings in MSVC:
214 | // 4127 "conditional expression is constant" as the conversion classes trigger
215 | // it with the statement if (sizeof(SI_CHAR) == sizeof(char)). This test will
216 | // be optimized away in a release build.
217 | // 4503 'insert' : decorated name length exceeded, name was truncated
218 | // 4702 "unreachable code" as the MS STL header causes it in release mode.
219 | // Again, the code causing the warning will be cleaned up by the compiler.
220 | // 4786 "identifier truncated to 256 characters" as this is thrown hundreds
221 | // of times VC6 as soon as STL is used.
222 | #ifdef _MSC_VER
223 | # pragma warning (push)
224 | # pragma warning (disable: 4127 4503 4702 4786)
225 | #endif
226 |
227 | #include
228 | #include
229 | #include
230 | #include