mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-02 14:16:16 -04:00
Implement automatic JSON API generation
qmake file add jsonapi-generator target to compile JSON API generator qmake files add rs_jsonapi CONFIG option to enable/disable JSON API at compile time RsTypeSerializer pass down same serialization flags when creating new context for nested objects serial job RsGxsChannels expose a few methods through JSON API as example Derive a few GXS types (RsGxsChannelGroup, RsGxsChannelPost, RsGxsFile, RsMsgMetaData) from RsSerializables so they can be used for the JSON API Create RsGenericSerializer::SERIALIZATION_FLAG_YIELDING so JSON objects that miss some fields can be still deserialized, this improve API usability SerializeContext offer friendly constructor with default paramethers Add restbed 4.6 library as git submodule as most systems doesn't have it yet Add a bit of documentation about JSON API into jsonapi-generator/README.adoc Add JsonApiServer class to expose the JSON API via HTTP protocol
This commit is contained in:
parent
2f159efb10
commit
7ad337c8d2
22 changed files with 1205 additions and 83 deletions
|
@ -31,28 +31,39 @@
|
|||
#include <list>
|
||||
|
||||
#include "rsgxsifacetypes.h"
|
||||
#include "serialiser/rsserializable.h"
|
||||
|
||||
class RsGxsFile
|
||||
struct RsGxsFile : RsSerializable
|
||||
{
|
||||
public:
|
||||
RsGxsFile();
|
||||
std::string mName;
|
||||
RsFileHash mHash;
|
||||
uint64_t mSize;
|
||||
//std::string mPath;
|
||||
|
||||
/// @see RsSerializable
|
||||
virtual void serial_process( RsGenericSerializer::SerializeJob j,
|
||||
RsGenericSerializer::SerializeContext& ctx )
|
||||
{
|
||||
RS_SERIAL_PROCESS(mName);
|
||||
RS_SERIAL_PROCESS(mHash);
|
||||
RS_SERIAL_PROCESS(mSize);
|
||||
}
|
||||
};
|
||||
|
||||
class RsGxsImage
|
||||
struct RsGxsImage
|
||||
{
|
||||
public:
|
||||
RsGxsImage();
|
||||
RsGxsImage();
|
||||
~RsGxsImage();
|
||||
RsGxsImage(const RsGxsImage& a); // TEMP use copy constructor and duplicate memory.
|
||||
RsGxsImage &operator=(const RsGxsImage &a); // Need this as well?
|
||||
|
||||
//NB: Must make sure that we always use methods - to be consistent about malloc/free for this data.
|
||||
static uint8_t *allocate(uint32_t size);
|
||||
static void release(void *data);
|
||||
/// Use copy constructor and duplicate memory.
|
||||
RsGxsImage(const RsGxsImage& a);
|
||||
|
||||
RsGxsImage &operator=(const RsGxsImage &a); // Need this as well?
|
||||
|
||||
/** NB: Must make sure that we always use methods - to be consistent about
|
||||
* malloc/free for this data. */
|
||||
static uint8_t *allocate(uint32_t size);
|
||||
static void release(void *data);
|
||||
|
||||
void take(uint8_t *data, uint32_t size); // Copies Pointer.
|
||||
void copy(uint8_t *data, uint32_t size); // Allocates and Copies.
|
||||
|
@ -61,7 +72,6 @@ static void release(void *data);
|
|||
|
||||
uint8_t *mData;
|
||||
uint32_t mSize;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue