// Copyright 2011-2022 David Robillard // SPDX-License-Identifier: ISC #ifndef SERD_STRING_H #define SERD_STRING_H #include "serd/attributes.h" #include "serd/node.h" #include "zix/attributes.h" #include SERD_BEGIN_DECLS /** @defgroup serd_string String Utilities @ingroup serd_utilities @{ */ /** Measure a UTF-8 string. @return Length of `str` in bytes. @param str A null-terminated UTF-8 string. @param flags (Output) Set to the applicable flags. */ SERD_API size_t serd_strlen(const char* ZIX_NONNULL str, SerdNodeFlags* ZIX_NULLABLE flags); /** Decode a base64 string. This function can be used to decode a node created with serd_new_base64(). @param str Base64 string to decode. @param len The length of `str`. @param size Set to the size of the returned blob in bytes. @return A newly allocated blob which must be freed with serd_free(). */ SERD_API void* ZIX_ALLOCATED serd_base64_decode(const char* ZIX_NONNULL str, size_t len, size_t* ZIX_NONNULL size); /** @} */ SERD_END_DECLS #endif // SERD_STRING_H