Template.Template

g GObject.Object GObject.Object Template.Template Template.Template GObject.Object->Template.Template

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (locator)

expand (stream, scope, cancellable)

expand_string (scope)

get_locator ()

parse (stream, cancellable)

parse_file (file, cancellable)

parse_path (path, cancellable)

parse_resource (path, cancellable)

parse_string (input)

set_locator (locator)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

locator

Template.TemplateLocator

r/w/c/en

The locator used for resolving includes

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Template.Template(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Template.TemplateClass

classmethod new(locator)
Parameters:

locator (Template.TemplateLocator or None) – A Template.TemplateLocator or None.

Returns:

A Template.Template.

Return type:

Template.Template

Creates a new Template.Template.

If locator is specified, locator will be used to resolve include directives when parsing the template.

expand(stream, scope, cancellable)
Parameters:
Raises:

GLib.Error

Returns:

True if successful, otherwise False and error is set.

Return type:

bool

Expands a template into stream using the scope provided.

scope should have all of the variables set that are required to expand the template, or you will get a symbol reference error and False will be returned.

To set a symbol value, get the symbol with Template.Scope.get() and assign a value using tmpl_scope_assign_value() or similar methods.

expand_string(scope)
Parameters:

scope (Template.Scope or None) – A Template.Scope or None.

Raises:

GLib.Error

Returns:

A newly allocated string, or None upon failure.

Return type:

str

Expands the template and returns the result as a string.

get_locator()
Returns:

a Template.TemplateLocator or None.

Return type:

Template.TemplateLocator

Gets the template locator used when resolving template includes.

parse(stream, cancellable)
Parameters:
Raises:

GLib.Error

Return type:

bool

parse_file(file, cancellable)
Parameters:
Raises:

GLib.Error

Return type:

bool

parse_path(path, cancellable)
Parameters:
Raises:

GLib.Error

Return type:

bool

parse_resource(path, cancellable)
Parameters:
Raises:

GLib.Error

Return type:

bool

parse_string(input)
Parameters:

input (str) –

Raises:

GLib.Error

Return type:

bool

set_locator(locator)
Parameters:

locator (Template.TemplateLocator) –

Property Details

Template.Template.props.locator
Name:

locator

Type:

Template.TemplateLocator

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT, EXPLICIT_NOTIFY

The locator used for resolving includes