All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
kzc_settings.h File Reference

Setting interface. More...

Enumerations

enum  KzcSettingType { KZC_SETTING_INTEGER, KZC_SETTING_FLOAT, KZC_SETTING_STRING, KZC_SETTING_SUBNODE }
 Enumeration of the possible node types. More...
 

Functions

kzsError kzcSettingContainerCreate (const struct KzcMemoryManager *manager, struct KzcSettingContainer **out_settings)
 Allocate settings structure. More...
 
kzsError kzcSettingContainerDelete (struct KzcSettingContainer *settings)
 Delete settings structure. More...
 
struct KzcSettingNodekzcSettingContainerGetRoot (const struct KzcSettingContainer *settings)
 Get root node from container. More...
 
kzsError kzcSettingContainerGetNode (const struct KzcSettingContainer *settings, kzString path, struct KzcSettingNode **out_node)
 Get node from path. More...
 
kzsError kzcSettingNodeAddSubNode (const struct KzcSettingNode *node, kzString name, struct KzcSettingNode **out_subNode)
 Add node as a child to node. More...
 
kzsError kzcSettingNodeAddInteger (const struct KzcSettingNode *node, kzString name, kzInt value)
 Add an integer property as a child to node. More...
 
kzsError kzcSettingNodeAddFloat (const struct KzcSettingNode *node, kzString name, kzFloat value)
 Add a float property as a child to node. More...
 
kzsError kzcSettingNodeAddString (const struct KzcSettingNode *node, kzString name, kzString value)
 Add a string property as a child to node. More...
 
kzBool kzcSettingNodeGetSubNode (const struct KzcSettingNode *node, kzString name, struct KzcSettingNode **out_subNode)
 Try to get child node of 'node' with the key 'name'. More...
 
kzBool kzcSettingNodeGetInteger (const struct KzcSettingNode *node, kzString name, kzInt *out_value)
 Try to get child integer value of 'node' with the key 'name'. More...
 
kzBool kzcSettingNodeGetFloat (const struct KzcSettingNode *node, kzString name, kzFloat *out_value)
 Try to get child float value of 'node' with the key 'name'. More...
 
kzBool kzcSettingNodeGetString (const struct KzcSettingNode *node, kzString name, kzString *out_value)
 Try to get child string value of 'node' with the key 'name'. More...
 
kzInt kzcSettingNodeGetIntegerDefault (const struct KzcSettingNode *node, kzString name, kzInt defaultValue)
 Try to get child integer value of 'node' with the key 'name'. More...
 
kzFloat kzcSettingNodeGetFloatDefault (const struct KzcSettingNode *node, kzString name, kzFloat defaultValue)
 Try to get child float value of 'node' with the key 'name'. More...
 
kzString kzcSettingNodeGetStringDefault (const struct KzcSettingNode *node, kzString name, kzString defaultValue)
 Try to get child string value of 'node' with the key 'name'. More...
 
kzsError kzcSettingNodeRemoveSetting (const struct KzcSettingNode *node, kzString name)
 Try to remove setting under node. More...
 
struct KzcHashMapkzcSettingNodeGetDictionary (const struct KzcSettingNode *node)
 Accessor to node dictionary. More...
 
void * kzcSettingGetData (struct KzcSetting *setting, enum KzcSettingType *out_type)
 Accessor to setting data. More...
 
enum KzcSettingType kzcSettingNodeGetType (const struct KzcSettingNode *node, kzString name)
 Get type of node. More...
 
kzsError kzcSettingNodeClear (const struct KzcSettingNode *node)
 Clears all data from setting node. More...
 

Detailed Description

Setting interface.

This file provides functionality for storing integer, float and string data in arbitrary tree structure.

Copyright 2008-2020 by Rightware. All rights reserved.

Enumeration Type Documentation

Enumeration of the possible node types.

Enumerator
KZC_SETTING_INTEGER 

Integer value type.

KZC_SETTING_FLOAT 

Floating point value type.

KZC_SETTING_STRING 

String value type.

KZC_SETTING_SUBNODE 

Sub-node value type.

Function Documentation

kzsError kzcSettingContainerCreate ( const struct KzcMemoryManager manager,
struct KzcSettingContainer **  out_settings 
)

Allocate settings structure.

kzsError kzcSettingContainerDelete ( struct KzcSettingContainer settings)

Delete settings structure.

struct KzcSettingNode* kzcSettingContainerGetRoot ( const struct KzcSettingContainer settings)

Get root node from container.

kzsError kzcSettingContainerGetNode ( const struct KzcSettingContainer settings,
kzString  path,
struct KzcSettingNode **  out_node 
)

Get node from path.

The syntax used for path is "root/some/path". If node is not found out_node will be set to null but no error is raised. Error is raised only if memory operations during path parsing fail. Do not start the path string with '/'.

kzsError kzcSettingNodeAddSubNode ( const struct KzcSettingNode node,
kzString  name,
struct KzcSettingNode **  out_subNode 
)

Add node as a child to node.

This function returns the new node created, unlike the other add functions that take the value of the new setting in as the parameter.

kzsError kzcSettingNodeAddInteger ( const struct KzcSettingNode node,
kzString  name,
kzInt  value 
)

Add an integer property as a child to node.

kzsError kzcSettingNodeAddFloat ( const struct KzcSettingNode node,
kzString  name,
kzFloat  value 
)

Add a float property as a child to node.

kzsError kzcSettingNodeAddString ( const struct KzcSettingNode node,
kzString  name,
kzString  value 
)

Add a string property as a child to node.

kzBool kzcSettingNodeGetSubNode ( const struct KzcSettingNode node,
kzString  name,
struct KzcSettingNode **  out_subNode 
)

Try to get child node of 'node' with the key 'name'.

kzBool kzcSettingNodeGetInteger ( const struct KzcSettingNode node,
kzString  name,
kzInt out_value 
)

Try to get child integer value of 'node' with the key 'name'.

kzBool kzcSettingNodeGetFloat ( const struct KzcSettingNode node,
kzString  name,
kzFloat out_value 
)

Try to get child float value of 'node' with the key 'name'.

kzBool kzcSettingNodeGetString ( const struct KzcSettingNode node,
kzString  name,
kzString out_value 
)

Try to get child string value of 'node' with the key 'name'.

kzInt kzcSettingNodeGetIntegerDefault ( const struct KzcSettingNode node,
kzString  name,
kzInt  defaultValue 
)

Try to get child integer value of 'node' with the key 'name'.

If not found, return default value.

kzFloat kzcSettingNodeGetFloatDefault ( const struct KzcSettingNode node,
kzString  name,
kzFloat  defaultValue 
)

Try to get child float value of 'node' with the key 'name'.

If not found, return default value.

kzString kzcSettingNodeGetStringDefault ( const struct KzcSettingNode node,
kzString  name,
kzString  defaultValue 
)

Try to get child string value of 'node' with the key 'name'.

If not found, return default value.

kzsError kzcSettingNodeRemoveSetting ( const struct KzcSettingNode node,
kzString  name 
)

Try to remove setting under node.

struct KzcHashMap* kzcSettingNodeGetDictionary ( const struct KzcSettingNode node)

Accessor to node dictionary.

void* kzcSettingGetData ( struct KzcSetting setting,
enum KzcSettingType out_type 
)

Accessor to setting data.

enum KzcSettingType kzcSettingNodeGetType ( const struct KzcSettingNode node,
kzString  name 
)

Get type of node.

kzsError kzcSettingNodeClear ( const struct KzcSettingNode node)

Clears all data from setting node.