Views: implemented handling of JSON formatted comments

This commit is contained in:
Celine Mercier
2018-10-07 18:56:46 +02:00
parent bc8c394061
commit 86bb582a17
2 changed files with 150 additions and 139 deletions

View File

@ -59,6 +59,8 @@
*/
#define ID_PREFIX "seq" /**< The default prefix of sequence identifiers in automatic ID columns.
*/
#define PREDICATE_KEY "predicates" /**< The key used in the json-formatted view comments to store predicates.
*/
/**
@ -484,6 +486,44 @@ OBIDMS_column_p* obi_view_get_pointer_on_column_in_view(Obiview_p view, const ch
int obi_view_create_column_alias(Obiview_p view, const char* current_name, const char* alias);
/**
* @brief Internal function writing new comments in a view file.
*
* The new comments replace the pre-existing ones.
* The view file is enlarged if necessary.
*
* @param view A pointer on the view.
* @param comments The new comments that should be written.
*
* @retval 0 if the operation was successfully completed.
* @retval -1 if an error occurred.
*
* @since August 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int obi_view_write_comments(Obiview_p view, const char* comments);
/**
* @brief Adds comments to a view file.
*
* This reads the comments in the JSON format and adds the key value pair.
* If the key already exists, the value format is turned into an array and the new value is appended
* if it is not already in the array.
*
* @param column A pointer on an OBIDMS column.
* @param key The key.
* @param value The value associated with the key.
*
* @retval 0 if the operation was successfully completed.
* @retval -1 if an error occurred.
*
* @since August 2018
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int obi_view_add_comment(Obiview_p view, const char* key, const char* value);
/**
* @brief Closes an opened view, and saves it if it is not read-only (meaning it is not already saved in the view file).
*