SourceMod SDK
1.7
|
Contains parse events for INI files. More...
#include <public/ITextParsers.h>
Public Member Functions | |
virtual unsigned int | GetTextParserVersion1 () |
Returns version number. | |
virtual bool | ReadINI_NewSection (const char *section, bool invalid_tokens, bool close_bracket, bool extra_tokens, unsigned int *curtok) |
Called when a new section is encountered in an INI file. More... | |
virtual bool | ReadINI_KeyValue (const char *key, const char *value, bool invalid_tokens, bool equal_token, bool quotes, unsigned int *curtok) |
Called when encountering a key/value pair in an INI file. More... | |
virtual bool | ReadINI_RawLine (const char *line, unsigned int *curtok) |
Called after a line has been preprocessed, if it has text. More... | |
Contains parse events for INI files.
The INI file format is defined as: WHITESPACE: 0x20,
, , IDENTIFIER: A-Z a-z 0-9 _ - , + . $ ? / STRING: Any set of symbols
Basic syntax is comprised of SECTIONs. A SECTION is defined as: [SECTIONNAME] OPTION OPTION OPTION...
SECTIONNAME is an IDENTIFIER. OPTION can be repeated any number of times, once per line. OPTION is defined as one of: KEY = "VALUE" KEY = VALUE KEY Where KEY is an IDENTIFIER and VALUE is a STRING.
WHITESPACE should always be omitted. COMMENTS should be stripped, and are defined as text occurring in: ;<TEXT>
Example file below. Note that The second line is technically invalid. The event handler must decide whether this should be allowed. –FILE BELOW– [gaben] hi = clams bye = "NO CLAMS"
[valve] cannot maintain products
|
inlinevirtual |
Called when encountering a key/value pair in an INI file.
key | Name of key. |
value | String containing value (with quotes stripped, if any). |
invalid_tokens | Whether or not the key contained invalid tokens. |
equal_token | There was an '=' sign present (in case the value is missing). |
quotes | Whether value was enclosed in quotes. |
curtok | Contains the token index of the start of the value string. This can be changed when returning false. |
|
inlinevirtual |
Called when a new section is encountered in an INI file.
section | Name of section in between the [ and ] characters. |
invalid_tokens | True if invalid tokens were detected in the name. |
close_bracket | True if a closing bracket was detected, false otherwise. |
extra_tokens | True if extra tokens were detected on the line. |
curtok | Contains current token in the line where the section name starts. You can add to this offset when failing to point to a token. |
|
inlinevirtual |
Called after a line has been preprocessed, if it has text.
line | Contents of line. |
curtok | Pointer to optionally store failed position in string. |