OpenICC Documentation  git-devel
OpenICC provides a simple Color Management configuration API
Public Member Functions
openiccConfig_s Struct Reference

Low level Configuration Object. More...

Collaboration diagram for openiccConfig_s:
Collaboration graph

Public Member Functions

openiccConfig_sopeniccConfig_FromMem (const char *data)
 load configurations from in memory JSON text More...
 
void openiccConfig_Release (openiccConfig_s **config)
 release the data base object More...
 
void openiccConfig_SetInfo (openiccConfig_s *config, const char *debug_info)
 add a string for debugging and error messages More...
 
int openiccConfig_DevicesCount (openiccConfig_s *config, const char **device_classes)
 count devices in data base object More...
 
const char * openiccConfig_DeviceGet (openiccConfig_s *config, const char **device_classes, int pos, char ***keys, char ***values, openiccAlloc_f alloc, openiccDeAlloc_f dealloc)
 get keys and their values More...
 
const char * openiccConfig_DeviceGetJSON (openiccConfig_s *config, const char **device_classes, int pos, int flags, const char *device_class, char **json, openiccAlloc_f alloc, openiccDeAlloc_f dealloc)
 obtain a JSON string More...
 
char * openiccConfig_DeviceClassGet (openiccConfig_s *config, openiccAlloc_f alloc)
 find out the device class of a given data base entry More...
 
int openiccConfig_GetKeyNames (openiccConfig_s *config, const char *xpath, int child_levels, openiccAlloc_f alloc, char ***key_names, int *n)
 get a filtered list of key names More...
 
int openiccConfig_GetString (openiccConfig_s *config, const char *xpath, const char **value)
 get a value More...
 
int openiccConfig_GetStringf (openiccConfig_s *config, const char **value, const char *format,...)
 get a value More...
 
int openiccConfig_GetStrings (openiccConfig_s *config, const char **xpaths, openiccAlloc_f alloc, char ***values, int *n)
 get a set of values More...
 

Detailed Description

Low level Configuration Object.

Hold a set of keys inside a text/json representation.

Version
OpenICC Config: 0.0.1
Date
2013/09/17
Since
2013/09/17 (OpenICC Config: 0.0.1)
Examples:
openicc_config_read.c, and test.c.

Member Function Documentation

◆ openiccConfig_DeviceClassGet()

char * openiccConfig_DeviceClassGet ( openiccConfig_s config,
openiccAlloc_f  alloc 
)

find out the device class of a given data base entry

Parameters
[in]configa data base entry object
[in]allocuser allocation function
Examples:
openicc_config_read.c, and test.c.

◆ openiccConfig_DeviceGet()

const char * openiccConfig_DeviceGet ( openiccConfig_s config,
const char **  device_classes,
int  pos,
char ***  keys,
char ***  values,
openiccAlloc_f  alloc,
openiccDeAlloc_f  dealloc 
)

get keys and their values

Parameters
[in]configthe data base object
[in]device_classesthe device class filter
[in]posthe device position
[out]keysa zero terminated list of device keys
[out]valuesa zero terminated list of device values
[in]allocuser allocation function
Examples:
openicc_config_read.c, and test.c.

◆ openiccConfig_DeviceGetJSON()

const char * openiccConfig_DeviceGetJSON ( openiccConfig_s config,
const char **  device_classes,
int  pos,
int  flags,
const char *  device_class,
char **  json,
openiccAlloc_f  alloc,
openiccDeAlloc_f  dealloc 
)

obtain a JSON string

Parameters
[in]configa data base object
[in]device_classesa zero terminated list of device class strings
[in]posdevice position in list
[in]flags- OPENICC_CONFIGS_SKIP_HEADER
  • OPENICC_CONFIGS_SKIP_FOOTER
[in]device_classthe last written device class
[out]jsonthe resulting JSON string allocated by alloc
[in]allocuser allocation function
Returns
device class
Examples:
openicc_config_read.c, and test.c.

◆ openiccConfig_DevicesCount()

int openiccConfig_DevicesCount ( openiccConfig_s config,
const char **  device_classes 
)

count devices in data base object

Parameters
[in]configthe data base object
[in]device_classesthe device class filter
Returns
count of matching device configurations
Examples:
openicc_config_read.c, and test.c.

References openiccConfigGetDeviceClasses().

◆ openiccConfig_FromMem()

openiccConfig_s * openiccConfig_FromMem ( const char *  data)

load configurations from in memory JSON text

Create a config object from JSON text. Add a ID afterwards for better error messages with openiccConfig_SetInfo() = source_file_name.

Examples:
openicc_config_read.c, and test.c.

◆ openiccConfig_GetKeyNames()

int openiccConfig_GetKeyNames ( openiccConfig_s config,
const char *  xpath,
int  child_levels,
openiccAlloc_f  alloc,
char ***  key_names,
int *  n 
)

get a filtered list of key names

Parameters
[in]configa data base entry object
[in]xpathtop key name to filter for
[in]child_levelshow deeply nested child levels are desired; 0 - means all levels
[in]allocuser allocation function; optional - default: malloc
[out]key_namesfound full keys with path part; optional
[out]nnumber of found keys; optional
Returns
0 - success, >=1 - error, <0 - issue
Examples:
test.c.

◆ openiccConfig_GetString()

int openiccConfig_GetString ( openiccConfig_s config,
const char *  xpath,
const char **  value 
)

get a value

Parameters
[in]configa data base entry object
[in]xpathkey name to ask for
[out]valuefound value; optional
Returns
0 - success, >=1 - error, <0 - issue

Referenced by openiccConfig_GetStringf().

◆ openiccConfig_GetStringf()

int openiccConfig_GetStringf ( openiccConfig_s config,
const char **  value,
const char *  format,
  ... 
)

get a value

Parameters
[in]configa data base entry object
[out]valuefound value
[in]formatfull key name to ask for
Returns
0 - success, >=1 - error, <0 - issue
Examples:
test.c.

References openiccConfig_GetString().

◆ openiccConfig_GetStrings()

int openiccConfig_GetStrings ( openiccConfig_s config,
const char **  xpaths,
openiccAlloc_f  alloc,
char ***  values,
int *  n 
)

get a set of values

Parameters
[in]configa data base entry object
[in]xpathskey names to use
[in]allocuser allocation function; optional - default: malloc
[out]valuesfound values; optional
[out]nnumber of found values; optional
Returns
0 - success, >=1 - error, <0 - issue
Examples:
test.c.

◆ openiccConfig_Release()

void openiccConfig_Release ( openiccConfig_s **  config)

release the data base object

Examples:
openicc_config_read.c, and test.c.

◆ openiccConfig_SetInfo()

void openiccConfig_SetInfo ( openiccConfig_s config,
const char *  debug_info 
)

add a string for debugging and error messages

Examples:
openicc_config_read.c, and test.c.