98 instance = ragephoto_open();
101 ragephoto_close(instance);
105 ragephoto_addparser(instance, rp_parser);
109 ragephotodata_clear(rp_data);
113 ragephoto_clear(instance);
117 return ragephoto_getphotodata(instance);
121 return ragephotodata_load(rp_data, rp_parser,
data, size);
128 return ragephoto_load(instance,
data, size);
134 return ragephoto_load(instance,
data.data(),
data.size());
140 return ragephoto_loadfile(instance, filename);
144 return ragephoto_error(instance);
148 return ragephoto_getphotoformat(instance);
151 const std::string
jpeg()
const {
152 const char *
jpegData = ragephoto_getphotojpeg(instance);
154 return std::string(
jpegData, ragephoto_getphotosize(instance));
156 return std::string();
158#if (__cplusplus >= 201703L)
161 const char *
jpegData = ragephoto_getphotojpeg(instance);
163 return std::string_view(
jpegData, ragephoto_getphotosize(instance));
165 return std::string_view();
170 return ragephoto_getphotojpeg(instance);
174 return ragephotodata_getphotosignf(rp_data, photoFormat);
178 return ragephotodata_getphotosign(rp_data);
182 return ragephoto_getphotosignf(instance, photoFormat);
186 return ragephoto_getphotosign(instance);
190 return ragephoto_getphotosize(instance);
194 return ragephoto_getphotodesc(instance);
198 return ragephoto_getphotojson(instance);
202 return ragephoto_getphotoheader(instance);
206 return ragephoto_getphototitle(instance);
210 return ragephoto_version();
214 return ragephotodata_savef(rp_data, rp_parser,
data, photoFormat);
218 return ragephotodata_save(rp_data, rp_parser,
data);
225 return ragephoto_savef(instance,
data, photoFormat);
231 return ragephoto_save(instance,
data);
237 const std::string
save(uint32_t photoFormat,
bool *ok =
nullptr) {
239 const size_t size = ragephoto_getsavesizef(instance, photoFormat);
246 const bool saved = ragephoto_savef(instance, &sdata[0], photoFormat);
254 const std::string
save(
bool *ok =
nullptr) {
255 return save(ragephoto_getphotoformat(instance), ok);
258 bool saveFile(
const char *filename, uint32_t photoFormat) {
259 return ragephoto_savefilef(instance, filename, photoFormat);
263 return ragephoto_savefile(instance, filename);
267 return ragephotodata_getsavesizef(rp_data, rp_parser, photoFormat);
271 return ragephotodata_getsavesize(rp_data, rp_parser);
275 return ragephoto_getsavesizef(instance, photoFormat);
279 return ragephoto_getsavesize(instance);
283 ragephotodata_setbufferdefault(rp_data);
287 ragephoto_setbufferdefault(instance);
291 ragephotodata_setbufferoffsets(rp_data);
295 ragephoto_setbufferoffsets(instance);
300 return ragephoto_setphotodatac(instance, ragePhotoData);
302 return ragephoto_setphotodata(instance, ragePhotoData);
306 ragephoto_setphotodesc(instance,
description, bufferSize);
310 ragephoto_setphotoformat(instance, photoFormat);
317 bool setJpeg(
const char *
data, uint32_t size, uint32_t bufferSize = 0) {
318 return ragephoto_setphotojpeg(instance,
data, size, bufferSize);
325 return ragephoto_setphotojpeg(instance,
data.data(),
static_cast<uint32_t
>(
data.size()), bufferSize);
329 ragephoto_setphotojson(instance,
json, bufferSize);
333 ragephoto_setphotoheader2(instance,
header, headerSum, headerSum2);
337 ragephoto_setphototitle(instance,
title, bufferSize);
void * ragephoto_t
Definition RagePhoto.h:36
GTA V and RDR 2 Photo Parser (C API wrapper).
Definition RagePhotoA.hpp:31
const char * title() const
Definition RagePhotoA.hpp:205
bool setJpeg(const std::string &data, uint32_t bufferSize=0)
Definition RagePhotoA.hpp:324
PhotoFormat
Definition RagePhotoA.hpp:88
@ RDR2
Definition RagePhotoA.hpp:90
@ GTA5
Definition RagePhotoA.hpp:89
bool save(char *data)
Definition RagePhotoA.hpp:230
void clear()
Definition RagePhotoA.hpp:112
bool saveFile(const char *filename)
Definition RagePhotoA.hpp:262
bool setJpeg(const char *data, uint32_t size, uint32_t bufferSize=0)
Definition RagePhotoA.hpp:317
bool saveFile(const char *filename, uint32_t photoFormat)
Definition RagePhotoA.hpp:258
bool load(const std::string &data)
Definition RagePhotoA.hpp:133
SignInitials
Definition RagePhotoA.hpp:93
@ SIRDR2
Definition RagePhotoA.hpp:95
@ SIGTA5
Definition RagePhotoA.hpp:94
int32_t error() const
Definition RagePhotoA.hpp:143
uint64_t jpegSign() const
Definition RagePhotoA.hpp:185
bool load(const char *data, size_t size)
Definition RagePhotoA.hpp:127
bool save(char *data, uint32_t photoFormat)
Definition RagePhotoA.hpp:224
static bool save(char *data, RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser)
Definition RagePhotoA.hpp:217
static uint64_t jpegSign(uint32_t photoFormat, RagePhotoData *rp_data)
Definition RagePhotoA.hpp:173
const char * header() const
Definition RagePhotoA.hpp:201
static void setBufferDefault(RagePhotoData *rp_data)
Definition RagePhotoA.hpp:282
static void clear(RagePhotoData *rp_data)
Definition RagePhotoA.hpp:108
bool loadFile(const char *filename)
Definition RagePhotoA.hpp:139
DefaultSize
Definition RagePhotoA.hpp:34
@ RDR2_HEADERSIZE
Definition RagePhotoA.hpp:41
@ DEFAULT_DESCBUFFER
Definition RagePhotoA.hpp:37
@ DEFAULT_RDR2_PHOTOBUFFER
Definition RagePhotoA.hpp:36
@ DEFAULT_GTA5_PHOTOBUFFER
Definition RagePhotoA.hpp:35
@ DEFAULT_TITLBUFFER
Definition RagePhotoA.hpp:39
@ GTA5_HEADERSIZE
Definition RagePhotoA.hpp:40
@ DEFAULT_JSONBUFFER
Definition RagePhotoA.hpp:38
static const char * version()
Definition RagePhotoA.hpp:209
size_t saveSize()
Definition RagePhotoA.hpp:278
uint64_t jpegSign(uint32_t photoFormat) const
Definition RagePhotoA.hpp:181
const std::string save(uint32_t photoFormat, bool *ok=nullptr)
Definition RagePhotoA.hpp:237
void setTitle(const char *title, uint32_t bufferSize=0)
Definition RagePhotoA.hpp:336
static bool load(const char *data, size_t size, RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser)
Definition RagePhotoA.hpp:120
static bool save(char *data, uint32_t photoFormat, RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser)
Definition RagePhotoA.hpp:213
const std::string_view jpeg_view() const
Definition RagePhotoA.hpp:160
static size_t saveSize(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser)
Definition RagePhotoA.hpp:270
RagePhotoData * data()
Definition RagePhotoA.hpp:116
void setBufferDefault()
Definition RagePhotoA.hpp:286
uint32_t jpegSize() const
Definition RagePhotoA.hpp:189
const std::string save(bool *ok=nullptr)
Definition RagePhotoA.hpp:254
void setHeader(const char *header, uint32_t headerSum, uint32_t headerSum2=0)
Definition RagePhotoA.hpp:332
const std::string jpeg() const
Definition RagePhotoA.hpp:151
uint32_t format() const
Definition RagePhotoA.hpp:147
void setJson(const char *json, uint32_t bufferSize=0)
Definition RagePhotoA.hpp:328
void setDescription(const char *description, uint32_t bufferSize=0)
Definition RagePhotoA.hpp:305
void setBufferOffsets()
Definition RagePhotoA.hpp:294
const char * jpegData() const
Definition RagePhotoA.hpp:169
static size_t saveSize(uint32_t photoFormat, RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser)
Definition RagePhotoA.hpp:266
Error
Definition RagePhotoA.hpp:44
@ UnicodeHeaderError
Definition RagePhotoA.hpp:84
@ IncompleteHeader
Definition RagePhotoA.hpp:56
@ JsonMallocError
Definition RagePhotoA.hpp:73
@ IncorrectDescMarker
Definition RagePhotoA.hpp:67
@ IncompleteTitleOffset
Definition RagePhotoA.hpp:66
@ JsonBufferTight
Definition RagePhotoA.hpp:72
@ IncompletePhotoBuffer
Definition RagePhotoA.hpp:62
@ JsonReadError
Definition RagePhotoA.hpp:74
@ IncompleteJsonOffset
Definition RagePhotoA.hpp:61
@ PhotoMallocError
Definition RagePhotoA.hpp:78
@ PhotoBufferTight
Definition RagePhotoA.hpp:77
@ IncompleteDescBuffer
Definition RagePhotoA.hpp:52
@ IncompleteJendMarker
Definition RagePhotoA.hpp:57
@ IncompleteTitleMarker
Definition RagePhotoA.hpp:65
@ TitleMallocError
Definition RagePhotoA.hpp:81
@ IncompleteEOF
Definition RagePhotoA.hpp:55
@ IncompleteJsonMarker
Definition RagePhotoA.hpp:60
@ IncompleteDescMarker
Definition RagePhotoA.hpp:53
@ IncompleteTitleBuffer
Definition RagePhotoA.hpp:64
@ IncompatibleFormat
Definition RagePhotoA.hpp:50
@ TitleBufferTight
Definition RagePhotoA.hpp:80
@ HeaderMallocError
Definition RagePhotoA.hpp:49
@ PhotoReadError
Definition RagePhotoA.hpp:79
@ DescReadError
Definition RagePhotoA.hpp:47
@ NoFormatIdentifier
Definition RagePhotoA.hpp:76
@ DescBufferTight
Definition RagePhotoA.hpp:45
@ NoError
Definition RagePhotoA.hpp:75
@ IncorrectJendMarker
Definition RagePhotoA.hpp:68
@ UnicodeInitError
Definition RagePhotoA.hpp:83
@ IncompleteJsonBuffer
Definition RagePhotoA.hpp:59
@ HeaderBufferTight
Definition RagePhotoA.hpp:48
@ IncorrectJsonMarker
Definition RagePhotoA.hpp:70
@ IncorrectJpegMarker
Definition RagePhotoA.hpp:69
@ IncompleteJpegMarker
Definition RagePhotoA.hpp:58
@ IncompleteChecksum
Definition RagePhotoA.hpp:51
@ IncorrectTitleMarker
Definition RagePhotoA.hpp:71
@ DescMallocError
Definition RagePhotoA.hpp:46
@ Uninitialised
Definition RagePhotoA.hpp:85
@ IncompletePhotoSize
Definition RagePhotoA.hpp:63
@ IncompleteDescOffset
Definition RagePhotoA.hpp:54
@ TitleReadError
Definition RagePhotoA.hpp:82
bool setData(RagePhotoData *ragePhotoData, bool takeCopy=true)
Definition RagePhotoA.hpp:298
void setFormat(uint32_t photoFormat)
Definition RagePhotoA.hpp:309
const char * description() const
Definition RagePhotoA.hpp:193
static void setBufferOffsets(RagePhotoData *rp_data)
Definition RagePhotoA.hpp:290
static uint64_t jpegSign(RagePhotoData *rp_data)
Definition RagePhotoA.hpp:177
size_t saveSize(uint32_t photoFormat)
Definition RagePhotoA.hpp:274
const char * json() const
Definition RagePhotoA.hpp:197
void addParser(RagePhotoFormatParser *rp_parser)
Definition RagePhotoA.hpp:104
Definition RagePhotoTypedefs.h:31