#include <ArClientArgUtils.h>
ArClientArg defines methods for packing/unpacking an ArConfigArg into/from an ArNetPacket. (The name of the class is a slight misnomer since it may be used both on the server and client sides.)
The structure of the network packet information is as follows:
string: arg.getName()
string: arg.getDescription()
byte: arg.getConfigPriority()
byte: arg type ('B' == BOOL | 'I' == INT | 'D' == DOUBLE | 'S' == STRING)
<arg values>
string: arg.getDisplayHint() -- only if isDisplayHintParsed is set to true
<arg values> varies by arg type:
if BOOL, then:
byte: arg.getBool()
if INT, then:
byte4: arg.getInt()
byte4: arg.getMinInt()
byte4: arg.getMaxInt()
if DOUBLE, then:
byte4: arg.getDouble()
byte4: arg.getMinDouble()
byte4: arg.getMaxDouble()
if STRING, then:
string: arg.getString()
ArClientArg also defines methods to send an "abbreviated" ArConfigArg (i.e. just value). The short packet structure is as follows:
<arg value> varies by arg type:
if BOOL, then:
byte: arg.getBool()
if INT, then:
byte4: arg.getInt()
if DOUBLE, then:
byte4: arg.getDouble()
if STRING, then:
string: arg.getString()
Lastly, it defines a method to send an "abbreviated" ArConfigArg in a text format.
Public Member Functions | |
| ArClientArg (bool isDisplayHintParsed=false, ArPriority::Priority lastPriority=ArPriority::LAST_PRIORITY) | |
| Constructor. | |
| virtual bool | argTextToBuf (const ArConfigArg &arg, ArNetPacket *packet) |
| Stores the arg value into the network packet as a text string. | |
| virtual bool | argValueToBuf (const ArConfigArg &arg, ArNetPacket *packet) |
| Stores the abbreviated arg value into the network packet. | |
| virtual bool | bufToArgValue (ArNetPacket *packet, ArConfigArg &arg) |
| Unpacks the abbreviated arg value and stores the data in the config arg. | |
| virtual bool | createArg (ArNetPacket *packet, ArConfigArg &argOut) |
| Unpacks the given network packet and stores the data in the config arg. | |
| virtual bool | createPacket (const ArConfigArg &arg, ArNetPacket *packet) |
| Stores the given config arg into the network packet. | |
| virtual bool | isSendableParamType (const ArConfigArg &arg) |
| Returns whether the given parameter can be sent in a network packet. | |
| virtual | ~ArClientArg () |
| Destructor. | |
Protected Types | |
| enum | { BUFFER_LENGTH = 1024 } |
Protected Attributes | |
| char | myBuffer [BUFFER_LENGTH] |
| char | myDisplayBuffer [BUFFER_LENGTH] |
| bool | myIsDisplayHintParsed |
| ArPriority::Priority | myLastPriority |
| virtual bool ArClientArg::argTextToBuf | ( | const ArConfigArg & | arg, | |
| ArNetPacket * | packet | |||
| ) | [virtual] |
Stores the arg value into the network packet as a text string.
The stored text string is suitable for parsing by an ArArgumentBuilder.
| arg | the ArConfigArg from which to retrieve the data | |
| packet | the ArNetPacket * to which data is added |
| virtual bool ArClientArg::argValueToBuf | ( | const ArConfigArg & | arg, | |
| ArNetPacket * | packet | |||
| ) | [virtual] |
Stores the abbreviated arg value into the network packet.
| arg | the ArConfigArg from which to retrieve the data | |
| packet | the ArNetPacket * to which data is added |
| virtual bool ArClientArg::bufToArgValue | ( | ArNetPacket * | packet, | |
| ArConfigArg & | arg | |||
| ) | [virtual] |
Unpacks the abbreviated arg value and stores the data in the config arg.
| packet | the ArNetPacket * from which data is extracted | |
| arg | the ArConfigArg in which to set the value |
| virtual bool ArClientArg::createArg | ( | ArNetPacket * | packet, | |
| ArConfigArg & | argOut | |||
| ) | [virtual] |
Unpacks the given network packet and stores the data in the config arg.
| packet | the ArNetPacket * from which data is extracted | |
| argOut | the ArConfigArg in which to set the data |
| virtual bool ArClientArg::createPacket | ( | const ArConfigArg & | arg, | |
| ArNetPacket * | packet | |||
| ) | [virtual] |
Stores the given config arg into the network packet.
| arg | the ArConfigArg from which to retrieve the data | |
| packet | the ArNetPacket * to which data is added |
| virtual bool ArClientArg::isSendableParamType | ( | const ArConfigArg & | arg | ) | [virtual] |
Returns whether the given parameter can be sent in a network packet.
Currently, a parameter can only be sent if it is of type INT, DOUBLE, STRING, BOOL, or a SEPARATOR.
1.5.1