girara
Data Structures | Macros | Functions
template.h File Reference
#include <glib-object.h>
#include "macros.h"
#include "types.h"

Go to the source code of this file.

Data Structures

struct  GiraraTemplate
 
struct  GiraraTemplateClass
 

Macros

#define GIRARA_TYPE_TEMPLATE    (girara_template_get_type())
 
#define GIRARA_TEMPLATE(obj)    (G_TYPE_CHECK_INSTANCE_CAST((obj), GIRARA_TYPE_TEMPLATE, GiraraTemplate))
 
#define GIRARA_TEMPLATE_CLASS(obj)    (G_TYPE_CHECK_CLASS_CAST((obj), GIRARA_TYPE_TEMPLATE, GiraraTemplateClass))
 
#define GIRARA_IS_TEMPLATE(obj)    (G_TYPE_CHECK_INSTANCE_TYPE((obj), GIRARA_TYPE_TEMPLATE))
 
#define GIRARA_IS_TEMPLATE_CLASS(obj)    (G_TYPE_CHECK_CLASS_TYPE((obj), GIRARA_TYPE_TEMPLATE))
 
#define GIRARA_TEMPLATE_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS((obj), GIRARA_TYPE_TEMPLATE, GiraraTemplateClass))
 

Functions

GType girara_template_get_type (void) G_GNUC_CONST GIRARA_VISIBLE
 
GiraraTemplate * girara_template_new (const char *base) GIRARA_VISIBLE
 
void girara_template_set_base (GiraraTemplate *object, const char *base) GIRARA_VISIBLE
 
const char * girara_template_get_base (GiraraTemplate *object) GIRARA_VISIBLE
 
girara_list_tgirara_template_referenced_variables (GiraraTemplate *object) GIRARA_VISIBLE
 
bool girara_template_add_variable (GiraraTemplate *object, const char *name) GIRARA_VISIBLE
 
void girara_template_set_variable_value (GiraraTemplate *object, const char *name, const char *value) GIRARA_VISIBLE
 
char * girara_template_evaluate (GiraraTemplate *object) GIRARA_VISIBLE
 

Macro Definition Documentation

◆ GIRARA_IS_TEMPLATE

#define GIRARA_IS_TEMPLATE (   obj)     (G_TYPE_CHECK_INSTANCE_TYPE((obj), GIRARA_TYPE_TEMPLATE))

Definition at line 28 of file template.h.

◆ GIRARA_IS_TEMPLATE_CLASS

#define GIRARA_IS_TEMPLATE_CLASS (   obj)     (G_TYPE_CHECK_CLASS_TYPE((obj), GIRARA_TYPE_TEMPLATE))

Definition at line 30 of file template.h.

◆ GIRARA_TEMPLATE

#define GIRARA_TEMPLATE (   obj)     (G_TYPE_CHECK_INSTANCE_CAST((obj), GIRARA_TYPE_TEMPLATE, GiraraTemplate))

Definition at line 24 of file template.h.

◆ GIRARA_TEMPLATE_CLASS

#define GIRARA_TEMPLATE_CLASS (   obj)     (G_TYPE_CHECK_CLASS_CAST((obj), GIRARA_TYPE_TEMPLATE, GiraraTemplateClass))

Definition at line 26 of file template.h.

◆ GIRARA_TEMPLATE_GET_CLASS

#define GIRARA_TEMPLATE_GET_CLASS (   obj)     (G_TYPE_INSTANCE_GET_CLASS((obj), GIRARA_TYPE_TEMPLATE, GiraraTemplateClass))

Definition at line 32 of file template.h.

◆ GIRARA_TYPE_TEMPLATE

#define GIRARA_TYPE_TEMPLATE    (girara_template_get_type())

Definition at line 22 of file template.h.

Function Documentation

◆ girara_template_add_variable()

bool girara_template_add_variable ( GiraraTemplate *  object,
const char *  name 
)

Register a variable.

Parameters
objectGiraraTemplate object
namename of the variable
Returns
true if the variable was added, false otherwise

◆ girara_template_evaluate()

char * girara_template_evaluate ( GiraraTemplate *  object)

Replace all variables with their values in the template.

Parameters
objectGiraraTemplate object
Returns
evaluated template, needes to be deallocated with g_free

◆ girara_template_get_base()

const char * girara_template_get_base ( GiraraTemplate *  object)

Get the base string of the template.

Parameters
objectGiraraTemplate object
Returns
string that is used as template

◆ girara_template_get_type()

GType girara_template_get_type ( void  )

Returns the type of the template.

Returns
the type

◆ girara_template_new()

GiraraTemplate * girara_template_new ( const char *  base)

Create new template object.

Parameters
basea string that is used as template
Returns
a templot object

◆ girara_template_referenced_variables()

girara_list_t * girara_template_referenced_variables ( GiraraTemplate *  object)

Get list of variable names referenced in the template.

Parameters
objectGiraraTemplate object
Returns
list of variables names referenced in the template

◆ girara_template_set_base()

void girara_template_set_base ( GiraraTemplate *  object,
const char *  base 
)

Set the base string of the template.

Parameters
objectGiraraTemplate object
basea string that is used as template

◆ girara_template_set_variable_value()

void girara_template_set_variable_value ( GiraraTemplate *  object,
const char *  name,
const char *  value 
)

Set value of a variable.

Parameters
objectGiraraTemplate object
namename of the variable
valuevalue of the variable