Oyranos  git-devel
Oyranos is a full featured Color Management System
Data Structures | Macros | Typedefs | Enumerations | Functions
oyjl_tree.h File Reference

Oyjl API provides a platformindependent C interface for JSON I/O, conversion to and from XML + YAML. More...

Data Structures

struct  oyjl_val_s
 

Macros

#define OYJL_NUMBER_DETECTION   0x1000
 try to parse values as number More...
 
#define OYJL_DECIMAL_SEPARATOR_COMMA   0x2000
 use comma ',' as decimal separator More...
 
#define OYJL_ALLOW_STATIC   0x10
 allow to read static format More...
 
#define OYJL_DELIMITER_COMMA   0x20
 ',' comma More...
 
#define OYJL_DELIMITER_SEMICOLON   0x40
 ';' semicolon More...
 
#define OYJL_JSON   0x01
 JSON format; default. More...
 
#define OYJL_YAML   0x04
 YAML format. More...
 
#define OYJL_XML   0x08
 XML format. More...
 
#define OYJL_CSV   0x20
 CSV format - needs 2D array. More...
 
#define OYJL_CSV_SEMICOLON   0x40
 CSV format - needs 2D array. More...
 
#define OYJL_HTML   0x100
 Formatting flag for markup on output. More...
 
#define OYJL_NO_MARKUP   0x10000
 expect plain text More...
 
#define OYJL_PATH   0x08
 flag to obtain only path More...
 
#define OYJL_KEY   0x10
 flat to obtain only keys More...
 
#define OYJL_NO_ALLOC   0x800
 avoid malloc for oyjlOBJECT_JSON More...
 
#define OYJL_CREATE_NEW   0x02
 flag to allocate a new tree node, in case it is not inside More...
 
#define OYJL_PATH_MATCH_LEN   0x20
 flag to test if the specified path match with the full length. More...
 
#define OYJL_PATH_MATCH_LAST_ITEMS   0x40
 flag to test only the last path segments, which are separated by slash '/'. More...
 
#define OYJL_OBSERVE   0x200000
 be verbose on change More...
 

Typedefs

typedef struct oyjl_val_soyjl_val
 
typedef struct oyjl_val_s oyjl_val_s
 

Enumerations

enum  oyjl_type {
  oyjl_t_string = 1, oyjl_t_number = 2, oyjl_t_object = 3, oyjl_t_array = 4,
  oyjl_t_true = 5, oyjl_t_false = 6, oyjl_t_null = 7
}
 
enum  oyjlPARSE_STATE_e {
  oyjlPARSE_STATE_NONE, oyjlPARSE_STATE_NOT_COMPILED, oyjlPARSE_STATE_FORMAT_ERROR, oyjlPARSE_STATE_PARSER_ERROR,
  oyjlPARSE_STATE_RETURN_STATIC
}
 

Functions

OYJL_API oyjl_val oyjlTreeParse (const char *input, char *error_buffer, size_t error_buffer_size)
 Parse a string. (libOyjl) More...
 
void oyjlTreeFree (oyjl_val v)
 release a node and all its childs recursively More...
 
oyjl_val oyjlTreeParse2 (const char *text, int flags, const char *error_name, int *status)
 read a JSON, XML or YAML text string into a C data structure (libOyjl) More...
 
oyjl_val oyjlTreeNew (const char *path)
 create a node by a path expression More...
 
void oyjlTreeClearValue (oyjl_val root, const char *xpath)
 release a specific node and all its childs More...
 
char * oyjlTreeToText (oyjl_val v, int flags)
 convert a C tree into a text string More...
 
void oyjlTreeToJson (oyjl_val v, int *level, char **json)
 convert a C tree into a JSON string More...
 
void oyjlTreeToYaml (oyjl_val v, int *level, char **text)
 convert a C tree into a YAML string More...
 
void oyjlTreeToXml (oyjl_val v, int *level, char **text)
 convert a C tree into a XML string More...
 
void oyjlTreeToCsv (oyjl_val table, int flags, char **text)
 convert a C 2D table into a CSV string More...
 
char ** oyjlTreeToPaths (oyjl_val root, int levels, const char *xpath, int flags, int *count)
 find matching paths More...
 
char * oyjlTreeGetPath (oyjl_val v, oyjl_val node)
 get a full path string from a child node More...
 
oyjl_val oyjlTreeGetValue (oyjl_val v, int flags, const char *xpath)
 obtain a node by a path expression More...
 
oyjl_val oyjlTreeGetNewValueFromArray (oyjl_val root, const char *name, oyjl_val *array_ret, int *pos_ret)
 obtain a new node object possibly in array More...
 
oyjl_val oyjlTreeGetValueF (oyjl_val v, int flags, const char *xformat,...)
 get a child node by a path expression More...
 
int oyjlTreeSetStringF (oyjl_val root, int flags, const char *value_text, const char *xformat,...)
 set a child node to a string value More...
 
int oyjlTreeSetDoubleF (oyjl_val root, int flags, double value, const char *xformat,...)
 set a child node to a string value More...
 
int oyjlTreeSetIntF (oyjl_val root, int flags, long long value, const char *xformat,...)
 set a child node to a string value More...
 
oyjl_val oyjlTreeSerialise (oyjl_val v, int flags, int *size)
 write tree to data block More...
 
oyjl_val oyjlTreeDeSerialise (oyjl_val v, int flags, int size)
 create tree from serialised data block More...
 
int oyjlValueCount (oyjl_val v)
 return the number of members if any at the node level More...
 
oyjl_val oyjlValuePosGet (oyjl_val v, int pos)
 obtain a child node at the nth position from a object or array node More...
 
int oyjlValueSetString (oyjl_val v, const char *string)
 set the node value to a string More...
 
int oyjlValueSetDouble (oyjl_val v, double value)
 set a child node to a string value More...
 
int oyjlValueSetInt (oyjl_val v, long long value)
 set a child node to a number value More...
 
void oyjlValueCopy (oyjl_val v, oyjl_val src)
 copy only one level of allocation More...
 
void oyjlValueClear (oyjl_val v)
 release all childs recursively More...
 
int oyjlPathMatch (const char *path, const char *xpath, int flags)
 search for xpath pattern matching in a full path More...
 
int oyjlDataFormat (const char *text)
 detect data type More...
 
const char * oyjlDataFormatToString (int format)
 name data format More...
 
const char * oyjlJsonEscape (const char *in, int flags)
 Convert strings to pass through JSON. More...
 

Detailed Description

Oyjl API provides a platformindependent C interface for JSON I/O, conversion to and from XML + YAML.

oyjl - tree C API's

Copyright:
2010-2023 (C) Kai-Uwe Behrmann
Author
Kai-Uwe Behrmann ku.b@.nosp@m.gmx..nosp@m.de and Florian Forster <ff at octo.it>
License:
MIT http://www.opensource.org/licenses/mit-license.php
Since
2010/09/15