Harlequin RIP SDK

Header file defining the Structured data callback API. More...

#include "ripcall.h"
#include <stddef.h>
#include "swapi.h"
#include "swblobapi.h"

Data Structures

struct  sw_datum
 Structured data instance type. More...
 
struct  sw_data_api
 A structure containing callback functions for structured data access. More...
 
struct  sw_data_match
 A structure used for extracting multiple values from an array or dictionary in one go. More...
 

Macros

#define SW_DATUM_INVALID   {SW_DATUM_TYPE_INVALID}
 Auto/static initializer for sw_datum invalid values. More...
 
#define SW_DATUM_NOTHING   {SW_DATUM_TYPE_NOTHING}
 Auto/static initializer for sw_datum nothing values. More...
 
#define SW_DATUM_NULL   {SW_DATUM_TYPE_NULL}
 Auto/static initializer for sw_datum null values. More...
 
#define SW_DATUM_INTEGER(_int)    {SW_DATUM_TYPE_INTEGER, 0,0,0, NULL, 0, { (void *)((intptr_t)(_int)) }}
 Auto/static initializer for sw_datum integer values. More...
 
#define SW_DATUM_BOOLEAN(_bool)    {SW_DATUM_TYPE_BOOLEAN, 0,0,0, NULL, 0, { (void *)((intptr_t)(_bool)) }}
 Auto/static initializer for sw_datum boolean values. More...
 
#define SW_DATUM_STRING(_str)    {SW_DATUM_TYPE_STRING, 0,0,0, NULL, sizeof("" _str "") - 1, {(const void *)("" _str "")}}
 Auto/static initializer for sw_datum string values. More...
 
#define SW_DATUM_NAME(_str)    {SW_DATUM_TYPE_STRING, SW_DATUM_SUBTYPE_NAME_STRING,0,0, NULL, sizeof("" _str "") - 1, {(const void *)("" _str "")}}
 Auto/static initializer for sw_datum name values. More...
 
#define SW_DATUM_ARRAY(_array, _len)    {SW_DATUM_TYPE_ARRAY, 0,0,0, NULL, (_len), { (void *)(_array) }}
 Auto/static initializer for sw_datum array values. More...
 
#define SW_DATUM_STACK(_stack, _len)    {SW_DATUM_TYPE_ARRAY, SW_DATUM_SUBTYPE_STACK_ARRAY,0,0, NULL, (_len), { (void *)(_stack) }}
 Auto/static initializer for sw_datum stack values. More...
 
#define SW_DATUM_DICT(_dict, _len)    {SW_DATUM_TYPE_DICT, 0,0,0, NULL, (_len), { (void *)(_dict) }}
 Auto/static initializer for sw_datum dictionary values. More...
 
#define SW_DATA_ARRAY_LENGTH(_array)   (sizeof(_array) / sizeof((_array)[0]))
 Count the members of a local data array. Useful for statically initialising arrays.
 
#define SW_DATA_DICT_LENGTH(_dict)   (SW_DATA_ARRAY_LENGTH(_dict) >> 1)
 Count the members of a local data dictionary. Useful for statically initialising dictionaries.
 
#define SW_DATUM_0_0F   0
 A constant of real value 0.0 for use with the SW_DATUM_FLOAT() static initializer.
 
#define SW_DATUM_1_0F   1065353216
 A constant of real value 1.0 for use with the SW_DATUM_FLOAT() static initializer.
 
#define SW_DATUM_0_5F   1056964608
 A constant of real value 0.5 for use with the SW_DATUM_FLOAT() static initializer.
 
#define SW_DATUM_FLOAT(_real)    {SW_DATUM_TYPE_FLOAT, 0,0,0, NULL, 0, { (void *)((intptr_t)(_real)) }}
 Auto/static initializer for sw_datum float values, for use with the defined constants that can be used with this initializer. More...
 
#define SW_DATUM_REQUIREDKEY(type, name)    {SW_DATUM_BIT_##type,SW_DATUM_STRING(""name""),SW_DATUM_NOTHING}
 A key initializer macro to help build the sw_data_match structure. More...
 
#define SW_DATUM_OPTIONALKEY(type, name)    {SW_DATUM_BIT_##type|SW_DATUM_BIT_NOTHING,SW_DATUM_STRING(""name""),SW_DATUM_NOTHING}
 A key initializer macro to help build the sw_data_match structure. More...
 

Typedefs

typedef HqnResult sw_data_result
 Type of return values from sw_data_api functions. More...
 
typedef struct sw_data_api sw_data_api
 Type definition for the structured data interface implementation.
 
typedef struct sw_datum sw_datum
 Structured data instance type. More...
 
typedef struct sw_data_match sw_data_match
 A structure used for matching multiple datum entries in one go.
 
typedef struct sw_data_iterator sw_data_iterator
 An opaque type used by the data provider to iterate data structures.
 

Enumerations

enum  {
  SW_DATA_API_VERSION_20070525 = 2 , SW_DATA_API_VERSION_20070620 , SW_DATA_API_VERSION_20071111 , SW_DATA_API_VERSION_20090415 ,
  SW_DATA_API_VERSION_20130321 , SW_DATA_API_VERSION_20181206
}
 Version numbers defined for the structured data API. More...
 
enum  SW_DATA_RESULT {
  SW_DATA_OK = HQN_RESULT_SUCCESS , SW_DATA_FINISHED = -1 , SW_DATA_ERROR = 1 , SW_DATA_ERROR_TYPECHECK ,
  SW_DATA_ERROR_RANGECHECK , SW_DATA_ERROR_INVALIDACCESS , SW_DATA_ERROR_UNDEFINED , SW_DATA_ERROR_MEMORY ,
  SW_DATA_ERROR_SYNTAX
}
 Return values from sw_data_api functions. More...
 
enum  SW_DATUM_TYPES {
  SW_DATUM_TYPE_NOTHING = 0 , SW_DATUM_TYPE_NULL , SW_DATUM_TYPE_BOOLEAN , SW_DATUM_TYPE_INTEGER ,
  SW_DATUM_TYPE_FLOAT , SW_DATUM_TYPE_STRING , SW_DATUM_TYPE_ARRAY , SW_DATUM_TYPE_DICT ,
  SW_DATUM_TYPE_BLOB , SW_DATUM_TYPE_INVALID = 31
}
 Data types for structured data. More...
 
enum  SW_DATUM_BITS {
  SW_DATUM_BIT_NOTHING = 1u << SW_DATUM_TYPE_NOTHING , SW_DATUM_BIT_NULL = 1u << SW_DATUM_TYPE_NULL , SW_DATUM_BIT_BOOLEAN = 1u << SW_DATUM_TYPE_BOOLEAN , SW_DATUM_BIT_INTEGER = 1u << SW_DATUM_TYPE_INTEGER ,
  SW_DATUM_BIT_FLOAT = 1u << SW_DATUM_TYPE_FLOAT , SW_DATUM_BIT_STRING = 1u << SW_DATUM_TYPE_STRING , SW_DATUM_BIT_ARRAY = 1u << SW_DATUM_TYPE_ARRAY , SW_DATUM_BIT_DICT = 1u << SW_DATUM_TYPE_DICT ,
  SW_DATUM_BIT_BLOB = 1u << SW_DATUM_TYPE_BLOB , SW_DATUM_BIT_INVALID = 1u << SW_DATUM_TYPE_INVALID
}
 Data type bits. More...
 
enum  SW_DATUM_SUBTYPES { SW_DATUM_SUBTYPE_NONE = 0 , SW_DATUM_SUBTYPE_NAME_STRING = 1 , SW_DATUM_SUBTYPE_STACK_ARRAY = 1 }
 Data subtypes for structured data. More...
 

Functions

HqnResult swdata_result_translate (sw_data_result result)
 Translate a data API-specific error code to a generic HqnResult error code. More...
 
void sw_datum_get_integer (const sw_datum *datum, int value, sw_data_result result)
 A utility macro to extract an integer value from a sw_datum object of integer or float type. More...
 
void sw_datum_get_real (const sw_datum *datum, float_or_double_specifier type, float_or_double value, sw_data_result result)
 A utility macro to extract a real value from a sw_datum object of integer or float type. More...
 

Detailed Description

Header file defining the Structured data callback API.

Copyright (C) 2023 Global Graphics Software Ltd. All rights reserved.

This source code contains the confidential and trade secret information of Global Graphics Software Ltd. It may not be used, copied or distributed for any reason except as set forth in the applicable Global Graphics license agreement.