GATE
C/C++ Framework
Loading...
Searching...
No Matches
properties.h File Reference

Simplified hierarchical property storage. More...

#include "gate/gate_core_api.h"
#include "gate/gatetypes.h"
#include "gate/strings.h"
#include "gate/arrays.h"
#include "gate/maps.h"

Data Structures

struct  gate_proptable_class
 Defines the data fields of a property table. More...

Macros

#define GATE_PROPERTY_TYPE_EMPTY   0
#define GATE_PROPERTY_TYPE_BOOL   1
#define GATE_PROPERTY_TYPE_INT   2
#define GATE_PROPERTY_TYPE_REAL   3
#define GATE_PROPERTY_TYPE_STRING   4
#define GATE_PROPERTY_TYPE_ARRAY   5
#define GATE_PROPERTY_TYPE_OBJECT   6

Typedefs

typedef struct gate_proptable_class gate_proptable_t
 Defines the data fields of a property table.

Functions

GATE_CORE_API gate_property_t * gate_property_create_empty (gate_property_t *obj)
 Initializes an empty property object.
GATE_CORE_API gate_property_t * gate_property_create_bool (gate_property_t *obj, gate_bool_t value)
 Initializes a boolean property object.
GATE_CORE_API gate_property_t * gate_property_create_int (gate_property_t *obj, gate_int64_t value)
 Initializes an integer property object.
GATE_CORE_API gate_property_t * gate_property_create_real (gate_property_t *obj, gate_real64_t value)
 Initializes a floating point property object.
GATE_CORE_API gate_property_t * gate_property_create_string (gate_property_t *obj, gate_string_t const *value)
 Initializes a string property object.
GATE_CORE_API gate_property_t * gate_property_create_text (gate_property_t *obj, char const *value)
 Initializes a string property object from a C-string.
GATE_CORE_API gate_property_t * gate_property_create_array (gate_property_t *obj, gate_property_t const *items, gate_size_t item_count)
 Initializes an array property object.
GATE_CORE_API gate_property_t * gate_property_create_object (gate_property_t *obj)
 Initializes a property-map property object.
GATE_CORE_API gate_property_t * gate_property_create (gate_property_t *obj, gate_property_typeid_t value_type, void const *ptr_value)
 Initializes a property object from a type ID and a pointer to a native value.
GATE_CORE_API gate_property_t * gate_property_copy (gate_property_t *dest, gate_property_t const *src)
 Initializes a property object with the copy of the content of an existing one.
GATE_CORE_API void gate_property_destroy (gate_property_t *obj)
 Destroys a property object by releasing its resources.
GATE_CORE_API gate_result_t gate_property_copy_constructor (void *dest, void const *src)
 Generic copy constructor for property objects.
GATE_CORE_API void gate_property_destructor (void *dest)
 Generic destructor for property objects.
GATE_CORE_API gate_property_typeid_t gate_property_get_type (gate_property_t const *obj)
 Returns the current property type ID.
GATE_CORE_API gate_result_t gate_property_get_bool (gate_property_t const *obj, gate_bool_t *value)
 Returns the boolean representation of the property object content.
GATE_CORE_API gate_result_t gate_property_get_int (gate_property_t const *obj, gate_int64_t *value)
 Returns the integer representation of the property object content.
GATE_CORE_API gate_result_t gate_property_get_real (gate_property_t const *obj, gate_real64_t *value)
 Returns the floating point representation of the property object content.
GATE_CORE_API gate_result_t gate_property_get_string (gate_property_t const *obj, gate_string_t *value)
 Returns the string representation of the property object content.
GATE_CORE_API gate_result_t gate_property_set_bool (gate_property_t *obj, gate_bool_t value)
 Sets a boolean value as the property's content.
GATE_CORE_API gate_result_t gate_property_set_int (gate_property_t *obj, gate_int64_t value)
 Sets an integer value as the property's content.
GATE_CORE_API gate_result_t gate_property_set_real (gate_property_t *obj, gate_real64_t value)
 Sets a floating point value as the property's content.
GATE_CORE_API gate_result_t gate_property_set_string (gate_property_t *obj, gate_string_t const *value)
 Sets a string value as the property's content.
GATE_CORE_API gate_property_t * gate_property_array_add (gate_property_t *array_obj, gate_property_t const *item)
 Adds a new property to an array of properties.
GATE_CORE_API gate_property_t const * gate_property_array_get (gate_property_t const *array_obj, gate_size_t index)
 Returns a pointer to a property in an array of properties.
GATE_CORE_API gate_size_t gate_property_array_length (gate_property_t const *array_obj)
 Returns the length of an array of properties.
GATE_CORE_API gate_bool_t gate_property_array_remove (gate_property_t *array_obj, gate_size_t index)
 Removes an item from an array of properties.
GATE_CORE_API gate_property_t * gate_property_member_add (gate_property_t *obj, gate_string_t const *name, gate_property_t const *item)
 Adds a new property member to a property object mapping.
GATE_CORE_API gate_property_t const * gate_property_member_get (gate_property_t const *obj, gate_string_t const *name)
 Returns a pointer to a property member from a property object mapping by its name.
GATE_CORE_API gate_array_tgate_property_member_names (gate_property_t const *obj, gate_array_t *new_string_array)
 Returns an array of strings with all names of property members in an object property mapping.
GATE_CORE_API gate_size_t gate_property_member_count (gate_property_t const *obj)
 Returns the amount of members in an object property mapping.
GATE_CORE_API gate_bool_t gate_property_member_remove (gate_property_t *obj, gate_string_t const *name)
 Removes a member from an object property mapping by its name.
GATE_CORE_API gate_result_t gate_property_import (gate_property_t *target, gate_type_id_t type_id, void const *source)
 Imports the content of a defined GATE-value data record into a property object.
GATE_CORE_API gate_result_t gate_property_export (gate_property_t const *source, gate_type_id_t type_id, void *target)
 Exports and converts the content of a property object into a specified GATE-value data type.
GATE_CORE_API gate_property_t const * gate_property_resolve_path (gate_property_t const *source, gate_string_t const *path)
 Returns the pointer to a property member in an object property hierarchy by a path (e.g. "member.submember1.submember2.submember3")
GATE_CORE_API gate_bool_t gate_property_equals_string (gate_property_t const *obj, gate_string_t const *text)
 Evaluates if the string representation of property equals the specified value.
GATE_CORE_API gate_proptable_tgate_proptable_create (gate_proptable_t *table)
 Initializes an empty property table.
GATE_CORE_API gate_proptable_tgate_proptable_copy (gate_proptable_t *table, gate_proptable_t const *src)
 Initializes a property table with a copy of the contents of an existing one.
GATE_CORE_API void gate_proptable_destroy (gate_proptable_t *table)
 Destroys a property table by releasing its resources.
GATE_CORE_API gate_result_t gate_proptable_insert_column (gate_proptable_t *table, gate_string_t const *column_name, gate_property_typeid_t prop_type, gate_size_t insert_at)
 Add a new column definition to the property table.
GATE_CORE_API gate_result_t gate_proptable_remove_column (gate_proptable_t *table, gate_string_t const *column_name)
 Removes a column definition and its contents from a property table by its name.
GATE_CORE_API gate_result_t gate_proptable_remove_column_at (gate_proptable_t *table, gate_size_t index)
 Removes a column defintition and its contents from a property table by its column index.
GATE_CORE_API gate_result_t gate_proptable_set_column_name (gate_proptable_t *table, gate_size_t index, gate_string_t const *new_name)
 Sets a new name of property table's column.
GATE_CORE_API gate_result_t gate_proptable_resolve_column (gate_proptable_t const *table, gate_string_t const *name, gate_size_t *match_index)
 Returns the index of property table's column identified by its current name.
GATE_CORE_API gate_size_t gate_proptable_get_column_count (gate_proptable_t const *table)
 Returns the amount of columns in a property table.
GATE_CORE_API gate_result_t gate_proptable_get_column_name (gate_proptable_t const *table, gate_size_t index, gate_string_t *ptr_name)
 Returns the name of column in a property table referenced by the column index.
GATE_CORE_API gate_property_typeid_t gate_proptable_get_column_type (gate_proptable_t const *table, gate_size_t index)
 Returns the property type ID of a column referenced by the column index.
GATE_CORE_API gate_size_t gate_proptable_get_row_count (gate_proptable_t const *table)
 Returns the amount rows in a property table.
GATE_CORE_API gate_property_t const * gate_proptable_get_item (gate_proptable_t const *table, gate_size_t row, gate_string_t const *column)
 Returns a pointer to a property addressed by row-index and column-name.
GATE_CORE_API gate_property_t const * gate_proptable_get_item_at (gate_proptable_t const *table, gate_size_t row, gate_size_t column)
 Returns a pointer to a property addressed by row-index and column-index.
GATE_CORE_API gate_result_t gate_proptable_get_row (gate_proptable_t const *table, gate_size_t row, gate_property_t *prop)
 Returns the contents of a property table row as an object-mapping-typed property object.
GATE_CORE_API gate_result_t gate_proptable_insert_row (gate_proptable_t *table, gate_size_t row)
 Inserts an empty row into the proeprty table at the specified row index.
GATE_CORE_API gate_result_t gate_proptable_remove_row (gate_proptable_t *table, gate_size_t row)
 Removes the contents of a row in a property table adressed by the row index.
GATE_CORE_API gate_result_t gate_proptable_set_item (gate_proptable_t *table, gate_size_t row, gate_string_t const *column, gate_property_t const *prop)
 Sets the content of a name-adressed cell in property table to a new property value.
GATE_CORE_API gate_result_t gate_proptable_set_item_at (gate_proptable_t *table, gate_size_t row, gate_size_t column, gate_property_t const *prop)
 Sets the content of a index-adressed cell in property table to a new property value.

Detailed Description

Simplified hierarchical property storage.

Macro Definition Documentation

◆ GATE_PROPERTY_TYPE_EMPTY

#define GATE_PROPERTY_TYPE_EMPTY   0

empty property type ID

◆ GATE_PROPERTY_TYPE_BOOL

#define GATE_PROPERTY_TYPE_BOOL   1

boolean property type ID

◆ GATE_PROPERTY_TYPE_INT

#define GATE_PROPERTY_TYPE_INT   2

integer property type ID

◆ GATE_PROPERTY_TYPE_REAL

#define GATE_PROPERTY_TYPE_REAL   3

floating point property type ID

◆ GATE_PROPERTY_TYPE_STRING

#define GATE_PROPERTY_TYPE_STRING   4

string property type ID

◆ GATE_PROPERTY_TYPE_ARRAY

#define GATE_PROPERTY_TYPE_ARRAY   5

array of properties type ID

◆ GATE_PROPERTY_TYPE_OBJECT

#define GATE_PROPERTY_TYPE_OBJECT   6

map of property-name to property type ID