SmartFoxServer 2X C++ API
|
#include <SFSArray.h>
Public Member Functions | |
bool | Contains (boost::shared_ptr< void > obj) |
Returns true if the passed object is contained in the Array More... | |
boost::shared_ptr< void > | GetElementAt (long int index) |
Returns the element at the specified index More... | |
boost::shared_ptr< void > | RemoveElementAt (unsigned long int index) |
Remove the element at the specified index More... | |
long int | Size () |
Return the number of elements in the Array More... | |
boost::shared_ptr< ByteArray > | ToBinary () |
Return the binary form of the object More... | |
boost::shared_ptr< string > | GetDump () |
Return a formatted dump of the object that can logged or traced in the console for debugging purposes. More... | |
boost::shared_ptr< string > | GetDump (bool format) |
Return a formatted dump of the object that can logged or traced in the console for debugging purposes. More... | |
boost::shared_ptr< string > | GetHexDump () |
Returns a detailed hex-dump of the object that can logged or traced in the console for debugging purposes. More... | |
void | AddNull () |
Add a null element More... | |
void | AddBool (boost::shared_ptr< bool > val) |
Add a Boolean value More... | |
void | AddBool (bool val) |
Add a Boolean value More... | |
void | AddByte (boost::shared_ptr< unsigned char > val) |
Add a byte value (8 bit) More... | |
void | AddByte (unsigned char val) |
Add a byte value (8 bit) More... | |
void | AddShort (boost::shared_ptr< short int > val) |
Add a short int value (16 bit) More... | |
void | AddShort (short int val) |
Add a short int value (16 bit) More... | |
void | AddInt (boost::shared_ptr< long int > val) |
Add an int value (32 bit) More... | |
void | AddInt (long int val) |
Add an int value (32 bit) More... | |
void | AddLong (boost::shared_ptr< long long > val) |
Add a long int value (64 bit) More... | |
void | AddLong (long long val) |
Add a long int value (64 bit) More... | |
void | AddFloat (boost::shared_ptr< float > val) |
Add a float value (32 bit) More... | |
void | AddFloat (float val) |
Add a float value (32 bit) More... | |
void | AddDouble (boost::shared_ptr< double > val) |
Add a dobule value (64 bit) More... | |
void | AddDouble (double val) |
Add a dobule value (64 bit) More... | |
void | AddUtfString (boost::shared_ptr< string > val) |
Appends a UTF-8 string (with max length of 32 KBytes) value to the end of this array. More... | |
void | AddUtfString (string val) |
Appends a UTF-8 string (with max length of 32 KBytes) value to the end of this array. More... | |
void | AddText (boost::shared_ptr< string > val) |
Appends a UTF-8 string (with max length of 2 GBytes) value to the end of this array. More... | |
void | AddText (string val) |
Appends a UTF-8 string (with max length of 2 GBytes) value to the end of this array. More... | |
void | AddBoolArray (boost::shared_ptr< vector< boost::shared_ptr< bool > > > val) |
Add an array of Booleans More... | |
void | AddByteArray (boost::shared_ptr< ByteArray > val) |
Add an array of bytes More... | |
void | AddShortArray (boost::shared_ptr< vector< boost::shared_ptr< short int > > > val) |
Add an array of short ints More... | |
void | AddIntArray (boost::shared_ptr< vector< boost::shared_ptr< long int > > > val) |
Add an array of ints More... | |
void | AddLongArray (boost::shared_ptr< vector< boost::shared_ptr< long long > > > val) |
Add an array of long ints More... | |
void | AddFloatArray (boost::shared_ptr< vector< boost::shared_ptr< float > > > val) |
Add an array of floats More... | |
void | AddDoubleArray (boost::shared_ptr< vector< boost::shared_ptr< double > > > val) |
Add an array of doubles More... | |
void | AddUtfStringArray (boost::shared_ptr< vector< boost::shared_ptr< string > > > val) |
Add an array of UTF-8 String More... | |
void | AddSFSArray (boost::shared_ptr< ISFSArray > val) |
Add an SFSArray More... | |
void | AddSFSObject (boost::shared_ptr< ISFSObject > val) |
Add an SFSObject More... | |
void | AddClass (boost::shared_ptr< void > val) |
Add an instance of a custom Class. More... | |
bool | IsNull (unsigned long int index) |
Checks if a certain element in the Array is null More... | |
bool | GetBool (unsigned long int index) |
Get a Boolean element at the provided index More... | |
unsigned char | GetByte (unsigned long int index) |
Get a byte element at the provided index More... | |
short int | GetShort (unsigned long int index) |
Get a short int element at the provided index More... | |
long int | GetInt (unsigned long int index) |
Get an int element at the provided index More... | |
long long | GetLong (unsigned long int index) |
Get a long int element at the provided index More... | |
float | GetFloat (unsigned long int index) |
Get a float element at the provided index More... | |
double | GetDouble (unsigned long int index) |
Get a double element at the provided index More... | |
boost::shared_ptr< string > | GetUtfString (unsigned long int index) |
Returns the element at the specified position as an UTF-8 string, with max length of 32 KBytes. More... | |
boost::shared_ptr< string > | GetText (unsigned long int index) |
Returns the element at the specified position as an UTF-8 string, with max length of 2 GBytes. More... | |
boost::shared_ptr< vector< bool > > | GetBoolArray (unsigned long int index) |
Get a Boolean Array element at the provided index More... | |
boost::shared_ptr< ByteArray > | GetByteArray (unsigned long int index) |
Get a byte Array element at the provided index More... | |
boost::shared_ptr< vector< short int > > | GetShortArray (unsigned long int index) |
Get a short Array element at the provided index More... | |
boost::shared_ptr< vector< long int > > | GetIntArray (unsigned long int index) |
Get a int Array element at the provided index More... | |
boost::shared_ptr< vector< long long > > | GetLongArray (unsigned long int index) |
Get a lomg Array element at the provided index More... | |
boost::shared_ptr< vector< float > > | GetFloatArray (unsigned long int index) |
Get a float Array element at the provided index More... | |
boost::shared_ptr< vector< double > > | GetDoubleArray (unsigned long int index) |
Get a double Array element at the provided index More... | |
boost::shared_ptr< vector< string > > | GetUtfStringArray (unsigned long int index) |
Get a String Array element at the provided index More... | |
boost::shared_ptr< ISFSArray > | GetSFSArray (unsigned long int index) |
Get an SFSArray element at the provided index More... | |
boost::shared_ptr< void > | GetClass (unsigned long int index) |
Get a class instance at the provided index. More... | |
boost::shared_ptr< ISFSObject > | GetSFSObject (unsigned long int index) |
Get an SFSObject element at the provided index More... | |
Static Public Member Functions | |
static boost::shared_ptr< SFSArray > | NewFromArray (vector< boost::shared_ptr< SFSDataWrapper > > o) |
Alternative static constructor that builds an SFSArray populated with the data found in the passed Array More... | |
static boost::shared_ptr< SFSArray > | NewFromBinaryData (boost::shared_ptr< ByteArray > ba) |
Alternative static constructor that builds an SFSArray from a valid SFSArray binary representation More... | |
static boost::shared_ptr< SFSArray > | NewInstance () |
Alternative static constructor More... | |
SFSArray is used from server and client side to exchange data. It can be thought of a specialized Array/List object that can contain any type of data. The advantage of using SFSArray is that you can fine tune the way your data will be transmitted over the network. For instance, a number like 100 can be transmitted as a normal integer (which takes 32 bits) but also a short (16 bit) or even a byte (8 bit)
SFSArray supports many primitive data types and related arrays of primitives. It also allows to serialize class instances and rebuild them on the Java side. This is explained in greater detail in a separate document.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Add a byte value (8 bit)
val | An unsigned char |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Add a byte value (8 bit)
val | An unsigned char |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Add an array of bytes
val | Pointer to a ByteArray instance |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Add an instance of a custom Class.
This is an advanced feature that allows to transmit object instances between Actionscript and Java provided that both classes are definined under the same package name.
This is an example of the same class on the server and client side:
Server Java code:
Client AS3 code:
A SpaceShip instance from server side is sent to the client. This is how you get it:
val | A void pointer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
|
virtual |
Add a null element
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Add an SFSArray
val | Pointer to a ISFSArray instance |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Add an SFSObject
val | Pointer to a ISFSObject instance |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Add a short int value (16 bit)
val | A short integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Add a short int value (16 bit)
val | A short integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
|
virtual |
Appends a UTF-8 string (with max length of 2 GBytes) value to the end of this array.
val | The value to be appended to this array. |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Appends a UTF-8 string (with max length of 2 GBytes) value to the end of this array.
val | The value to be appended to this array. |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Appends a UTF-8 string (with max length of 32 KBytes) value to the end of this array.
val | A string pointer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Appends a UTF-8 string (with max length of 32 KBytes) value to the end of this array.
val | A string pointer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
|
virtual |
Returns true if the passed object is contained in the Array
obj | A void pointer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Get a Boolean element at the provided index
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Get a Boolean Array element at the provided index
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Get a byte element at the provided index
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Get a byte Array element at the provided index
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Get a class instance at the provided index.
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Get a double element at the provided index
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Get a double Array element at the provided index
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Return a formatted dump of the object that can logged or traced in the console for debugging purposes.
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Return a formatted dump of the object that can logged or traced in the console for debugging purposes.
format | turns the "pretty print" on/off |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Returns the element at the specified index
index | A long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Get a float element at the provided index
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Get a float Array element at the provided index
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Returns a detailed hex-dump of the object that can logged or traced in the console for debugging purposes.
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Get an int element at the provided index
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Get a int Array element at the provided index
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Get a long int element at the provided index
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Get a lomg Array element at the provided index
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Get an SFSArray element at the provided index
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Get an SFSObject element at the provided index
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Get a short int element at the provided index
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Get a short Array element at the provided index
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Returns the element at the specified position as an UTF-8 string, with max length of 2 GBytes.
index | The position of the element to return. |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Returns the element at the specified position as an UTF-8 string, with max length of 32 KBytes.
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Get a String Array element at the provided index
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Checks if a certain element in the Array is null
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
static |
Alternative static constructor that builds an SFSArray populated with the data found in the passed Array
o | A vector of SFSDataWrapper pointers |
|
static |
|
static |
Alternative static constructor
|
virtual |
Remove the element at the specified index
index | An unsigned long integer |
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Return the number of elements in the Array
Implements Sfs2X::Entities::Data::ISFSArray.
|
virtual |
Return the binary form of the object
Implements Sfs2X::Entities::Data::ISFSArray.