Top | ![]() |
![]() |
![]() |
![]() |
GXmlBaseCollectionGXmlBaseCollection — Base class for collections implemeting GXmlGomCollection, priving basic infrastructure. |
#define | GXML_TYPE_BASE_COLLECTION |
struct | GXmlBaseCollection |
struct | GXmlBaseCollectionClass |
#define | GXML_TYPE_GOM_ARRAY_LIST |
struct | GXmlGomArrayList |
struct | GXmlGomArrayListClass |
#define | GXML_TYPE_GOM_HASH_MAP |
struct | GXmlGomHashMap |
struct | GXmlGomHashMapClass |
#define | GXML_TYPE_GOM_HASH_PAIRED_MAP |
struct | GXmlGomHashPairedMap |
struct | GXmlGomHashPairedMapClass |
GXmlGomCollection | |
struct | GXmlGomCollectionIface |
GXmlMappeableElement | |
struct | GXmlMappeableElementIface |
GXmlMappeableElementPairKey | |
struct | GXmlMappeableElementPairKeyIface |
Collections properties should be initialized with current container element in order to be able to add new references to elements. Use gxml_base_collection_initialize_element()
to set parent element and gxml_base_collection_search()
to find elements for collection.
void gxml_base_collection_initialize (GXmlBaseCollection *self
,GType items_type
,GError **error
);
self |
the GXmlBaseCollection instance |
|
items_type |
|
|
error |
location to store the error occuring, or |
void gxml_base_collection_initialize_element (GXmlBaseCollection *self
,GXmlGomElement *e
,GError **error
);
Initialize an GXmlGomCollection to use an element as children's parent. Searchs for all nodes, calling gxml_gom_collection_search()
with "items-type", using its "local-name" to find it.
Implemenation classes, should initialize collection to hold a GXmlGomElement derived type using gxml_gom_collection_initialize()
.
self |
the GXmlBaseCollection instance |
|
e |
|
|
error |
location to store the error occuring, or |
void gxml_base_collection_append (GXmlBaseCollection *self
,GXmlDomElement *node
,GError **error
);
Adds an GXmlDomElement of type GXmlGomObject as a child of "element".
Object is always added as a child of "element" but just added to collection if gxml_base_collection_validate_append()
returns true;
self |
the GXmlBaseCollection instance |
|
node |
|
|
error |
location to store the error occuring, or |
void gxml_base_collection_search (GXmlBaseCollection *self
,GError **error
);
Search for all child nodes in "element" of type GXmlGomElement with a "local-name" equal to "items-name", to add it to collection.
Implementations could add additional restrictions to add element to collection.
self |
the GXmlBaseCollection instance |
|
error |
location to store the error occuring, or |
gboolean gxml_base_collection_validate_append (GXmlBaseCollection *self
,gint index
,GXmlDomElement *element
,GError **error
);
self |
the GXmlBaseCollection instance |
|
index |
|
|
element |
|
|
error |
location to store the error occuring, or |
const gchar *
gxml_base_collection_get_items_name (GXmlBaseCollection *self
);
Get and return the current value of the "items-name" property.
GType
gxml_base_collection_get_items_type (GXmlBaseCollection *self
);
Get and return the current value of the "items-type" property.
void gxml_base_collection_set_items_type (GXmlBaseCollection *self
,GType value
);
Set the value of the "items-type" property to value
.
self |
the GXmlBaseCollection instance to modify |
|
value |
the new value of the "items-type" property |
GQueue *
gxml_base_collection_get_nodes_index (GXmlBaseCollection *self
);
Get and return the current value of the "nodes-index" property.
GXmlGomElement *
gxml_base_collection_get_element (GXmlBaseCollection *self
);
Get and return the current value of the "element" property.
void gxml_base_collection_set_element (GXmlBaseCollection *self
,GXmlGomElement *value
);
Set the value of the "element" property to value
.
self |
the GXmlBaseCollection instance to modify |
|
value |
the new value of the "element" property |
void gxml_gom_hash_map_initialize_element_with_key (GXmlGomHashMap *self
,GXmlGomElement *element
,GType items_type
,const gchar *attribute_key
,GError **error
);
Convenient function to initialize a gxml_gom_hash_map_new()
collection, using given element, items' type and name.
self |
the GXmlGomHashMap instance |
|
element |
|
|
items_type |
|
|
attribute_key |
|
|
error |
location to store the error occuring, or |
void gxml_gom_hash_map_initialize_with_key (GXmlGomHashMap *self
,GType items_type
,const gchar *attribute_key
,GError **error
);
Convenient function to initialize a gxml_gom_hash_map_new()
collection, using given element, items' type and name.
Using this method at construction time of derived classes.
self |
the GXmlGomHashMap instance |
|
items_type |
|
|
attribute_key |
|
|
error |
location to store the error occuring, or |
GXmlDomElement * gxml_gom_hash_map_get (GXmlGomHashMap *self
,const gchar *key
);
Returns an GXmlDomElement in the collection using a string key.
gboolean gxml_gom_hash_map_has_key (GXmlGomHashMap *self
,const gchar *key
);
Returns true if key
is used in collection.
GList *
gxml_gom_hash_map_get_keys (GXmlGomHashMap *self
);
Returns list of keys used in collection.
const gchar *
gxml_gom_hash_map_get_attribute_key (GXmlGomHashMap *self
);
Get and return the current value of the "attribute-key" property.
An attribute's name in items to be added and used to retrieve elements as key.
void gxml_gom_hash_map_set_attribute_key (GXmlGomHashMap *self
,const gchar *value
);
Set the value of the "attribute-key" property to value
.
An attribute's name in items to be added and used to retrieve elements as key.
self |
the GXmlGomHashMap instance to modify |
|
value |
the new value of the "attribute-key" property |
void gxml_gom_hash_paired_map_initialize_element_with_keys (GXmlGomHashPairedMap *self
,GXmlGomElement *element
,GType items_type
,const gchar *attribute_primary_key
,const gchar *attribute_secondary_key
,GError **error
);
Convenient function to initialize a GXmlGomHashMap collection, using given element, items' type and name.
self |
the GXmlGomHashPairedMap instance |
|
element |
|
|
items_type |
|
|
attribute_primary_key |
|
|
attribute_secondary_key |
|
|
error |
location to store the error occuring, or |
void gxml_gom_hash_paired_map_initialize_with_keys (GXmlGomHashPairedMap *self
,GType items_type
,const gchar *attribute_primary_key
,const gchar *attribute_secondary_key
,GError **error
);
Convenient function to initialize a GXmlGomHashMap collection, using given element, items' type and name.
Using this method at construction time of derived classes.
self |
the GXmlGomHashPairedMap instance |
|
items_type |
|
|
attribute_primary_key |
|
|
attribute_secondary_key |
|
|
error |
location to store the error occuring, or |
GXmlDomElement * gxml_gom_hash_paired_map_get (GXmlGomHashPairedMap *self
,const gchar *primary_key
,const gchar *secondary_key
);
Returns an GXmlDomElement in the collection using given string keys.
gboolean gxml_gom_hash_paired_map_has_primary_key (GXmlGomHashPairedMap *self
,const gchar *key
);
Returns true if key
is used in collection as primery key.
gboolean gxml_gom_hash_paired_map_has_secondary_key (GXmlGomHashPairedMap *self
,const gchar *pkey
,const gchar *key
);
Returns true if key
is used in collection as secondary key with pkey
as primary.
GList *
gxml_gom_hash_paired_map_get_primary_keys
(GXmlGomHashPairedMap *self
);
Returns list of primary keys used in collection.
GList * gxml_gom_hash_paired_map_get_secondary_keys (GXmlGomHashPairedMap *self
,const gchar *pkey
);
Returns list of secondary keys used in collection with pkey
as primary key.
const gchar *
gxml_gom_hash_paired_map_get_attribute_primary_key
(GXmlGomHashPairedMap *self
);
Get and return the current value of the "attribute-primary-key" property.
An attribute's name in items to be added and used to retrieve elements as primary key.
void gxml_gom_hash_paired_map_set_attribute_primary_key (GXmlGomHashPairedMap *self
,const gchar *value
);
Set the value of the "attribute-primary-key" property to value
.
An attribute's name in items to be added and used to retrieve elements as primary key.
self |
the GXmlGomHashPairedMap instance to modify |
|
value |
the new value of the "attribute-primary-key" property |
const gchar *
gxml_gom_hash_paired_map_get_attribute_secondary_key
(GXmlGomHashPairedMap *self
);
Get and return the current value of the "attribute-secondary-key" property.
An attribute's name in items to be added and used to retrieve elements as secondary key.
void gxml_gom_hash_paired_map_set_attribute_secondary_key (GXmlGomHashPairedMap *self
,const gchar *value
);
Set the value of the "attribute-secondary-key" property to value
.
An attribute's name in items to be added and used to retrieve elements as secondary key.
self |
the GXmlGomHashPairedMap instance to modify |
|
value |
the new value of the "attribute-secondary-key" property |
void gxml_gom_collection_search (GXmlGomCollection *self
,GError **error
);
Search and add references to all GXmlGomObject nodes as child of "element" with same, case insensitive, name of "items-name"
self |
the GXmlGomCollection instance |
|
error |
location to store the error occuring, or |
GXmlDomElement * gxml_gom_collection_get_item (GXmlGomCollection *self
,gint index
,GError **error
);
Gets a child GXmlDomElement of "element" referenced in "nodes-index".
self |
the GXmlGomCollection instance |
|
index |
|
|
error |
location to store the error occuring, or |
void gxml_gom_collection_append (GXmlGomCollection *self
,GXmlDomElement *node
,GError **error
);
Adds a GXmlDomElement node to this collection. Depending on type of collection, this method will take information from node to initialize how to find it.
self |
the GXmlGomCollection instance |
|
node |
|
|
error |
location to store the error occuring, or |
void gxml_gom_collection_initialize (GXmlGomCollection *self
,GType t
,GError **error
);
Initialize collection to use a given GXmlGomElement derived type. Internally, this method create an instance of given type to initialize "items-type" and "items-name".
This method can be used at construction time of classes implementing GXmlGomCollection to initialize object type to refer in collection.
self |
the GXmlGomCollection instance |
|
t |
|
|
error |
location to store the error occuring, or |
GXmlGomElement *
gxml_gom_collection_create_item (GXmlGomCollection *self
);
Creates a new instance of "items-type", with same "owner-document" than "element". New instance is not set as a child of collection's "element"; to do so, use gxml_gom_collection_append()
Returns: a new instance object or null if type is not a GXmlGomElement or no parent has been set
gboolean gxml_gom_collection_validate_append (GXmlGomCollection *self
,gint index
,GXmlDomElement *element
,GError **error
);
Validate if given node and index, should be added to collection.
Implementations should use this method to perform any action before element is added to collection, like setup internal pointers to given index, in order to get access to referenced node.
Return: true if node and index should be added to collection.
self |
the GXmlGomCollection instance |
|
index |
|
|
element |
|
|
error |
location to store the error occuring, or |
GQueue *
gxml_gom_collection_get_nodes_index (GXmlGomCollection *self
);
Get and return the current value of the "nodes-index" property.
A list of child GXmlDomElement objects of "element"
GXmlGomElement *
gxml_gom_collection_get_element (GXmlGomCollection *self
);
Get and return the current value of the "element" property.
A GXmlGomElement with all child elements in collection.
void gxml_gom_collection_set_element (GXmlGomCollection *self
,GXmlGomElement *value
);
Set the value of the "element" property to value
.
A GXmlGomElement with all child elements in collection.
self |
the GXmlGomCollection instance to modify |
|
value |
the new value of the "element" property |
const gchar *
gxml_gom_collection_get_items_name (GXmlGomCollection *self
);
Get and return the current value of the "items-name" property.
Local name of GXmlDomElement objects of "element", which could be contained in this collection.
Used when reading to add elements to collection.
GType
gxml_gom_collection_get_items_type (GXmlGomCollection *self
);
Get and return the current value of the "items-type" property.
A GType of GXmlDomElement child objects of "element", which could be contained in this collection.
Type should be an GXmlGomObject.
void gxml_gom_collection_set_items_type (GXmlGomCollection *self
,GType value
);
Set the value of the "items-type" property to value
.
A GType of GXmlDomElement child objects of "element", which could be contained in this collection.
Type should be an GXmlGomObject.
self |
the GXmlGomCollection instance to modify |
|
value |
the new value of the "items-type" property |
gint
gxml_gom_collection_get_length (GXmlGomCollection *self
);
Get and return the current value of the "length" property.
Number of items referenced in "nodes-index"
gchar *
gxml_mappeable_element_get_map_key (GXmlMappeableElement *self
);
gchar *
gxml_mappeable_element_pair_key_get_map_primary_key
(GXmlMappeableElementPairKey *self
);
gchar *
gxml_mappeable_element_pair_key_get_map_secondary_key
(GXmlMappeableElementPairKey *self
);
#define GXML_TYPE_BASE_COLLECTION (gxml_base_collection_get_type ())
The type for GXmlBaseCollection.
struct GXmlBaseCollection { GObject parent_instance; GXmlBaseCollectionPrivate * priv; GQueue* _nodes_index; GXmlGomElement* _element; gchar* _items_name; GType _items_type; };
Base class for collections implemeting GXmlGomCollection, priving basic infrastructure.
Collections properties should be initialized with current container element in order to be able to add new references to elements. Use gxml_base_collection_initialize_element()
to set parent element and gxml_base_collection_search()
to find elements for collection.
A collection of node's index refered. Don't modify it manually. |
||
GXmlGomElement * |
Element used to refer of containier element. You should define it at construction time our set it as a construction property. |
|
Local name of GXmlDomElement objects of "element", which could be contained in this collection. Used when reading to add elements to collection. You can set it at construction time, by, for example, instantaiting a object of the type "items-type" then use "local-name"'s value. |
||
Objects' type to be referenced by this collection and to deserialize objects. Derived classes, can initilize this value at constructor or as construct property. Used when reading and at initialization time, to know "local-name" at runtime. |
struct GXmlBaseCollectionClass { GObjectClass parent_class; gboolean (*validate_append) (GXmlBaseCollection* self, gint index, GXmlDomElement* element, GError** error); };
The class structure for GXML_TYPE_BASE_COLLECTION
. All the fields in this structure are private and should never be accessed directly.
#define GXML_TYPE_GOM_ARRAY_LIST (gxml_gom_array_list_get_type ())
The type for GXmlGomArrayList.
struct GXmlGomArrayList { GXmlBaseCollection parent_instance; GXmlGomArrayListPrivate * priv; };
A class impementing GXmlGomCollection to store references to child GXmlDomElement of "element", using an index.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
public class YourObject : GomElement { [Description (nick="::Name")] public string name { get; set; } } public class YourList : GomArrayList { construct { try { initialize (typeof (YourObject)); } catch (GLib.Error e) { warning ("Initialization error for collection type: %s : %s" .printf (get_type ().name(), e.message)); } } } |
struct GXmlGomArrayListClass { GXmlBaseCollectionClass parent_class; };
The class structure for GXML_TYPE_GOM_ARRAY_LIST
. All the fields in this structure are private and should never be accessed directly.
#define GXML_TYPE_GOM_HASH_MAP (gxml_gom_hash_map_get_type ())
The type for GXmlGomHashMap.
struct GXmlGomHashMap { GXmlBaseCollection parent_instance; GXmlGomHashMapPrivate * priv; GHashTable* _hashtable; gchar* _attribute_key; };
A class impementing GXmlGomCollection to store references to child GXmlDomElement of "element", using an attribute in items as key or gxml_mappeable_element_get_map_key()
method if implemented by items to be added. If key is not defined in node, it is not added; but keeps it as a child node of actual "element".
If GXmlGomElement to be added is of type "items-type" and implements GXmlMappeableElement, you should set "attribute-key" to null in order to use returned value of gxml_mappeable_element_get_map_key()
as key.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
public class YourObject : GomElement { [Description (nick="::Name")] public string name { get; set; } } public class YourList : GomHashMap { construct { try { initialize_with_key (typeof (YourObject),"Name"); } catch (GLib.Error e) { warning ("Initialization error for collection type: %s : %s" .printf (get_type ().name(), e.message)); } } } |
struct GXmlGomHashMapClass { GXmlBaseCollectionClass parent_class; };
The class structure for GXML_TYPE_GOM_HASH_MAP
. All the fields in this structure are private and should never be accessed directly.
#define GXML_TYPE_GOM_HASH_PAIRED_MAP (gxml_gom_hash_paired_map_get_type ())
The type for GXmlGomHashPairedMap.
struct GXmlGomHashPairedMap { GXmlBaseCollection parent_instance; GXmlGomHashPairedMapPrivate * priv; GHashTable* _hashtable; gchar* _attribute_primary_key; gchar* _attribute_secondary_key; };
A class impementing GXmlGomCollection to store references to child GXmlDomElement of "element", using two attributes in items as primary and secondary keys or gxml_mappeable_element_pair_key_get_map_primary_key()
and gxml_mappeable_element_pair_key_get_map_secondary_key()
methods if GXmlMappeableElementPairKey is implemented by items to be added. If one or both keys are not defined in node, it is not added; but keeps it as a child node of actual "element".
If GXmlGomElement to be added is of type "items-type" and implements GXmlMappeableElementPairKey, you should set "attribute-primary-key" and "attribute-secondary-key" to null in order to use returned value of gxml_mappeable_element_pair_key_get_map_primary_key()
and gxml_mappeable_element_pair_key_get_map_secondary_key()
as keys.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
public class YourObject : GomElement { [Description (nick="::Name")] public string name { get; set; } public string code { get; set; } } public class YourList : GomHashPairedMap { construct { try { initialize_with_key (typeof (YourObject),"Name"); } catch (GLib.Error e) { warning ("Initialization error for collection type: %s : %s" .printf (get_type ().name(), e.message)); } } } |
A hashtable with all keys as string to node's index refered. Don't modify it manually. |
||
Element's attribute name used to refer of container's element as primery key. You should define it at construction time our set it as a construction property. |
||
Element's attribute name used to refer of container's element as secondary key. You should define it at construction time our set it as a construction property. |
struct GXmlGomHashPairedMapClass { GXmlBaseCollectionClass parent_class; };
The class structure for GXML_TYPE_GOM_HASH_PAIRED_MAP
. All the fields in this structure are private and should never be accessed directly.
typedef struct _GXmlGomCollection GXmlGomCollection;
An interface to keep references to GXmlDomElement in a "element" child nodes. Only GXmlGomObject are supported.
struct GXmlGomCollectionIface { GTypeInterface parent_iface; void (*search) (GXmlGomCollection* self, GError** error); GXmlDomElement* (*get_item) (GXmlGomCollection* self, gint index, GError** error); void (*append) (GXmlGomCollection* self, GXmlDomElement* node, GError** error); void (*initialize) (GXmlGomCollection* self, GType t, GError** error); GXmlGomElement* (*create_item) (GXmlGomCollection* self); gboolean (*validate_append) (GXmlGomCollection* self, gint index, GXmlDomElement* element, GError** error); GQueue* (*get_nodes_index) (GXmlGomCollection* self); GXmlGomElement* (*get_element) (GXmlGomCollection* self); void (*set_element) (GXmlGomCollection* self, GXmlGomElement* value); const gchar* (*get_items_name) (GXmlGomCollection* self); GType (*get_items_type) (GXmlGomCollection* self); void (*set_items_type) (GXmlGomCollection* self, GType value); gint (*get_length) (GXmlGomCollection* self); };
Interface for creating GXmlGomCollection implementations.
the parent interface structure |
||
virtual method called by |
||
virtual method called by |
||
virtual method called by |
||
virtual method called by |
||
virtual method called by |
||
virtual method called by |
||
getter method for the abstract property "nodes-index" |
||
getter method for the abstract property "element" |
||
getter method for the abstract property "items-name" |
||
getter method for the abstract property "items-type" |
||
getter method for the abstract property "length" |
typedef struct _GXmlMappeableElement GXmlMappeableElement;
Inteface to be implemented by GXmlGomElement derived classes in order to provide a string to be used in GXmlGomHashMap as key.
If GXmlGomHashMap has set its "attribute-key" its value has precedence over this method.
struct GXmlMappeableElementIface { GTypeInterface parent_iface; gchar* (*get_map_key) (GXmlMappeableElement* self); };
Interface for creating GXmlMappeableElement implementations.
the parent interface structure |
||
virtual method called by |
typedef struct _GXmlMappeableElementPairKey GXmlMappeableElementPairKey;
Inteface to be implemented by GXmlGomElement derived classes in order to provide a string to be used in GXmlGomHashMap as key.
If GXmlGomHashMap has set its "attribute-key" its value has precedence over this method.
struct GXmlMappeableElementPairKeyIface { GTypeInterface parent_iface; gchar* (*get_map_primary_key) (GXmlMappeableElementPairKey* self); gchar* (*get_map_secondary_key) (GXmlMappeableElementPairKey* self); };
Interface for creating GXmlMappeableElementPairKey implementations.
the parent interface structure |
||
virtual method called by |
||
virtual method called by |