Skip to main content

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​

ParameterTypeDescription
parentElementElementThe element to search on.
tagNamestringThe 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​

ParameterTypeDescription
parentElementElementThe element to search on.
tagNamestringThe 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​

ParameterTypeDescription
parentElementElementThe element to search on.
tagNamestringThe tag name to find.

Returns​

LerpLookupTable

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​

ParameterTypeDefault valueDescription
elementElementundefinedThe element to search on.
attributeNamestringundefinedThe attribute to find on the element.
allowZerobooleanfalseWhether zero should be allowed as a value.
allowNegativebooleanfalseWhether 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​

ParameterTypeDescription
elementElementThe element to search on.
attributeNamestringThe 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​

ParameterTypeDescription
elementElementThe 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​

ParameterTypeDescription
executor() => Tthe executor which returns the value
defaultValueTa fallback value in case the executor throws

Returns​

T

T