Skip to main content

Class: ConfigParser

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

getChildElement(parentElement, tagName): Element

Gets the first occurrence of a given child element.

Parameters

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

Returns

Element

An element.

Throws

If no element is found.

Defined in

src/sdk/utils/config/ConfigUtils.ts:32


getChildElements

getChildElements(parentElement, tagName): Element[]

Gets all occurrences of a given child element type.

Parameters

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

Returns

Element[]

All child elements that match.

Defined in

src/sdk/utils/config/ConfigUtils.ts:49


getChildLerpLookupTable

getChildLerpLookupTable(parentElement, tagName): LerpLookupTable

Gets a LookupTable child of an element

Parameters

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

Returns

LerpLookupTable

LerpLookupTable

Throws

If a lookup table cannot be parsed

Defined in

src/sdk/utils/config/ConfigUtils.ts:62


getIntegerAttrValue

getIntegerAttrValue<T>(element, attributeName, allowZero?, allowNegative?): T

Gets an integer attribute value of an element.

Type parameters

NameType
Textends number

Parameters

NameTypeDefault 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.

Defined in

src/sdk/utils/config/ConfigUtils.ts:167


getStringAttrValue

getStringAttrValue<T>(element, attributeName): T

Gets a string attribute value of an element.

Type parameters

NameType
Textends string

Parameters

NameTypeDescription
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.

Defined in

src/sdk/utils/config/ConfigUtils.ts:154


getTextContent

getTextContent(element): string

Gets the text content of an element.

Parameters

NameTypeDescription
elementElementThe element to search on.

Returns

string

The element's text content.

Throws

If no text content is present.

Defined in

src/sdk/utils/config/ConfigUtils.ts:120


optional

optional<T>(executor, defaultValue): T

Returns a value computed by an executor, with a fallback value if the executor throws

Type parameters

Name
T

Parameters

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

Returns

T

T

Defined in

src/sdk/utils/config/ConfigUtils.ts:15