Abstract Class: ConfigParser
Defined in: src/sdk/utils/config/ConfigUtils.ts:4
A parser for FmsConfig elements.
Constructors
Constructor
new ConfigParser():
ConfigParser
Returns
ConfigParser
Properties
configName
static
configName:string
='ConfigParser'
Defined in: src/sdk/utils/config/ConfigUtils.ts:5
Methods
getChildElement()
static
getChildElement(parentElement
,tagName
):Element
Defined in: src/sdk/utils/config/ConfigUtils.ts:32
Gets the first occurrence of a given child element.
Parameters
Parameter | Type | Description |
---|---|---|
parentElement | Element | The element to search on. |
tagName | string | The tag name to find. |
Returns
Element
An element.
Throws
If no element is found.
getChildElements()
static
getChildElements(parentElement
,tagName
):Element
[]
Defined in: src/sdk/utils/config/ConfigUtils.ts:49
Gets all occurrences of a given child element type.
Parameters
Parameter | Type | Description |
---|---|---|
parentElement | Element | The element to search on. |
tagName | string | The tag name to find. |
Returns
Element
[]
All child elements that match.
getChildLerpLookupTable()
static
getChildLerpLookupTable(parentElement
,tagName
):LerpLookupTable
Defined in: src/sdk/utils/config/ConfigUtils.ts:62
Gets a LookupTable child of an element
Parameters
Parameter | Type | Description |
---|---|---|
parentElement | Element | The element to search on. |
tagName | string | The tag name to find. |
Returns
LerpLookupTable
Throws
If a lookup table cannot be parsed
getIntegerAttrValue()
static
getIntegerAttrValue<T
>(element
,attributeName
,allowZero
,allowNegative
):T
Defined in: src/sdk/utils/config/ConfigUtils.ts:167
Gets an integer attribute value of an element.
Type Parameters
Type Parameter |
---|
T extends number |
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
element | Element | undefined | The element to search on. |
attributeName | string | undefined | The attribute to find on the element. |
allowZero | boolean | false | Whether zero should be allowed as a value. |
allowNegative | boolean | false | Whether negative numbers should be allowed as a value. |
Returns
T
The attribute's value.
Throws
If the attribute is not present.
getStringAttrValue()
static
getStringAttrValue<T
>(element
,attributeName
):T
Defined in: src/sdk/utils/config/ConfigUtils.ts:154
Gets a string attribute value of an element.
Type Parameters
Type Parameter |
---|
T extends string |
Parameters
Parameter | Type | Description |
---|---|---|
element | Element | The element to search on. |
attributeName | string | The attribute to find on the element. |
Returns
T
The attribute's value.
Throws
If the attribute is not present.
getTextContent()
static
getTextContent(element
):string
Defined in: src/sdk/utils/config/ConfigUtils.ts:120
Gets the text content of an element.
Parameters
Parameter | Type | Description |
---|---|---|
element | Element | The element to search on. |
Returns
string
The element's text content.
Throws
If no text content is present.
optional()
static
optional<T
>(executor
,defaultValue
):T
Defined in: src/sdk/utils/config/ConfigUtils.ts:15
Returns a value computed by an executor, with a fallback value if the executor throws
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type | Description |
---|---|---|
executor | () => T | the executor which returns the value |
defaultValue | T | a fallback value in case the executor throws |
Returns
T
T