MistServer  2.5.3-Pro-19-gf5e75b1 ( Generic_64)
Public Member Functions | Protected Attributes
AMF::Object Class Reference

Recursive class that holds AMF0 objects. More...

#include <amf.h>

Public Member Functions

 Object ()
 Default constructor. More...
 
 Object ()
 
 Object (std::string indice, double val, obj0type setType=AMF0_NUMBER)
 Constructor for numeric objects. More...
 
 Object (std::string indice, double val, obj0type setType=AMF0_NUMBER)
 
 Object (std::string indice, std::string val, obj0type setType=AMF0_STRING)
 Constructor for string objects. More...
 
 Object (std::string indice, std::string val, obj0type setType=AMF0_STRING)
 
 Object (std::string indice, obj0type setType=AMF0_OBJECT)
 
 Object (std::string indice, obj0type setType=AMF0_OBJECT)
 Constructor for container objects. More...
 
void addContent (AMF::Object c)
 Adds an AMF::Object to this object. Works for all types, but only makes sense for container types. More...
 
void addContent (AMF::Object c)
 
Object getContent (unsigned int i)
 Returns a copy of the object held at indice i. More...
 
Object getContent (unsigned int i)
 
Object getContent (std::string s)
 Returns a copy of the object held at indice s. More...
 
Object getContent (std::string s)
 
ObjectgetContentP (unsigned int i)
 Returns a pointer to the object held at indice i. More...
 
ObjectgetContentP (unsigned int i)
 
ObjectgetContentP (std::string s)
 Returns a pointer to the object held at indice s. More...
 
ObjectgetContentP (std::string s)
 
obj0type GetType ()
 
obj0type GetType ()
 Returns the AMF::obj0type AMF0 object type for this object. More...
 
int hasContent ()
 
int hasContent ()
 Returns a count of the amount of objects this object currently holds. More...
 
std::string Indice ()
 Returns the std::string Indice for the current object, if available. More...
 
std::string Indice ()
 
double NumValue ()
 
double NumValue ()
 Returns the numeric value of this object, if available. More...
 
std::string Pack ()
 Packs the AMF object to a std::string for transfer over the network. More...
 
std::string Pack ()
 
std::string Print (std::string indent="")
 Return the contents as a human-readable string. More...
 
std::string Print (std::string indent="")
 
const char * Str ()
 
const char * Str ()
 Returns the C-string value of this object, if available. More...
 
std::string StrValue ()
 Returns the std::string value of this object, if available. More...
 
std::string StrValue ()
 

Protected Attributes

std::vector< Objectcontents
 Holds this objects contents, if any (for container types). More...
 
std::string myIndice
 Holds this objects indice, if any. More...
 
obj0type myType
 Holds this objects AMF0 type. More...
 
double numval
 Holds this objects numeric value, if any. More...
 
std::string strval
 Holds this objects string value, if any. More...
 

Detailed Description

Recursive class that holds AMF0 objects.

It supports all AMF0 types (defined in AMF::obj0type), adding support for a special DDVTECH container type.

Constructor & Destructor Documentation

AMF::Object::Object ( )

Default constructor.

Simply fills the data with AMF::Object("error", AMF0_DDV_CONTAINER)

AMF::Object::Object ( std::string  indice,
double  val,
AMF::obj0type  setType = AMF0_NUMBER 
)

Constructor for numeric objects.

The object type is by default AMF::AMF0_NUMBER, but this can be forced to a different value.

Parameters
indiceThe string indice of this object in its container, or empty string if none. Numeric indices are automatic.
valThe numeric value of this object. Numeric AMF0 objects only support double-type values.
setTypeThe object type to force this object to.
AMF::Object::Object ( std::string  indice,
std::string  val,
AMF::obj0type  setType = AMF0_STRING 
)

Constructor for string objects.

The object type is by default AMF::AMF0_STRING, but this can be forced to a different value. There is no need to manually change the type to AMF::AMF0_LONGSTRING, this will be done automatically.

Parameters
indiceThe string indice of this object in its container, or empty string if none. Numeric indices are automatic.
valThe string value of this object.
setTypeThe object type to force this object to.
AMF::Object::Object ( std::string  indice,
AMF::obj0type  setType = AMF0_OBJECT 
)

Constructor for container objects.

The object type is by default AMF::AMF0_OBJECT, but this can be forced to a different value.

Parameters
indiceThe string indice of this object in its container, or empty string if none. Numeric indices are automatic.
setTypeThe object type to force this object to.
AMF::Object::Object ( )
AMF::Object::Object ( std::string  indice,
double  val,
obj0type  setType = AMF0_NUMBER 
)
AMF::Object::Object ( std::string  indice,
std::string  val,
obj0type  setType = AMF0_STRING 
)
AMF::Object::Object ( std::string  indice,
obj0type  setType = AMF0_OBJECT 
)

Member Function Documentation

void AMF::Object::addContent ( AMF::Object  c)

Adds an AMF::Object to this object. Works for all types, but only makes sense for container types.

void AMF::Object::addContent ( AMF::Object  c)
AMF::Object AMF::Object::getContent ( unsigned int  i)

Returns a copy of the object held at indice i.

Returns a AMF::AMF0_DDV_CONTAINER of indice "error" if no object is held at this indice.

Parameters
iThe indice of the object in this container.
Object AMF::Object::getContent ( unsigned int  i)
AMF::Object AMF::Object::getContent ( std::string  s)

Returns a copy of the object held at indice s.

Returns a AMF::AMF0_DDV_CONTAINER of indice "error" if no object is held at this indice.

Parameters
sThe indice of the object in this container.
Object AMF::Object::getContent ( std::string  s)
AMF::Object * AMF::Object::getContentP ( unsigned int  i)

Returns a pointer to the object held at indice i.

Returns AMF::AMF0_DDV_CONTAINER of indice "error" if no object is held at this indice.

Parameters
iThe indice of the object in this container.
Object* AMF::Object::getContentP ( unsigned int  i)
Object* AMF::Object::getContentP ( std::string  s)
AMF::Object * AMF::Object::getContentP ( std::string  s)

Returns a pointer to the object held at indice s.

Returns NULL if no object is held at this indice.

Parameters
sThe indice of the object in this container.
AMF::obj0type AMF::Object::GetType ( )

Returns the AMF::obj0type AMF0 object type for this object.

obj0type AMF::Object::GetType ( )
int AMF::Object::hasContent ( )
int AMF::Object::hasContent ( )

Returns a count of the amount of objects this object currently holds.

If this object is not a container type, this function will always return 0.

std::string AMF::Object::Indice ( )

Returns the std::string Indice for the current object, if available.

Returns an empty string if no indice exists.

std::string AMF::Object::Indice ( )
double AMF::Object::NumValue ( )
double AMF::Object::NumValue ( )

Returns the numeric value of this object, if available.

If this object holds no numeric value, 0 is returned.

std::string AMF::Object::Pack ( )

Packs the AMF object to a std::string for transfer over the network.

If the object is a container type, this function will call itself recursively and contain all contents. Tip: When sending multiple AMF objects in one go, put them in a single AMF::AMF0_DDV_CONTAINER for easy transfer.

std::string AMF::Object::Pack ( )
std::string AMF::Object::Print ( std::string  indent = "")
std::string AMF::Object::Print ( std::string  indent = "")

Return the contents as a human-readable string.

If this object contains other objects, it will call itself recursively and print all nested content as well.

const char* AMF::Object::Str ( )
const char * AMF::Object::Str ( )

Returns the C-string value of this object, if available.

If this object holds no string value, an empty C-string is returned.

std::string AMF::Object::StrValue ( )
std::string AMF::Object::StrValue ( )

Returns the std::string value of this object, if available.

If this object holds no string value, an empty string is returned.

Field Documentation

std::vector< Object > AMF::Object::contents
protected

Holds this objects contents, if any (for container types).

std::string AMF::Object::myIndice
protected

Holds this objects indice, if any.

obj0type AMF::Object::myType
protected

Holds this objects AMF0 type.

double AMF::Object::numval
protected

Holds this objects numeric value, if any.

std::string AMF::Object::strval
protected

Holds this objects string value, if any.


The documentation for this class was generated from the following files: