summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2026-03-22 19:16:51 +0100
committerGravatar Nikias Bassen2026-03-22 19:16:51 +0100
commitc8b36a80bad4a1fe488927af4da0ecbcf10079bb (patch)
tree657066f92a85dc43bd51af7698e76d00c29c0b4a /include
parent3edac28498d883f1f768699ee15ce85a82bb2a7b (diff)
downloadlibplist-c8b36a80bad4a1fe488927af4da0ecbcf10079bb.tar.gz
libplist-c8b36a80bad4a1fe488927af4da0ecbcf10079bb.tar.bz2
Add OpenStep coercion support for non-OpenStep plist types
- Use PLIST_OPT_COERCE option to coerce PLIST_BOOLEAN, PLIST_DATE, PLIST_UID, and PLIST_NULL to OpenStep-compatible types (1 or 0, ISO 8601 strings, integers, and 'NULL' string) - Add plist_to_openstep_with_options() function to allow passing coercion option (and others) - Update plist_write_to_string() and plist_write_to_stream() accordingly
Diffstat (limited to 'include')
-rw-r--r--include/plist/plist.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/plist/plist.h b/include/plist/plist.h
index bd35c53..94930b8 100644
--- a/include/plist/plist.h
+++ b/include/plist/plist.h
@@ -978,6 +978,30 @@ extern "C"
978 */ 978 */
979 PLIST_API plist_err_t plist_to_openstep(plist_t plist, char **plist_openstep, uint32_t* length, int prettify); 979 PLIST_API plist_err_t plist_to_openstep(plist_t plist, char **plist_openstep, uint32_t* length, int prettify);
980 980
981 /**
982 * Export the #plist_t structure to OpenStep format with extended options.
983 *
984 * When \a PLIST_OPT_COMPACT is set in \a options, the resulting OpenStep output
985 * will be non-prettified.
986 *
987 * When \a PLIST_OPT_COERCE is set in \a options, plist types that have
988 * no native OpenStep representation are converted to OpenStep-compatible types
989 * instead of returning #PLIST_ERR_FORMAT:
990 * - #PLIST_BOOLEAN is serialized as a 1 or 0
991 * - #PLIST_DATE is serialized as an ISO 8601 date string
992 * - #PLIST_NULL is serialized as string 'NULL'
993 * - #PLIST_UID is serialized as an integer
994 *
995 * @param plist the root node to export
996 * @param plist_openstep a pointer to a char* buffer. This function allocates the memory,
997 * caller is responsible for freeing it.
998 * @param length a pointer to an uint32_t variable. Represents the length of the allocated buffer.
999 * @param options One or more bitwise ORed values of #plist_write_options_t.
1000 * @return PLIST_ERR_SUCCESS on success or a #plist_err_t on failure
1001 * @note Use plist_mem_free() to free the allocated memory.
1002 */
1003 PLIST_API plist_err_t plist_to_openstep_with_options(plist_t plist, char **plist_openstep, uint32_t* length, plist_write_options_t options);
1004
981 1005
982 /** 1006 /**
983 * Import the #plist_t structure from XML format. 1007 * Import the #plist_t structure from XML format.