From 13650527bec544d006ad095726ee44dc137e2dea Mon Sep 17 00:00:00 2001
From: Syping <schiedelrafael@keppe.org>
Date: Sun, 8 Jan 2023 13:57:37 +0100
Subject: [PATCH] add function ragephoto_getphotodata() to the C API

RagePhoto: add function ragephoto_getphotodata() to the C API
RagePhotoA: wrap data() function to ragephoto_getphotodata()
RagePhotoC: update header for ragephoto_getphotodata()
RagePhotoData: improve header include statement
---
 src/RagePhoto.cpp   | 6 ++++++
 src/RagePhotoA.h    | 4 ++++
 src/RagePhotoC.h    | 6 ++++++
 src/RagePhotoData.h | 2 +-
 4 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/RagePhoto.cpp b/src/RagePhoto.cpp
index bd243a5..db511e7 100644
--- a/src/RagePhoto.cpp
+++ b/src/RagePhoto.cpp
@@ -1082,6 +1082,12 @@ uint32_t ragephoto_format_rdr2()
     return RagePhoto::RDR2;
 }
 
+RagePhotoData* ragephoto_getphotodata(ragephoto_t instance)
+{
+    RagePhoto *ragePhoto = static_cast<RagePhoto*>(instance);
+    return ragePhoto->data();
+}
+
 const char* ragephoto_getphotodesc(ragephoto_t instance)
 {
     RagePhoto *ragePhoto = static_cast<RagePhoto*>(instance);
diff --git a/src/RagePhotoA.h b/src/RagePhotoA.h
index 9771fac..5f897d7 100644
--- a/src/RagePhotoA.h
+++ b/src/RagePhotoA.h
@@ -102,6 +102,10 @@ public:
     void clear() {
         ragephoto_clear(instance);
     }
+    /** Returns the internal RagePhotoData object. */
+    RagePhotoData* data() {
+        return ragephoto_getphotodata(instance);
+    }
     /** Loads a Photo from a const char*.
     * \param data Photo data
     * \param size Photo data size
diff --git a/src/RagePhotoC.h b/src/RagePhotoC.h
index 53a8bee..799eb54 100644
--- a/src/RagePhotoC.h
+++ b/src/RagePhotoC.h
@@ -20,6 +20,7 @@
 #define RAGEPHOTOC_H
 
 #include "libragephoto_global.h"
+#include "RagePhotoData.h"
 #include <stdint.h>
 #include <stdio.h>
 
@@ -72,6 +73,11 @@ LIBRAGEPHOTO_C_EXPORT uint32_t ragephoto_format_gta5();
 /** Returns the RDR 2 Photo Format. */
 LIBRAGEPHOTO_C_EXPORT uint32_t ragephoto_format_rdr2();
 
+/** Returns the internal RagePhotoData object.
+* \param instance \p ragephoto_t instance
+*/
+LIBRAGEPHOTO_C_EXPORT RagePhotoData* ragephoto_getphotodata(ragephoto_t instance);
+
 /** Returns the Photo description.
 * \param instance \p ragephoto_t instance
 */
diff --git a/src/RagePhotoData.h b/src/RagePhotoData.h
index 6a2d6a5..b120d6a 100644
--- a/src/RagePhotoData.h
+++ b/src/RagePhotoData.h
@@ -19,7 +19,7 @@
 #ifndef RAGEPHOTODATA_H
 #define RAGEPHOTODATA_H
 
-#include "stdint.h"
+#include <stdint.h>
 
 typedef struct RagePhotoData {
     char* jpeg;