From 4c43596e2a777d617c3b235030eaf7a85992ff64 Mon Sep 17 00:00:00 2001 From: Syping Date: Fri, 5 Nov 2021 16:20:43 +0100 Subject: [PATCH] C API: add ragephoto_clear() --- src/RagePhoto.cpp | 6 ++++++ src/RagePhoto.h | 5 +++++ src/RagePhotoA.h | 3 +++ 3 files changed, 14 insertions(+) diff --git a/src/RagePhoto.cpp b/src/RagePhoto.cpp index 9dc5e57..0802d44 100644 --- a/src/RagePhoto.cpp +++ b/src/RagePhoto.cpp @@ -915,6 +915,12 @@ ragephoto_t ragephoto_open() return static_cast(new RagePhoto); } +void ragephoto_clear(ragephoto_t instance) +{ + RagePhoto *ragePhoto = static_cast(instance); + ragePhoto->clear(); +} + int ragephoto_load(ragephoto_t instance, const char *data, size_t size) { RagePhoto *ragePhoto = static_cast(instance); diff --git a/src/RagePhoto.h b/src/RagePhoto.h index 1596d2d..cc1cc1b 100644 --- a/src/RagePhoto.h +++ b/src/RagePhoto.h @@ -193,6 +193,11 @@ typedef void* ragephoto_t; /** Opens a \p ragephoto_t instance. */ LIBRAGEPHOTO_EXPORT ragephoto_t ragephoto_open(); +/** Resets the RagePhoto instance to default values. +* \param instance \p ragephoto_t instance +*/ +LIBRAGEPHOTO_EXPORT void ragephoto_clear(ragephoto_t instance); + /** Loads a Photo from a const char*. * \param instance \p ragephoto_t instance * \param data Photo data diff --git a/src/RagePhotoA.h b/src/RagePhotoA.h index edd19aa..8684f44 100644 --- a/src/RagePhotoA.h +++ b/src/RagePhotoA.h @@ -37,6 +37,9 @@ public: ~RagePhotoA() { ragephoto_close(instance); } + void clear() { + ragephoto_clear(instance); + } bool load(const char *data, size_t size) { return ragephoto_load(instance, data, size); }