![]() |
CloudBuilder C++ SDK
v3.0.0
Making social games is easy !
|
#include <CClan.h>
Public Member Functions | |
virtual | ~CClan () |
bool | isSetup () |
bool | isUserLogged () |
void | Setup (const CHJSON *aConfiguration, CResultHandler *handler) |
void | Suspend () |
void | Resume () |
void | Terminate () |
void | Ping (CResultHandler *handler) |
void | HandleURL (const CHJSON *aOptions, CResultHandler *handler) |
void | ProcessIdleTasks () |
void | SetHttpFailureCallback (CDelegate< void(CHttpFailureEventArgs &)> *aCallback) |
void | SetLogLevel (LOG_LEVEL logLevel) |
Static Public Member Functions | |
static CClan * | Instance () |
The CloudBuilder::CClan class is the most important class. This is your primary entry point in the CloudBuilder SDK. All the setup is done in this class.
|
virtual |
Destructor
void CloudBuilder::CClan::HandleURL | ( | const CHJSON * | aOptions, |
CResultHandler * | handler | ||
) |
Method to handle launch app with url: used to connect with facebook and google Also used , in case the url match with "://cotc/", for sponsorship and anonymous login on a new device.
aOptions | is a json containing field "url" with the url. On iOS, for GooglePlus, a field "source" must contains sourceApplication as defined in the method:
|
handler | result handler whenever the call finishes (it might also be synchronous) |
|
static |
Function which returns the only instance of this class.
bool CloudBuilder::CClan::isSetup | ( | ) |
Method to be called in order to know if the CloudBuilder SDK has been correctly setup or not.
bool CloudBuilder::CClan::isUserLogged | ( | ) |
Method to be called in order to know if the user is logged in or not.
void CloudBuilder::CClan::Ping | ( | CResultHandler * | handler | ) |
Method to ping the server For now it returns the server time in utc
key.
void CloudBuilder::CClan::ProcessIdleTasks | ( | ) |
Call this in your main loop when you are in an idle state. Allows to process some events and callbacks pending and run them in your main thread.
void CloudBuilder::CClan::Resume | ( | ) |
Method you must call when your application is going to the foreground, so we can ensure data integrity when the application is getting the focus again.
void CloudBuilder::CClan::SetHttpFailureCallback | ( | CDelegate< void(CHttpFailureEventArgs &)> * | aCallback | ) |
When called once from your app, this function disables the default behavior of the HTTP layer (unless called back with a null parameter). That is, no more retry by default, no more "offline mode" with requests put in a pending state.
In this "mode", requests are still executed serially (meaning that any request – API call – that was issued later on is only executed after success or failure of the previous). However, in case of failure, the request is not re-attempted automatically, instead the callback is called. From this callback, you can decide to either retry the request later, or abort it. Aborting it has the effect of allowing the next request to proceed.
There is an exception with the domain event loop which is run once logged in. The behaviour of this loop cannot be altered, the callback is not called and the request will be retried anyway.
Also note that the callback is only invoked upon retriable error (network related). If the server returns a non-recoverable error code or there is an error with an argument, the API call will fail immediately.
aCallback | the callback to be called whenever a request fails. Unlike all other uses of the delegates, this one can be called multiple times. Memory is managed by the library, that is the callback is freed when not in use anymore (additional call to this method or Terminate). |
void CloudBuilder::CClan::SetLogLevel | ( | LOG_LEVEL | logLevel | ) |
Sets the logging level to be used for future calls. Note that this doesn't apply to all calls, some other calls related to native plugins may need their own setup in order to show a verbose output.
logLevel | logging level, DEBUG_LEVEL_WARNING by default. |
void CloudBuilder::CClan::Setup | ( | const CHJSON * | aConfiguration, |
CResultHandler * | handler | ||
) |
This method is the first to call just after the constructor. This will prepare everything so you can make requests later.
aConfiguration | is a JSON object holding the necessary connection details. The mandatory keys are:
|
The optional keys are:
USERPROFILE%\AppData\Roaming\<appFolder>\
.handler | result handler whenever the call finishes (it might also be synchronous) |
void CloudBuilder::CClan::Suspend | ( | ) |
Method you must call when your application is going to the background, so we can ensure data integrity when the application is not active.
void CloudBuilder::CClan::Terminate | ( | ) |
Method to call before quitting the application, so the CloudBuilder can leave in a clean state. Warning: invalidates all pointers to objects returned by CloudBuilder as memory is freed, including those returned by Instance().