libgeda
|
utility functions for attributes More...
#include <config.h>
#include <missing.h>
#include <stdio.h>
#include <math.h>
#include "libgeda_priv.h"
Go to the source code of this file.
Data Structures | |
struct | AttribsChangedHook |
Functions | |
void | o_attrib_add (TOPLEVEL *toplevel, OBJECT *object, OBJECT *item) |
Add an attribute to an existing attribute list. | |
gboolean | o_attrib_is_attached (TOPLEVEL *toplevel, OBJECT *attrib, OBJECT *object) |
Check whether a attrib is attached to another object. | |
void | o_attrib_attach (TOPLEVEL *toplevel, OBJECT *attrib, OBJECT *object, int set_color) |
Attach existing attribute to an object. | |
void | o_attrib_attach_list (TOPLEVEL *toplevel, GList *attr_list, OBJECT *object, int set_color) |
Attach list of existing attributes to an object. | |
void | o_attrib_detach_all (TOPLEVEL *toplevel, OBJECT *object) |
Detach all attribute items in a list. | |
void | o_attrib_print (GList *attributes) |
Print all attributes to a Postscript document. | |
void | o_attrib_remove (TOPLEVEL *toplevel, GList **list, OBJECT *remove) |
Remove an attribute item from an attribute list. | |
GList * | o_read_attribs (TOPLEVEL *toplevel, OBJECT *object_to_get_attribs, TextBuffer *tb, unsigned int release_ver, unsigned int fileformat_ver, GError **err) |
Read attributes from a buffer. | |
gboolean | o_attrib_string_get_name_value (const gchar *string, gchar **name_ptr, gchar **value_ptr) |
Get name and value from an attribute 'name=value' string. | |
gboolean | o_attrib_get_name_value (OBJECT *attrib, gchar **name_ptr, gchar **value_ptr) |
Get name and value from an attribute OBJECT. | |
GList * | o_attrib_find_floating_attribs (const GList *list) |
Find all floating attributes in the given object list. | |
OBJECT * | o_attrib_find_attrib_by_name (const GList *list, char *name, int count) |
Find an attribute in a list. | |
static char * | o_attrib_search_attrib_list_by_name (const GList *list, char *name, int counter) |
Search attribute list by name. | |
char * | o_attrib_search_floating_attribs_by_name (const GList *list, char *name, int counter) |
Search floating attribute by name. | |
char * | o_attrib_search_attached_attribs_by_name (OBJECT *object, char *name, int counter) |
Search attached attributes by name. | |
char * | o_attrib_search_inherited_attribs_by_name (OBJECT *object, char *name, int counter) |
Search inherited attribute by name. | |
char * | o_attrib_search_object_attribs_by_name (OBJECT *object, char *name, int counter) |
Search attributes of object by name. | |
GList * | o_attrib_return_attribs (OBJECT *object) |
Get all attached attributes of the specified OBJECT. | |
int | o_attrib_is_inherited (OBJECT *attrib) |
Query whether a given attribute OBJECT is "inherited". | |
void | o_attrib_append_attribs_changed_hook (TOPLEVEL *toplevel, AttribsChangedFunc func, void *data) |
static void | call_attribs_changed_hook (gpointer data, gpointer user_data) |
void | o_attrib_emit_attribs_changed (TOPLEVEL *toplevel, OBJECT *object) |
void | o_attrib_freeze_hooks (TOPLEVEL *toplevel, OBJECT *object) |
void | o_attrib_thaw_hooks (TOPLEVEL *toplevel, OBJECT *object) |
Attributes are normal text objects. An attribute is a text object that has a text string that is delimited by an equal "=" character. The part before the equal character is called name the part of the string behind the equal character is called value
Attributes are attached to OBJECTs (st_object). Each attribute has a reference to the object it is attached to. Each object that has attributes has a list of pionters to its attributes.
Definition in file o_attrib.c.
[in] | toplevel | The TOPLEVEL object. |
[in] | object | The OBJECT we're adding the attribute to. |
[in] | item | The item you want to add as an attribute. |
Definition at line 68 of file o_attrib.c.
[in] | toplevel | The TOPLEVEL object. |
[in] | attrib | The attribute to be checket. |
[in] | object | The object where you want to add item as an attribute. |
Definition at line 88 of file o_attrib.c.
[in] | toplevel | The TOPLEVEL object. |
[in] | attrib | The attribute to be added. |
[out] | object | The object where you want to add item as an attribute. |
[in] | set_color | Whether or not we should set the new attribute's color. |
Definition at line 110 of file o_attrib.c.
void o_attrib_attach_list | ( | TOPLEVEL * | toplevel, |
GList * | attr_list, | ||
OBJECT * | object, | ||
int | set_color | ||
) |
[in] | toplevel | The TOPLEVEL object. |
[in] | attr_list | The list of attributes to be added. |
[out] | object | The object where you want to add item as an attribute. |
[in] | set_color | Whether or not we should set the new attribute's color. |
Definition at line 149 of file o_attrib.c.
[in] | toplevel | The TOPLEVEL object. |
[in,out] | object | The object whos attributes to detach. |
Definition at line 166 of file o_attrib.c.
void o_attrib_print | ( | GList * | attributes | ) |
[in] | attributes | List of attributes to print. |
Definition at line 194 of file o_attrib.c.
[in] | toplevel | The TOPLEVEL object. |
[in] | list | The attribute list to remove attribute from. |
[in] | remove | The OBJECT to remove from list. |
Definition at line 222 of file o_attrib.c.
GList* o_read_attribs | ( | TOPLEVEL * | toplevel, |
OBJECT * | object_to_get_attribs, | ||
TextBuffer * | tb, | ||
unsigned int | release_ver, | ||
unsigned int | fileformat_ver, | ||
GError ** | err | ||
) |
[in] | toplevel | The TOPLEVEL object. |
[in] | object_to_get_attribs | Object which gets these attribs. |
[in] | tb | The text buffer to read from. |
[in] | release_ver | libgeda release version number. |
[in] | fileformat_ver | file format version number. |
Definition at line 247 of file o_attrib.c.
gboolean o_attrib_string_get_name_value | ( | const gchar * | string, |
gchar ** | name_ptr, | ||
gchar ** | value_ptr | ||
) |
It returns TRUE if it has been able to parse the string into the name and value parts of an attribute. Otherwise it returns FALSE, in that case *name_ptr and *value_ptr are set to NULL.
name_ptr and/or value_ptr can be NULL. If not NULL, the caller must g_free these returned strings.
[in] | string | String to split into name/value pair. |
[out] | name_ptr | The return location for the name, or NULL. |
[out] | value_ptr | The return location for the value, or NULL. |
Definition at line 379 of file o_attrib.c.
gboolean o_attrib_get_name_value | ( | OBJECT * | attrib, |
gchar ** | name_ptr, | ||
gchar ** | value_ptr | ||
) |
[in] | attrib | The attribute OBJECT whos name/value to return. |
[out] | name_ptr | The return location for the name, or NULL. |
[out] | value_ptr | The return location for the value, or NULL. |
Definition at line 424 of file o_attrib.c.
GList* o_attrib_find_floating_attribs | ( | const GList * | list | ) |
[in] | list | GList of OBJECTs to search for floating attributes. |
Definition at line 443 of file o_attrib.c.
OBJECT* o_attrib_find_attrib_by_name | ( | const GList * | list, |
char * | name, | ||
int | count | ||
) |
Counter is the n'th occurance of the attribute, and starts searching from zero. Zero is the first occurance of an attribute.
[in] | list | GList of attributes to search. |
[in] | name | Character string with attribute name to search for. |
[in] | count | Which occurance to return. |
Definition at line 479 of file o_attrib.c.
static char* o_attrib_search_attrib_list_by_name | ( | const GList * | list, |
char * | name, | ||
int | counter | ||
) | [static] |
Counter is the n'th occurance of the attribute, and starts searching from zero. Zero is the first occurance of an attribute.
[in] | list | GList of attributes to search. |
[in] | name | Character string with attribute name to search for. |
[in] | counter | Which occurance to return. |
Definition at line 521 of file o_attrib.c.
char* o_attrib_search_floating_attribs_by_name | ( | const GList * | list, |
char * | name, | ||
int | counter | ||
) |
Counter is the n'th occurance of the attribute, and starts searching from zero. Zero is the first occurance of an attribute.
[in] | list | GList of OBJECTs to search for floating attributes. |
[in] | name | Character string with attribute name to search for. |
[in] | counter | Which occurance to return. |
Definition at line 550 of file o_attrib.c.
char* o_attrib_search_attached_attribs_by_name | ( | OBJECT * | object, |
char * | name, | ||
int | counter | ||
) |
Counter is the n'th occurance of the attribute, and starts searching from zero. Zero is the first occurance of an attribute.
[in] | object | The OBJECT whos attached attributes to search. |
[in] | name | Character string with attribute name to search for. |
[in] | counter | Which occurance to return. |
Definition at line 578 of file o_attrib.c.
char* o_attrib_search_inherited_attribs_by_name | ( | OBJECT * | object, |
char * | name, | ||
int | counter | ||
) |
Counter is the n'th occurance of the attribute, and starts searching from zero. Zero is the first occurance of an attribute.
[in] | object | The OBJECT whos inherited attributes to search. |
[in] | name | Character string with attribute name to search for. |
[in] | counter | Which occurance to return. |
Definition at line 599 of file o_attrib.c.
char* o_attrib_search_object_attribs_by_name | ( | OBJECT * | object, |
char * | name, | ||
int | counter | ||
) |
Counter is the n'th occurance of the attribute, and starts searching from zero. Zero is the first occurance of an attribute.
[in] | object | OBJECT who's attributes to search. |
[in] | name | Character string with attribute name to search for. |
[in] | counter | Which occurance to return. |
Definition at line 623 of file o_attrib.c.
GList* o_attrib_return_attribs | ( | OBJECT * | object | ) |
The returned GList should be freed using the #g_list_free().
This function aggregates the attached and inherited attributes belonging to a given OBJECT. (inherited attributes are those which live as toplevel un-attached attributes inside in a complex OBJECT's prim_objs).
[in] | object | OBJECT whos attributes to return. |
Definition at line 650 of file o_attrib.c.
int o_attrib_is_inherited | ( | OBJECT * | attrib | ) |
[in] | attrib | OBJECT who's status to query. |
Definition at line 698 of file o_attrib.c.
void o_attrib_append_attribs_changed_hook | ( | TOPLEVEL * | toplevel, |
AttribsChangedFunc | func, | ||
void * | data | ||
) |
Definition at line 711 of file o_attrib.c.
static void call_attribs_changed_hook | ( | gpointer | data, |
gpointer | user_data | ||
) | [static] |
Definition at line 726 of file o_attrib.c.
Definition at line 750 of file o_attrib.c.