Files
obitools3/src/libjson/json_utils.h

44 lines
1.3 KiB
C
Raw Normal View History

/********************************************************************
* Json utils header file *
********************************************************************/
/**
* @file json_utils.h
* @author Celine Mercier (celine.mercier@metabarcoding.org)
* @date 27 August 2018
* @brief Header file for the JSON utils functions.
*/
#ifndef JSON_UTILS_H_
#define JSON_UTILS_H_
#include <stdlib.h>
#include <stdint.h>
/**
* @brief Add a comment (in the key/value form) to a (JSON formatted) comments character string.
*
* @warning If the key is already in the structure, its associated value is turned
* into an array if needed and the new value is added to that array.
* // TODO discuss replace boolean
*
* @warning The returned pointer has to be freed by the caller.
*
* @param comments The initial comments, in the form of a JSON formatted character string.
* @param key The key of the key/value pair to add.
* @param value The value of the key/value pair to add.
*
* @returns A pointer on the comments with the added key/value element.
* @retval NULL if an error occurred.
*
* @since August 2018
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
char* obi_add_comment(char* comments, const char* key, const char* value);
#endif /* JSON_UTILS_H_ */