Fgd

class fgdtools.Fgd[source]

Contains all the data from a Fgd file such as entities and other editor informations.

__init__()[source]

Creates an empty instance of Fgd.

__repr__()[source]

A partial, printable summary of a Fgd.

Returns

A Python formated string.

Return type

str

property includes

A list of included fgdtools.Fgd, including inherited includes from @includes.

property entities

A list containing all fgdtools.FgdEntity, including inherited entities from @includes.

property editor_data

A list containing all fgdtools.FgdEditorData, including inherited data from @includes.

add_include(parent_fgd)[source]

Adds a parent fgdtools.Fgd to supplement this one.

Parameters

parent_fgd (Fgd) – The Fgd object to be added as a parent.

add_entity(fgd_entity)[source]

Adds an entity to the Fgd.

Parameters

fgd_entity (FgdEntity) – The FgdEntity object to be added to this Fgd instance.

add_editor_data(fgd_editor_data)[source]

Adds editor data to the Fgd.

Parameters

fgd_editor_data (FgdEditorData) – The FgdEditorData object to be added to this Fgd instance.

entity_by_name(entity_name)[source]

Finds an entity by its name.

Parameters

entity_name (str) – The entity name to look for.

Raises

EntityNotFound – Whenever an entity could not be found.

Returns

An entity with matching name.

Return type

FgdEntity

fgd_str(collapse=False)[source]

A string representation of the Fgd formated as in the a .fgd file.

Parameters

collapse (bool) – If True, the content of included fgds will be included in the output and @include statements will be removed. If False, Include statements will be in the output and the content of other Fgds will not be present.

Returns

Fgd formated string.

Return type

str