#include <ConfigParser.h>
Classes | |
struct | ConfigEntry |
struct | ConfigKeyValuePair |
Public Types | |
using | ParseConfigEntryFunc = AZStd::function< bool(const ConfigEntry &)> |
using | CommentPrefixFunc = AZStd::function< AZStd::string_view(AZStd::string_view line)> |
using | SectionHeaderFunc = AZStd::function< AZStd::string_view(AZStd::string_view line)> |
using | DelimiterFunc = AZStd::function< ConfigKeyValuePair(AZStd::string_view line)> |
Static Public Member Functions | |
static AZStd::string_view | DefaultCommentPrefixFilter (AZStd::string_view line) |
static AZStd::string_view | DefaultSectionHeaderFilter (AZStd::string_view line) |
static ConfigKeyValuePair | DefaultDelimiterFunc (AZStd::string_view line) |
Public Attributes | |
ParseConfigEntryFunc | m_parseConfigEntryFunc |
CommentPrefixFunc | m_commentPrefixFunc = &DefaultCommentPrefixFilter |
SectionHeaderFunc | m_sectionHeaderFunc = &DefaultSectionHeaderFilter |
DelimiterFunc | m_delimiterFunc = &DefaultDelimiterFunc |
Settings structure which is used to determine how to parse Windows INI style config file(.cfg, .ini, etc...) It supports being able to supply a custom comment filter and section header filter The names of section headers are appended to the root Json pointer path member to form new root paths Ex. test.ini
using AZ::Settings::ConfigParserSettings::CommentPrefixFunc = AZStd::function<AZStd::string_view(AZStd::string_view line)> |
Callback function that is invoked when a line is read. returns a substr of the line which contains the non-commented portion of the line
using AZ::Settings::ConfigParserSettings::DelimiterFunc = AZStd::function<ConfigKeyValuePair(AZStd::string_view line)> |
Callback function which is invoked after a line has been filtered through the SectionHeaderFunc to split the key,value pair of a line NOTE: Leading and trailing whitespace will be removed from the line before invoking the callback
using AZ::Settings::ConfigParserSettings::ParseConfigEntryFunc = AZStd::function<bool(const ConfigEntry&)> |
Callback invoked with each parsed key, value (key=value)
entry from a Windows Style INI file with the section header if available [section header]
This is the the only member that is required to be set within this struct All other members are defaulted to work with INI style files IMPORTANT: Any lambda functions or class instances that are larger than 16 bytes in size requires a memory allocation to store. So it is recommmended that users binding a lambda bind at most 2 reference or pointer members to avoid dynamic heap allocations
NOTE: This function will not be called if the key is empty
using AZ::Settings::ConfigParserSettings::SectionHeaderFunc = AZStd::function<AZStd::string_view(AZStd::string_view line)> |
Callback function that is after a line has been filtered through the CommentPrefixFunc to determine if the text matches a section header NOTE: Leading and trailing whitespace will be removed from the line before invoking the callback
|
static |
Filters out line which start with a prefix of ';' or '#' If a line matches the comment filter and empty view is returned Otherwise the line is returned as is
line | line to parse for comments |
|
static |
Splits a line into two views of a key and a value pair Surrounding whitespace around the key and value are not part of the string views This function is invoked after the section header filter is invoked
line | to search for delimiter and split int key value params |
|
static |
Matches a section header in the regular expression form of [(?P<header>[^]]+)] # '[' followed by 1 or more non-']' characters followed by a ']' If the line matches section header format, the section name portion of that line is returned in the output parameter otherwise an empty view is returned
line | to parse for section header |
CommentPrefixFunc AZ::Settings::ConfigParserSettings::m_commentPrefixFunc = &DefaultCommentPrefixFilter |
Function which is invoked to retrieve the non-commented section of a line The input line will never start with leading whitespace
DelimiterFunc AZ::Settings::ConfigParserSettings::m_delimiterFunc = &DefaultDelimiterFunc |
Function which is invoked on the config line after filtering through the SectionHeaderFunc to determine the delimiter of the line The structure contains a functor which returns a ConfigKeyValuePair to split the key value pair
SectionHeaderFunc AZ::Settings::ConfigParserSettings::m_sectionHeaderFunc = &DefaultSectionHeaderFilter |
Invoked on the non-commented section of a line that has been read from the config file This function should examine the supplied line to determine if it matches a section header If so the section name should be returned Any sections names returned will be supplied as a section header to the Parse callback