File size: 2,116 Bytes
24b81cb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
/** @file */
// -------------------------------------------------------------------------
// error codes for handle processing
// defined in C++
enum EJsonApiError
{
ETJSON_UNKNOWN, // invalid code
ETJSON_OK, // all fine
ETJSON_COMMSEND, // error during send
ETJSON_COMMRECV, // error during receive
ETJSON_PARSERERROR, // error during parsing
ETJSON_PACKNOSTART, // error - cannot start packing (invalid state)
ETJSON_TIMEOUT, // failed to send/ store handle due to timeout
ETJSON_NOBUFFERS, // not enough buffers available
ETJSON_FAILFILELOAD, // failed to load file
ETJSON_FAILFILESAVE, // failed to save file
ETJSON_NOTARRAY, // object is not array (ie. attempt to provide different or none object as array)
};
// -------------------------------------------------------------------------
// JsonApi Handle is container encapsulating real JSON data being sent or recieved via. RESTful/ other service
class JsonApiHandle
{
private void JsonApiHandle() {}
private void ~JsonApiHandle() {}
/**
\brief Length of JSON
*/
proto native int Size();
/**
\brief Return as string
*/
proto native owned string AsString();
/**
\brief Invalidate handle and schedule removal
*/
proto native void Invalidate();
};
// -------------------------------------------------------------------------
// parent class for handling JsonApi Struct objects
//
//
class JsonApi
{
private void JsonApi() {}
private void ~JsonApi() {}
/**
\brief Override number of concurrent buffers used (depending project requirements, DEFAULT = 16, MIN = 4)
*/
proto native void SetBuffers( int iBufferCount );
/**
\brief Actual number of total buffers active + free
*/
proto native int BufferCount();
/**
\brief Maximum number of buffers used at once!
*/
proto native int BufferMax();
/**
\brief List of all currently active handles
*/
proto native void DebugList();
};
// -------------------------------------------------------------------------
// JsonApi access methods
proto native JsonApi CreateJsonApi();
proto native void DestroyJsonApi();
proto native JsonApi GetJsonApi();
|