From 49cbc8df7672c4dd5fa0c73e9046ee91924ae4b8 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Thu, 7 Nov 2019 04:54:45 +0100 Subject: Add plist_get_data_ptr() and plist_get_string_ptr() to the interface --- include/plist/plist.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'include/plist/plist.h') diff --git a/include/plist/plist.h b/include/plist/plist.h index 824ba43..29b1fce 100644 --- a/include/plist/plist.h +++ b/include/plist/plist.h @@ -462,6 +462,19 @@ extern "C" */ void plist_get_string_val(plist_t node, char **val); + /** + * Get a pointer to the buffer of a #PLIST_STRING node. + * + * @note DO NOT MODIFY the buffer. Mind that the buffer is only available + * until the plist node gets freed. Make a copy if needed. + * + * @param node The node + * @param length If non-NULL, will be set to the length of the string + * + * @return Pointer to the NULL-terminated buffer. + */ + const char* plist_get_string_ptr(plist_t node, uint64_t* length); + /** * Get the value of a #PLIST_BOOLEAN node. * This function does nothing if node is not of type #PLIST_BOOLEAN @@ -500,6 +513,19 @@ extern "C" */ void plist_get_data_val(plist_t node, char **val, uint64_t * length); + /** + * Get a pointer to the data buffer of a #PLIST_DATA node. + * + * @note DO NOT MODIFY the buffer. Mind that the buffer is only available + * until the plist node gets freed. Make a copy if needed. + * + * @param node The node + * @param length Pointer to a uint64_t that will be set to the length of the buffer + * + * @return Pointer to the buffer + */ + const char* plist_get_data_ptr(plist_t node, uint64_t* length); + /** * Get the value of a #PLIST_DATE node. * This function does nothing if node is not of type #PLIST_DATE -- cgit v1.1-32-gdbae