libragephoto: improve documentation
This commit is contained in:
parent
0fa69667d0
commit
bc9065e8dc
9 changed files with 234 additions and 109 deletions
|
@ -16,6 +16,10 @@
|
|||
* responsible for anything with use of the software, you are self responsible.
|
||||
*****************************************************************************/
|
||||
|
||||
/** RagePhoto C API header file
|
||||
* \file RagePhoto.h
|
||||
*/
|
||||
|
||||
#ifndef RAGEPHOTO_H
|
||||
#define RAGEPHOTO_H
|
||||
|
||||
|
@ -28,33 +32,37 @@
|
|||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
/** C API for RagePhoto.
|
||||
* \file RagePhoto.h
|
||||
/** RagePhoto typedef for C instance/C++ object.
|
||||
* \memberof RagePhotoInstance
|
||||
*/
|
||||
|
||||
/** RagePhoto C instance/C++ class typedef. */
|
||||
typedef void* ragephoto_t;
|
||||
|
||||
/** Opens a \p ragephoto_t instance. */
|
||||
/** Opens a \p ragephoto_t instance.
|
||||
* \memberof RagePhotoInstance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC ragephoto_t ragephoto_open();
|
||||
|
||||
/** Add a custom defined RagePhotoFormatParser.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
* \param rp_parser RagePhotoFormatParser parser to add
|
||||
* \param rp_parser Parser to add
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC void ragephoto_addparser(ragephoto_t instance, RagePhotoFormatParser *rp_parser);
|
||||
|
||||
/** Resets the RagePhotoData object to default values.
|
||||
/** Resets the Data object to default values.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC void ragephoto_clear(ragephoto_t instance);
|
||||
|
||||
/** Resets the RagePhotoData object to default values.
|
||||
* \param rp_data RagePhotoData object
|
||||
/** Resets the Data object to default values.
|
||||
* \memberof RagePhotoData
|
||||
* \param rp_data Data object
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC void ragephotodata_clear(RagePhotoData *rp_data);
|
||||
|
||||
/** Loads a Photo from a const char*.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
* \param data Photo data
|
||||
* \param size Photo data size
|
||||
|
@ -62,78 +70,98 @@ LIBRAGEPHOTO_C_PUBLIC void ragephotodata_clear(RagePhotoData *rp_data);
|
|||
LIBRAGEPHOTO_C_PUBLIC bool ragephoto_load(ragephoto_t instance, const char *data, size_t size);
|
||||
|
||||
/** Loads a Photo from a const char*.
|
||||
* \param rp_data RagePhotoData object
|
||||
* \param rp_parser RagePhotoFormatParser parser array
|
||||
* \memberof RagePhotoData
|
||||
* \param rp_data Data object
|
||||
* \param rp_parser Parser array
|
||||
* \param data Photo data
|
||||
* \param size Photo data size
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC bool ragephotodata_load(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser, const char *data, size_t size);
|
||||
|
||||
/** Loads a Photo from a file.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
* \param filename File to load
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC bool ragephoto_loadfile(ragephoto_t instance, const char *filename);
|
||||
|
||||
/** Returns the last error occurred.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC int32_t ragephoto_error(ragephoto_t instance);
|
||||
|
||||
/** Returns the GTA V default Photo Buffer Size. */
|
||||
/** Returns the GTA V default Photo Buffer Size.
|
||||
* \relates RagePhotoInstance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC uint32_t ragephoto_defpbuf_gta5();
|
||||
|
||||
/** Returns the RDR 2 default Photo Buffer Size. */
|
||||
/** Returns the RDR 2 default Photo Buffer Size.
|
||||
* \relates RagePhotoInstance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC uint32_t ragephoto_defpbuf_rdr2();
|
||||
|
||||
/** Returns the GTA V Photo Format. */
|
||||
/** Returns the GTA V Photo Format.
|
||||
* \relates RagePhotoInstance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC uint32_t ragephoto_format_gta5();
|
||||
|
||||
/** Returns the RDR 2 Photo Format. */
|
||||
/** Returns the RDR 2 Photo Format.
|
||||
* \relates RagePhotoInstance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC uint32_t ragephoto_format_rdr2();
|
||||
|
||||
/** Returns the internal RagePhotoData object.
|
||||
/** Returns the internal Data object.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC RagePhotoData* ragephoto_getphotodata(ragephoto_t instance);
|
||||
|
||||
/** Returns the Photo description.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC const char* ragephoto_getphotodesc(ragephoto_t instance);
|
||||
|
||||
/** Returns the Photo Format (GTA V or RDR 2).
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC uint32_t ragephoto_getphotoformat(ragephoto_t instance);
|
||||
|
||||
/** Returns the Photo JPEG data.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC const char* ragephoto_getphotojpeg(ragephoto_t instance);
|
||||
|
||||
/** Returns the Photo JSON data.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC const char* ragephoto_getphotojson(ragephoto_t instance);
|
||||
|
||||
/** Returns the Photo header.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC const char* ragephoto_getphotoheader(ragephoto_t instance);
|
||||
|
||||
/** Returns the Photo JPEG sign.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC uint64_t ragephoto_getphotosign(ragephoto_t instance);
|
||||
|
||||
/** Returns the Photo JPEG sign.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
* \param photoFormat Photo Format (GTA V or RDR 2)
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC uint64_t ragephoto_getphotosignf(ragephoto_t instance, uint32_t photoFormat);
|
||||
|
||||
/** Returns the Photo JPEG sign as string.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
* \param data String data
|
||||
* \param size String size
|
||||
|
@ -141,6 +169,7 @@ LIBRAGEPHOTO_C_PUBLIC uint64_t ragephoto_getphotosignf(ragephoto_t instance, uin
|
|||
LIBRAGEPHOTO_C_PUBLIC void ragephoto_getphotosigns(ragephoto_t instance, char *data, size_t size);
|
||||
|
||||
/** Returns the Photo JPEG sign as string.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
* \param data String data
|
||||
* \param size String size
|
||||
|
@ -149,64 +178,75 @@ LIBRAGEPHOTO_C_PUBLIC void ragephoto_getphotosigns(ragephoto_t instance, char *d
|
|||
LIBRAGEPHOTO_C_PUBLIC void ragephoto_getphotosignsf(ragephoto_t instance, char *data, size_t size, uint32_t photoFormat);
|
||||
|
||||
/** Returns the Photo JPEG sign.
|
||||
* \param rp_data RagePhotoData object
|
||||
* \memberof RagePhotoData
|
||||
* \param rp_data Data object
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC uint64_t ragephotodata_getphotosign(RagePhotoData *rp_data);
|
||||
|
||||
/** Returns the Photo JPEG sign.
|
||||
* \param rp_data RagePhotoData object
|
||||
* \memberof RagePhotoData
|
||||
* \param rp_data Data object
|
||||
* \param photoFormat Photo Format (GTA V or RDR 2)
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC uint64_t ragephotodata_getphotosignf(RagePhotoData *rp_data, uint32_t photoFormat);
|
||||
|
||||
/** Returns the Photo JPEG data size.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC uint32_t ragephoto_getphotosize(ragephoto_t instance);
|
||||
|
||||
/** Returns the Photo title.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC const char* ragephoto_getphototitle(ragephoto_t instance);
|
||||
|
||||
/** Returns the Photo save file size.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC size_t ragephoto_getsavesize(ragephoto_t instance);
|
||||
|
||||
/** Returns the Photo save file size.
|
||||
* \param rp_data RagePhotoData object
|
||||
* \param rp_parser RagePhotoFormatParser parser array
|
||||
* \memberof RagePhotoData
|
||||
* \param rp_data Data object
|
||||
* \param rp_parser Parser array
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC size_t ragephotodata_getsavesize(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser);
|
||||
|
||||
/** Returns the Photo save file size.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
* \param photoFormat Photo Format (GTA V or RDR 2)
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC size_t ragephoto_getsavesizef(ragephoto_t instance, uint32_t photoFormat);
|
||||
|
||||
/** Returns the Photo save file size.
|
||||
* \param rp_data RagePhotoData object
|
||||
* \param rp_parser RagePhotoFormatParser parser array
|
||||
* \memberof RagePhotoData
|
||||
* \param rp_data Data object
|
||||
* \param rp_parser Parser array
|
||||
* \param photoFormat Photo Format (GTA V or RDR 2)
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC size_t ragephotodata_getsavesizef(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser, uint32_t photoFormat);
|
||||
|
||||
/** Saves a Photo to a char*.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
* \param data Photo data
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC bool ragephoto_save(ragephoto_t instance, char *data);
|
||||
|
||||
/** Saves a Photo to a char*.
|
||||
* \param rp_data RagePhotoData object
|
||||
* \param rp_parser RagePhotoFormatParser parser array
|
||||
* \memberof RagePhotoData
|
||||
* \param rp_data Data object
|
||||
* \param rp_parser Parser array
|
||||
* \param data Photo data
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC bool ragephotodata_save(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser, char *data);
|
||||
|
||||
/** Saves a Photo to a char*.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
* \param data Photo data
|
||||
* \param photoFormat Photo Format (GTA V or RDR 2)
|
||||
|
@ -214,20 +254,23 @@ LIBRAGEPHOTO_C_PUBLIC bool ragephotodata_save(RagePhotoData *rp_data, RagePhotoF
|
|||
LIBRAGEPHOTO_C_PUBLIC bool ragephoto_savef(ragephoto_t instance, char *data, uint32_t photoFormat);
|
||||
|
||||
/** Saves a Photo to a char*.
|
||||
* \param rp_data RagePhotoData object
|
||||
* \param rp_parser RagePhotoFormatParser parser array
|
||||
* \memberof RagePhotoData
|
||||
* \param rp_data Data object
|
||||
* \param rp_parser Parser array
|
||||
* \param data Photo data
|
||||
* \param photoFormat Photo Format (GTA V or RDR 2)
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC bool ragephotodata_savef(RagePhotoData *rp_data, RagePhotoFormatParser *rp_parser, char *data, uint32_t photoFormat);
|
||||
|
||||
/** Saves a Photo to a file.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
* \param filename File to save
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC bool ragephoto_savefile(ragephoto_t instance, const char *filename);
|
||||
|
||||
/** Saves a Photo to a file.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
* \param filename File to save
|
||||
* \param photoFormat Photo Format (GTA V or RDR 2)
|
||||
|
@ -235,38 +278,45 @@ LIBRAGEPHOTO_C_PUBLIC bool ragephoto_savefile(ragephoto_t instance, const char *
|
|||
LIBRAGEPHOTO_C_PUBLIC bool ragephoto_savefilef(ragephoto_t instance, const char *filename, uint32_t photoFormat);
|
||||
|
||||
/** Sets all cross-format Buffer to default size.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC void ragephoto_setbufferdefault(ragephoto_t instance);
|
||||
|
||||
/** Sets all cross-format Buffer to default size.
|
||||
* \param rp_data RagePhotoData object
|
||||
* \memberof RagePhotoData
|
||||
* \param rp_data Data object
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC void ragephotodata_setbufferdefault(RagePhotoData *rp_data);
|
||||
|
||||
/** Moves all Buffer offsets to correct position.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC void ragephoto_setbufferoffsets(ragephoto_t instance);
|
||||
|
||||
/** Moves all Buffer offsets to correct position.
|
||||
* \param rp_data RagePhotoData object
|
||||
* \memberof RagePhotoData
|
||||
* \param rp_data Data object
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC void ragephotodata_setbufferoffsets(RagePhotoData *rp_data);
|
||||
|
||||
/** Sets the internal RagePhotoData object.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
* \param rp_data RagePhotoData object being set
|
||||
* \param rp_data Data object used to replace
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC bool ragephoto_setphotodata(ragephoto_t instance, RagePhotoData *rp_data);
|
||||
|
||||
/** Copies RagePhotoData object to internal RagePhotoData object.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
* \param rp_data RagePhotoData object being copied
|
||||
* \param rp_data Data object used to copy
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC bool ragephoto_setphotodatac(ragephoto_t instance, RagePhotoData *rp_data);
|
||||
|
||||
/** Sets the Photo description.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
* \param description Description
|
||||
* \param bufferSize Description buffer size
|
||||
|
@ -276,12 +326,14 @@ LIBRAGEPHOTO_C_PUBLIC bool ragephoto_setphotodatac(ragephoto_t instance, RagePho
|
|||
LIBRAGEPHOTO_C_PUBLIC void ragephoto_setphotodesc(ragephoto_t instance, const char *description, uint32_t bufferSize);
|
||||
|
||||
/** Sets the Photo Format (GTA V or RDR 2).
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
* \param photoFormat Photo Format (GTA V or RDR 2)
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC void ragephoto_setphotoformat(ragephoto_t instance, uint32_t photoFormat);
|
||||
|
||||
/** Sets the Photo JPEG data.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
* \param data JPEG data
|
||||
* \param size JPEG data size
|
||||
|
@ -292,6 +344,7 @@ LIBRAGEPHOTO_C_PUBLIC void ragephoto_setphotoformat(ragephoto_t instance, uint32
|
|||
LIBRAGEPHOTO_C_PUBLIC bool ragephoto_setphotojpeg(ragephoto_t instance, const char *data, uint32_t size, uint32_t bufferSize);
|
||||
|
||||
/** Sets the Photo JSON data.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
* \param json JSON data
|
||||
* \param bufferSize JSON data buffer size
|
||||
|
@ -300,13 +353,18 @@ LIBRAGEPHOTO_C_PUBLIC bool ragephoto_setphotojpeg(ragephoto_t instance, const ch
|
|||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC void ragephoto_setphotojson(ragephoto_t instance, const char *json, uint32_t bufferSize);
|
||||
|
||||
/** Sets the Photo header. */
|
||||
/** Sets the Photo header.
|
||||
* \memberof RagePhotoInstance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC void ragephoto_setphotoheader(ragephoto_t instance, const char *header, uint32_t headerSum);
|
||||
|
||||
/** Sets the Photo header. (RDR 2) */
|
||||
/** Sets the Photo header. (RDR 2)
|
||||
* \memberof RagePhotoInstance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC void ragephoto_setphotoheader2(ragephoto_t instance, const char *header, uint32_t headerSum, uint32_t headerSum2);
|
||||
|
||||
/** Sets the Photo title.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
* \param title Title
|
||||
* \param bufferSize Title buffer size
|
||||
|
@ -316,11 +374,14 @@ LIBRAGEPHOTO_C_PUBLIC void ragephoto_setphotoheader2(ragephoto_t instance, const
|
|||
LIBRAGEPHOTO_C_PUBLIC void ragephoto_setphototitle(ragephoto_t instance, const char *title, uint32_t bufferSize);
|
||||
|
||||
/** Closes a \p ragephoto_t instance.
|
||||
* \memberof RagePhotoInstance
|
||||
* \param instance \p ragephoto_t instance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC void ragephoto_close(ragephoto_t instance);
|
||||
|
||||
/** Returns the library version. */
|
||||
/** Returns the library version.
|
||||
* \relates RagePhotoInstance
|
||||
*/
|
||||
LIBRAGEPHOTO_C_PUBLIC const char* ragephoto_version();
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
* libragephoto RAGE Photo Parser
|
||||
* Copyright (C) 2021-2023 Syping
|
||||
* Copyright (C) 2021-2024 Syping
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification,
|
||||
* are permitted provided that the following conditions are met:
|
||||
|
@ -70,10 +70,12 @@ typedef struct RagePhotoFormatParser {
|
|||
ragephoto_saveszfunc_t funcSaveSz; /**< Pointer to saveSize function */
|
||||
} RagePhotoFormatParser;
|
||||
|
||||
/** RagePhoto instance struct for storing data and format parser pointer. */
|
||||
/** RagePhoto instance struct for storing data and format parser pointer.
|
||||
* \struct RagePhotoInstance RagePhoto.h
|
||||
*/
|
||||
typedef struct RagePhotoInstance {
|
||||
RagePhotoData *data; /**< Pointer for data */
|
||||
RagePhotoFormatParser *parser; /**< Pointer for format parser */
|
||||
RagePhotoData *data; /**< Pointer for internal data */
|
||||
RagePhotoFormatParser *parser; /**< Pointer for internal format parser */
|
||||
} RagePhotoInstance;
|
||||
|
||||
/* RagePhoto default sizes */
|
||||
|
|
|
@ -28,6 +28,7 @@ namespace ragephoto_c {
|
|||
|
||||
/**
|
||||
* \brief GTA V and RDR 2 Photo Parser (C API wrapper).
|
||||
* \class ragephoto_c::photo RagePhoto.hpp RagePhoto
|
||||
*/
|
||||
class photo
|
||||
{
|
||||
|
|
|
@ -31,6 +31,7 @@ namespace ragephoto {
|
|||
|
||||
/**
|
||||
* \brief GTA V and RDR 2 Photo Parser.
|
||||
* \class ragephoto::photo RagePhoto.hpp RagePhoto
|
||||
*/
|
||||
class LIBRAGEPHOTO_CXX_PUBLIC photo
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue