Public Types | Public Member Functions

cygnal::Element Class Reference

#include <element.h>

List of all members.

Public Types

enum  amf0_type_e {
  NOTYPE = -1, NUMBER_AMF0 = 0x00, BOOLEAN_AMF0 = 0x01, STRING_AMF0 = 0x02,
  OBJECT_AMF0 = 0x03, MOVIECLIP_AMF0 = 0x04, NULL_AMF0 = 0x05, UNDEFINED_AMF0 = 0x06,
  REFERENCE_AMF0 = 0x07, ECMA_ARRAY_AMF0 = 0x08, OBJECT_END_AMF0 = 0x09, STRICT_ARRAY_AMF0 = 0x0a,
  DATE_AMF0 = 0x0b, LONG_STRING_AMF0 = 0x0c, UNSUPPORTED_AMF0 = 0x0d, RECORD_SET_AMF0 = 0x0e,
  XML_OBJECT_AMF0 = 0x0f, TYPED_OBJECT_AMF0 = 0x10, AMF3_DATA = 0x11, RTMP_HEADER = 0x20
}
enum  amf3_type_e {
  UNDEFINED_AMF3 = 0x00, NULL_AMF3 = 0x01, FALSE_AMF3 = 0x02, TRUE_AMF3 = 0x03,
  INTEGER_AMF3 = 0x04, DOUBLE_AMF3 = 0x05, STRING_AMF3 = 0x06, XMLDOC_AMF3 = 0x07,
  DATE_AMF3 = 0x08, ARRAY_AMF3 = 0x09, OBJECT_AMF3 = 0x0a, XML_AMF3 = 0x0b,
  BYTES_AMF3 = 0x0c
}

Public Member Functions

 Element ()
 Create a new Element with no data type.
 ~Element ()
 Delete this Element This deallocates all the memory used to hold the data.
 Element (double data)
 Construct an AMF Element from a double..
 Element (const std::string &name, double num)
 Contruct a Property from a double.
 Element (const char *data)
 Contruct an AMF Element from an ASCII string.
 Element (const std::string &data)
 Element (const std::string &name, const std::string &data)
 Contruct a Property from an ASCII string.
 Element (bool data)
 Contruct an AMF Element from a Boolean.
 Element (const std::string &name, bool data)
 Contruct a Property from a Boolean.
 Element (std::vector< double > &data)
 Contruct an AMF Element from an array of doubles. This becomes a StrictArray by default, as all the data types are the same.
 Element (std::vector< std::string > &data)
 Contruct an AMF Element from an array of ASCII strings This becomes a StrictArray by default, as all the data types are the same.
 Element (std::vector< Element > &data)
 Contruct an AMF Element from an array of other Elements. This becomes an EcmaArray by default, as all the data types are different.
void clear ()
 Clear the contents of the buffer by setting all the bytes to zeros.
Elementoperator= (Element &el)
 Make this Element be the same as another Element.
Elementoperator= (double num)
 Make this Element be the same as a double. This sets both the data type and the value.
Elementoperator= (const std::string &str)
 Make this Element be the same as an ASCII string. This sets both the data type and the value.
Elementoperator= (bool flag)
 Make this Element be the same as a boolean value. This sets both the data type and the value.
ElementmakeNullString ()
 Make this Element be a NULL String type. A Null String is a string with a length of zero.
ElementmakeString (const char *str, size_t size)
 Make this Element with an ASCII string value.
ElementmakeString (boost::uint8_t *data, size_t size)
 Make this Element with an ASCII string value.
ElementmakeString (const std::string &data)
 Make this Element with an ASCII string value.
ElementmakeString (const std::string &name, const std::string &str)
 Make this Element a Property with an ASCII String value.
ElementmakeNumber (double num)
 Make this Element with a double value.
ElementmakeNumber (boost::shared_ptr< cygnal::Buffer > buf)
 Make this Element with a double value.
ElementmakeNumber (boost::uint8_t *data)
 Make this Element with a double value. The size isn't needed as a double is always the same size.
ElementmakeNumber (const std::string &name, double num)
 Make this Element a Property with a double value.
ElementmakeNumber (const std::string &name, boost::uint8_t *data)
ElementmakeBoolean (boost::uint8_t *data)
 Make this Element with a boolean value. The size isn't needed as a boolean is always the same size.
ElementmakeBoolean (bool data)
 Make this Element with a boolean value.
ElementmakeBoolean (const std::string &name, bool data)
 Make this Element a Property with a boolean value.
ElementmakeUndefined ()
 Make this Element an Undefined data type.
ElementmakeUndefined (const std::string &name)
 Make this Element a Property with an Undefined data type.
ElementmakeNull ()
 Make this Element an NULL Object data type.
ElementmakeNull (const std::string &name)
 Make this Element a Property with an NULL Object data type.
ElementmakeObjectEnd ()
 Make this Element an Object End data type.
ElementmakeObject ()
 Make this Element as a Object data type. This is AMF data type that supports complex objects with properties. A Reference refers to a previously sent ActionScript object to save on bandwidth.
ElementmakeObject (const std::string &name)
 Make this Element as an Object data type.
ElementmakeObject (std::vector< boost::shared_ptr< cygnal::Element > > &data)
 Make this Element as an Object data type.
ElementmakeObject (const std::string &name, std::vector< boost::shared_ptr< cygnal::Element > > &data)
 Make this Element a Property with an Object as the value.
ElementmakeXMLObject ()
 Make this Element as an XML Object data type. This is like a string object, but the type is different.
ElementmakeXMLObject (const std::string &name)
 Make this Element a Property with an XML Object as the value.
ElementmakeXMLObject (const std::string &name, const std::string &data)
 Make this Element a Property with an XML Object as the value.
ElementmakeXMLObject (boost::uint8_t *data)
ElementmakeECMAArray ()
 Make this Element a Property with an ECMA Array as the value. This is a mixed array of any AMF types. These are stored the same as an object, but with a different type.
ElementmakeECMAArray (const std::string &name)
 Make this Element a Property with an ECMA Array as the value.
ElementmakeECMAArray (std::vector< boost::shared_ptr< cygnal::Element > > &data)
 Make this Element a Property with an ECMA Array as the value. This is a mixed array of any AMF types. These are stored the same as an object, but with a different type.
ElementmakeECMAArray (const std::string &name, std::vector< boost::shared_ptr< cygnal::Element > > &data)
 Make this Element a Property with an ECMA Array as the value.
ElementmakeStrictArray ()
 Make this Element a Property with an Strict Array as the value. This is an array of a single AMF type. These are stored the same as an object, but with a different type.
ElementmakeStrictArray (const std::string &name)
 Make this Element a Property with an Strict Array as the value. This is an array of a single AMF type. These are stored the same as an object, but with a different type.
ElementmakeStrictArray (std::vector< boost::shared_ptr< cygnal::Element > > &data)
 Make this Element a Property with an ECMA Array as the value. This is an array of a single AMF type. These are stored the same as an object, but with a different type.
ElementmakeStrictArray (const std::string &name, std::vector< boost::shared_ptr< cygnal::Element > > &data)
 Make this Element a Property with an Strict Array as the value.
ElementmakeTypedObject ()
 Make this Element a Property with an Typed Object as the value.
ElementmakeTypedObject (const std::string &name)
 Make this Element a Property with an Typed Object as the value.
ElementmakeTypedObject (boost::uint8_t *data)
 Make this Element a Property with an Typed Object as the value.
ElementmakeReference ()
 Make this Element a Property with an Object Reference as the value.
ElementmakeReference (boost::uint16_t index)
ElementmakeReference (boost::uint8_t *data, size_t size)
 Make this Element a Property with an Object Reference as the value.
ElementmakeMovieClip ()
 Make this Element a Property with a Movie Clip (SWF data) as the value.
ElementmakeMovieClip (boost::uint8_t *data, size_t size)
 Make this Element a Property with a Movie Clip (SWF data) as the value.
ElementmakeLongString ()
 Make this Element a Property with a UTF8 String as the value.
ElementmakeLongString (boost::uint8_t *data)
 Make this Element a Property with a UTF8 String as the value.
ElementmakeRecordSet ()
 Make this Element a Property with a Record Set as the value.
ElementmakeRecordSet (boost::uint8_t *data)
 Make this Element a Property with a Record Set as the value.
ElementmakeDate ()
 Make this Element a Property with a Date as the value.
ElementmakeDate (boost::uint8_t *data)
 Make this Element a Property with a Date as the value.
ElementmakeDate (double data)
ElementmakeUnsupported ()
 Make this Element a Property with an Unsupported value.
ElementmakeUnsupported (boost::uint8_t *data)
 Make this Element a Property with an Unsupported value.
bool operator== (Element &)
 Test equivalance against another Element. This compares all the data and the data type in the current Element with the supplied one, so it can be a performance hit. This is primarily only used for testing purposes.
bool operator== (boost::shared_ptr< cygnal::Element >)
 Test equivalance against another Element. This compares all the data and the data type in the current Element with the supplied one, so it can be a performance hit. This is primarily only used for testing purposes.
bool operator== (bool x)
 Test equivalance against a boolean value This compares all the data and the data type in the current Element to see if it is a Boolean and if the values ard the same. This is primarily only used for testing purposes.
boost::shared_ptr
< cygnal::Element
operator[] (size_t index)
 Get the Element or Property at a specified location.
size_t getDataSize () const
 Get the size in bytes of the Element's data. All data in an Element is stored in a Buffer class.
amf0_type_e getType () const
 Get the data type of this Element.
void setType (amf0_type_e type)
 Get the data type of this Element.
bool to_bool () const
 Cast the data in this Element to a boolean value.
double to_number () const
 Cast the data in this Element to a double value.
boost::uint16_t to_short () const
 Cast the data in this Element to a short (2 bytes) value.
boost::uint32_t to_integer () const
 Cast the data in this Element to an integer (4 bytes) value.
const char * to_string () const
 Cast the data in this Element to an ASCII string value.
boost::uint8_t * to_reference ()
 Cast the data in this Element to an real pointer to data.
const boost::uint8_t * to_reference () const
size_t getNameSize () const
 Get the number of bytes in the name of this Element. Only top level Objects or properties have a name.
char * getName () const
 Get the name of this Element. Only top level Objects or properties have a name.
void setName (const std::string &name)
 Set the name of this Element or property. Only top level Objects or properties have a name.
void setName (const char *name, size_t x)
 Set the name of this Element or property. Only top level Objects or properties have a name.
void setName (boost::uint8_t *name, size_t size)
 Set the name of this Element or property. Only top level Objects or properties have a name.
boost::shared_ptr< ElementfindProperty (const std::string &name)
 Find the named property for this Object.
boost::shared_ptr< ElementgetProperty (size_t index) const
 Find the property at this index for this Object.
void addProperty (boost::shared_ptr< Element > el)
 Add a Property to the array of properties for this object.
void clearProperties ()
boost::shared_ptr< ElementpopProperty ()
 Get a smart pointer to the Element for this Property.
size_t propertySize () const
 Get the count of properties for this Element.
boost::shared_ptr< Bufferencode ()
 Encode this Element (data type object). This encodes this Element and all of it's associated properties into raw binary data in big endoan format.
boost::shared_ptr< Bufferencode (bool notobject)
std::vector< boost::shared_ptr
< Element > > 
getProperties () const
 Get the array of properties for this Element.
size_t calculateSize ()
size_t calculateSize (cygnal::Element &el) const
void dump () const
 Dump the internal data of this class in a human readable form.
void dump (std::ostream &os) const
 Dump the internal data of this class in a human readable form.

Detailed Description

This class holds an deserialized AMF object or Property. The only difference is that a Property sets the name field, while raw AMF data does not.


Member Enumeration Documentation

Enumerator:
NOTYPE 
NUMBER_AMF0 
BOOLEAN_AMF0 
STRING_AMF0 
OBJECT_AMF0 
MOVIECLIP_AMF0 
NULL_AMF0 
UNDEFINED_AMF0 
REFERENCE_AMF0 
ECMA_ARRAY_AMF0 
OBJECT_END_AMF0 
STRICT_ARRAY_AMF0 
DATE_AMF0 
LONG_STRING_AMF0 
UNSUPPORTED_AMF0 
RECORD_SET_AMF0 
XML_OBJECT_AMF0 
TYPED_OBJECT_AMF0 
AMF3_DATA 
RTMP_HEADER 
Enumerator:
UNDEFINED_AMF3 
NULL_AMF3 
FALSE_AMF3 
TRUE_AMF3 
INTEGER_AMF3 
DOUBLE_AMF3 
STRING_AMF3 
XMLDOC_AMF3 
DATE_AMF3 
ARRAY_AMF3 
OBJECT_AMF3 
XML_AMF3 
BYTES_AMF3 

Constructor & Destructor Documentation

cygnal::Element::Element (  ) 

Create a new Element with no data type.

cygnal::Element::~Element (  ) 

Delete this Element This deallocates all the memory used to hold the data.

cygnal::Element::Element ( double  indata  ) 

Construct an AMF Element from a double..

Parameters:
data The double to use as the value for this Element.

References makeNumber().

cygnal::Element::Element ( const std::string &  name,
double  num 
)

Contruct a Property from a double.

Parameters:
name The name of the Property
num The double to use as the value of the property.
cygnal::Element::Element ( const char *  indata  ) 

Contruct an AMF Element from an ASCII string.

Parameters:
data The ASCII string to use as the value of the property.
Remarks:
This assume the data string is already NULL terminated.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References makeString().

cygnal::Element::Element ( const std::string &  data  ) 

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

cygnal::Element::Element ( const std::string &  name,
const std::string &  data 
)

Contruct a Property from an ASCII string.

Parameters:
name The name of the Property
data The ASCII string to use as the value of the property.
cygnal::Element::Element ( bool  data  ) 

Contruct an AMF Element from a Boolean.

Parameters:
data The boolean to use as the value for this Element.

References makeBoolean().

cygnal::Element::Element ( const std::string &  name,
bool  data 
)

Contruct a Property from a Boolean.

Parameters:
name The name of the Property
data The boolean to use as the value of the property.
cygnal::Element::Element ( std::vector< double > &  data  ) 

Contruct an AMF Element from an array of doubles. This becomes a StrictArray by default, as all the data types are the same.

Parameters:
data The data to use as the values for this Element.
cygnal::Element::Element ( std::vector< std::string > &  data  ) 

Contruct an AMF Element from an array of ASCII strings This becomes a StrictArray by default, as all the data types are the same.

Parameters:
data The data to use as the values for this Element.
cygnal::Element::Element ( std::vector< Element > &  data  ) 

Contruct an AMF Element from an array of other Elements. This becomes an EcmaArray by default, as all the data types are different.

Parameters:
data The data to use as the values for this Element.

Member Function Documentation

void cygnal::Element::addProperty ( boost::shared_ptr< Element el  )  [inline]

Add a Property to the array of properties for this object.

Parameters:
el A smart pointer to the Element for this Property.
Returns:
nothing.

References _properties.

Referenced by cygnal::RTMPServer::encodeResult(), and cygnal::OflaDemoTest::parseOflaDemoRequest().

size_t cygnal::Element::calculateSize (  ) 
size_t cygnal::Element::calculateSize ( cygnal::Element el  )  const
void cygnal::Element::clear (  ) 

Clear the contents of the buffer by setting all the bytes to zeros.

Returns:
nothing
void cygnal::Element::clearProperties (  )  [inline]

References _properties.

void cygnal::Element::dump (  )  const [inline]

Dump the internal data of this class in a human readable form.

Remarks:
This should only be used for debugging purposes.

References dump().

Referenced by gnash::RTMP::dump(), dump(), cygnal::EchoTest::formatEchoResponse(), cygnal::OflaDemoTest::formatOflaDemoResponse(), cygnal::operator<<(), and cygnal::RTMPServer::packetRead().

void cygnal::Element::dump ( std::ostream &  os  )  const

Dump the internal data of this class in a human readable form.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Remarks:
This should only be used for debugging purposes.

References AMF3_DATA, cygnal::astype_str, BOOLEAN_AMF0, DATE_AMF0, ECMA_ARRAY_AMF0, getDataSize(), LONG_STRING_AMF0, MOVIECLIP_AMF0, NULL_AMF0, NUMBER_AMF0, OBJECT_AMF0, OBJECT_END_AMF0, RECORD_SET_AMF0, REFERENCE_AMF0, STRICT_ARRAY_AMF0, STRING_AMF0, to_bool(), to_number(), to_string(), TYPED_OBJECT_AMF0, UNDEFINED_AMF0, UNSUPPORTED_AMF0, and XML_OBJECT_AMF0.

boost::shared_ptr< Buffer > cygnal::Element::encode (  ) 

Encode this Element (data type object). This encodes this Element and all of it's associated properties into raw binary data in big endoan format.

Parameters:
notobject Flag to not encode the element as an object, instead it's just a list of properties. This is used when formatting onStatus response packets.
Returns:
a smart pointer to a Buffer class.
a smart pointer to a Buffer class.

Referenced by cygnal::RTMPServer::encodeBWDone(), gnash::RTMPClient::encodeEchoRequest(), cygnal::RTMPServer::encodeResult(), gnash::RTMPClient::encodeStreamOp(), cygnal::EchoTest::formatEchoResponse(), cygnal::FitcDemoTest::formatFitcDemoResponse(), cygnal::OflaDemoTest::formatOflaDemoResponse(), and cygnal::OflaDemoTest::parseOflaDemoRequest().

boost::shared_ptr< Buffer > cygnal::Element::encode ( bool  notobject  ) 
boost::shared_ptr< cygnal::Element > cygnal::Element::findProperty ( const std::string &  name  ) 

Find the named property for this Object.

Parameters:
name An ASCII string that is the name of the property to search for.
Returns:
A smart pointer to the Element for this property.
size_t cygnal::Element::getDataSize (  )  const

Get the size in bytes of the Element's data. All data in an Element is stored in a Buffer class.

Returns:
the size in bytes.

Referenced by calculateSize(), dump(), operator=(), and operator==().

char* cygnal::Element::getName (  )  const [inline]

Get the name of this Element. Only top level Objects or properties have a name.

Returns:
The size of the name string.

References _name.

Referenced by gnash::RTMP::addProperty(), cygnal::EchoTest::formatEchoResponse(), cygnal::OflaDemoTest::formatOflaDemoResponse(), operator=(), and operator==().

size_t cygnal::Element::getNameSize (  )  const

Get the number of bytes in the name of this Element. Only top level Objects or properties have a name.

Returns:
The size of the name string.

Referenced by calculateSize(), encode(), operator=(), and operator==().

std::vector<boost::shared_ptr<Element> > cygnal::Element::getProperties (  )  const [inline]

Get the array of properties for this Element.

Returns:
A smart pointer to a vector of Elements.
Remarks:
This is only intended to be used for testing and debugging purposes.

References _properties.

Referenced by calculateSize().

boost::shared_ptr<Element> cygnal::Element::getProperty ( size_t  index  )  const [inline]

Find the property at this index for this Object.

Parameters:
index The index of the property in the array of data.
Returns:
A smart pointer to the Element for this property.

References _properties.

amf0_type_e cygnal::Element::getType (  )  const [inline]

Get the data type of this Element.

Returns:
The data type.

Referenced by calculateSize(), operator=(), and operator==().

Element & cygnal::Element::makeBoolean ( bool  flag  ) 

Make this Element with a boolean value.

Parameters:
data A boolean to use as the value.
Returns:
A reference to this Element.

References gnash::key::e.

Element& cygnal::Element::makeBoolean ( const std::string &  name,
bool  data 
)

Make this Element a Property with a boolean value.

Parameters:
name The name of the Property
data The boolean to use as the value of the property.
Returns:
A reference to this Element.
Element & cygnal::Element::makeBoolean ( boost::uint8_t *  data  ) 

Make this Element with a boolean value. The size isn't needed as a boolean is always the same size.

Parameters:
data A real pointer to the boolean use as the value.
Returns:
A reference to this Element.

Referenced by Element(), and operator=().

Element & cygnal::Element::makeDate ( boost::uint8_t *  data  ) 

Make this Element a Property with a Date as the value.

Parameters:
data A real pointer to the raw data to use as the value.
Returns:
A reference to this Element.

References makeNumber().

Element & cygnal::Element::makeDate ( double  data  ) 
Element & cygnal::Element::makeDate (  ) 

Make this Element a Property with a Date as the value.

Returns:
A reference to this Element.
Parameters:
data A real pointer to the raw data to use as the value.
Returns:
A reference to this Element.
Element & cygnal::Element::makeECMAArray ( const std::string &  name  ) 

Make this Element a Property with an ECMA Array as the value.

Parameters:
name The name of the Property
Returns:
A reference to this Element.

References makeECMAArray(), and setName().

Element & cygnal::Element::makeECMAArray (  ) 

Make this Element a Property with an ECMA Array as the value. This is a mixed array of any AMF types. These are stored the same as an object, but with a different type.

Returns:
A reference to this Element.

Referenced by makeECMAArray(), and cygnal::OflaDemoTest::parseOflaDemoRequest().

Element & cygnal::Element::makeECMAArray ( std::vector< boost::shared_ptr< cygnal::Element > > &  data  ) 

Make this Element a Property with an ECMA Array as the value. This is a mixed array of any AMF types. These are stored the same as an object, but with a different type.

Parameters:
data A smart pointer to a vector of Elements to use as the vaule.
Returns:
A reference to this Element.

References data, and makeObject().

Element & cygnal::Element::makeECMAArray ( const std::string &  name,
std::vector< boost::shared_ptr< cygnal::Element > > &  data 
)

Make this Element a Property with an ECMA Array as the value.

Parameters:
name The name of the Property
data A smart pointer to a vector of Elements to use as the vaule.
Returns:
A reference to this Element.

References data, and makeObject().

Element & cygnal::Element::makeLongString ( boost::uint8_t *  indata  ) 

Make this Element a Property with a UTF8 String as the value.

Parameters:
data A real pointer to the raw data to use as the value.
size The number of bytes to use as the value.
Returns:
A reference to this Element.

References UNUSED.

Element & cygnal::Element::makeLongString (  ) 

Make this Element a Property with a UTF8 String as the value.

Returns:
A reference to this Element.
Element & cygnal::Element::makeMovieClip (  ) 

Make this Element a Property with a Movie Clip (SWF data) as the value.

Returns:
A reference to this Element.
Element & cygnal::Element::makeMovieClip ( boost::uint8_t *  indata,
size_t  size 
)

Make this Element a Property with a Movie Clip (SWF data) as the value.

Parameters:
data A real pointer to the raw data to use as the value.
size The number of bytes to use as the value.
Returns:
A reference to this Element.
Element & cygnal::Element::makeNull (  ) 

Make this Element an NULL Object data type.

Make this Element an NULL Object data type A NULL AMF0 Object consists of a single byte, which is the type.

Returns:
A reference to this Element.

Referenced by cygnal::RTMPServer::encodeBWDone(), gnash::RTMPClient::encodeStreamOp(), cygnal::EchoTest::formatEchoResponse(), cygnal::FitcDemoTest::formatFitcDemoResponse(), cygnal::OflaDemoTest::formatOflaDemoResponse(), makeNull(), and cygnal::OflaDemoTest::parseOflaDemoRequest().

Element & cygnal::Element::makeNull ( const std::string &  name  ) 

Make this Element a Property with an NULL Object data type.

Parameters:
name The name of the Property
Returns:
A reference to this Element.

References makeNull(), and setName().

Element & cygnal::Element::makeNullString (  ) 

Make this Element be a NULL String type. A Null String is a string with a length of zero.

Make this Element be a NULL String type. A Null String is a string with a length of zero. The data is only one byte, which always has the value of zero of course.

Returns:
A reference to this Element.

References gnash::key::e.

Element & cygnal::Element::makeNumber ( double  num  ) 
Element & cygnal::Element::makeNumber ( boost::shared_ptr< cygnal::Buffer buf  ) 

Make this Element with a double value.

Parameters:
buf A smart pointer to a Buffer class.
Returns:
A reference to this Element.

References makeNumber().

Element & cygnal::Element::makeNumber ( boost::uint8_t *  data  ) 

Make this Element with a double value. The size isn't needed as a double is always the same size.

Parameters:
str The double to use as the value.
Returns:
A reference to this Element.

References cygnal::AMF0_NUMBER_SIZE, and gnash::key::e.

cygnal::Element::makeNumber ( const std::string &  name,
boost::uint8_t *  data 
)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

The size isn't needed as a double is always the same size.

References cygnal::AMF0_NUMBER_SIZE, gnash::key::e, and setName().

Element& cygnal::Element::makeNumber ( const std::string &  name,
double  num 
)

Make this Element a Property with a double value.

Parameters:
name The name of the Property
num The double to use as the value of the property.
Element & cygnal::Element::makeObject (  ) 

Make this Element as a Object data type. This is AMF data type that supports complex objects with properties. A Reference refers to a previously sent ActionScript object to save on bandwidth.

Parameters:
data A smart pointer to an Element to use as the value.
Returns:
A reference to this Element.

Referenced by cygnal::RTMPServer::encodeResult(), makeECMAArray(), makeObject(), and makeStrictArray().

Element & cygnal::Element::makeObject ( const std::string &  name  ) 

Make this Element as an Object data type.

Parameters:
name The name of this object. This is not the same as the name of a property.
Returns:
A reference to this Element.

References makeObject(), and setName().

Element& cygnal::Element::makeObject ( std::vector< boost::shared_ptr< cygnal::Element > > &  data  ) 

Make this Element as an Object data type.

Parameters:
data A smart pointer to an Element to use as the value.
Returns:
A reference to this Element.
Element& cygnal::Element::makeObject ( const std::string &  name,
std::vector< boost::shared_ptr< cygnal::Element > > &  data 
)

Make this Element a Property with an Object as the value.

Parameters:
name The name of the Property
data A smart pointer to an Element to use as the value.
Returns:
A reference to this Element.
Element & cygnal::Element::makeObjectEnd (  ) 

Make this Element an Object End data type.

Returns:
A reference to this Element.
Element & cygnal::Element::makeRecordSet (  ) 

Make this Element a Property with a Record Set as the value.

Returns:
A reference to this Element.
Element & cygnal::Element::makeRecordSet ( boost::uint8_t *  data  ) 

Make this Element a Property with a Record Set as the value.

Parameters:
data A real pointer to the raw data to use as the value.
size The number of bytes to use as the value.
Returns:
A reference to this Element.

References UNUSED.

Element & cygnal::Element::makeReference (  ) 

Make this Element a Property with an Object Reference as the value.

Returns:
A reference to this Element.

Referenced by makeReference().

Element & cygnal::Element::makeReference ( boost::uint16_t  index  ) 

References makeReference().

Element & cygnal::Element::makeReference ( boost::uint8_t *  indata,
size_t  size 
)

Make this Element a Property with an Object Reference as the value.

Parameters:
data A real pointer to the raw data to use as the value.
size The number of bytes to use as the value.
Returns:
A reference to this Element.

References gnash::key::e.

Element & cygnal::Element::makeStrictArray (  ) 

Make this Element a Property with an Strict Array as the value. This is an array of a single AMF type. These are stored the same as an object, but with a different type.

Returns:
A reference to this Element.

Referenced by makeStrictArray().

Element & cygnal::Element::makeStrictArray ( const std::string &  name  ) 

Make this Element a Property with an Strict Array as the value. This is an array of a single AMF type. These are stored the same as an object, but with a different type.

Parameters:
name The name of the Property
Returns:
A reference to this Element.

References makeStrictArray(), and setName().

Element & cygnal::Element::makeStrictArray ( std::vector< boost::shared_ptr< cygnal::Element > > &  data  ) 

Make this Element a Property with an ECMA Array as the value. This is an array of a single AMF type. These are stored the same as an object, but with a different type.

Parameters:
data A smart pointer to a vector of Elements to use as the vaule.
Returns:
A reference to this Element.

References data, and makeObject().

Element & cygnal::Element::makeStrictArray ( const std::string &  name,
std::vector< boost::shared_ptr< cygnal::Element > > &  data 
)

Make this Element a Property with an Strict Array as the value.

Parameters:
name The name of the Property
data A smart pointer to a vector of Elements to use as the vaule.
Returns:
A reference to this Element.

References data, and makeObject().

Element& cygnal::Element::makeString ( const std::string &  data  ) 

Make this Element with an ASCII string value.

Parameters:
str The ASCII string to use as the value.
Returns:
A reference to this Element.
Element& cygnal::Element::makeString ( const std::string &  name,
const std::string &  str 
)

Make this Element a Property with an ASCII String value.

Parameters:
name The name of the Property
str The ASCII string to use as the value of the property.
Returns:
A reference to this Element.
Element & cygnal::Element::makeString ( boost::uint8_t *  data,
size_t  size 
)

Make this Element with an ASCII string value.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Note:
All Numbers are 64 bit, big-endian (network byte order) entities. All strings are in multibyte format, which is to say, probably normal ASCII. It may be that these need to be converted to wide characters, but for now we just leave them as standard multibyte characters.
Parameters:
data The ASCII string to use as the value.
size The number of bytes in the ASCII string.
Returns:
A reference to this Element.

References gnash::key::e.

Element & cygnal::Element::makeString ( const char *  str,
size_t  size 
)

Make this Element with an ASCII string value.

Parameters:
str The ASCII string to use as the value.
size The number of bytes in the ASCII string.
Returns:
A reference to this Element.

Referenced by Element(), cygnal::RTMPServer::encodeBWDone(), cygnal::RTMPServer::encodeResult(), gnash::RTMPClient::encodeStreamOp(), cygnal::EchoTest::formatEchoResponse(), cygnal::FitcDemoTest::formatFitcDemoResponse(), cygnal::OflaDemoTest::formatOflaDemoResponse(), and cygnal::OflaDemoTest::parseOflaDemoRequest().

Element & cygnal::Element::makeTypedObject ( const std::string &  name  ) 

Make this Element a Property with an Typed Object as the value.

Parameters:
name The name of the Property
Returns:
A reference to this Element.

References setName().

Element & cygnal::Element::makeTypedObject (  ) 

Make this Element a Property with an Typed Object as the value.

Parameters:
name The name of the Property
Returns:
A reference to this Element.
Element & cygnal::Element::makeTypedObject ( boost::uint8_t *  data  ) 

Make this Element a Property with an Typed Object as the value.

Parameters:
data A real pointer to the raw data to use as the value.
size The number of bytes to use as the value.
Returns:
A reference to this Element.
Element & cygnal::Element::makeUndefined (  ) 

Make this Element an Undefined data type.

Returns:
A reference to this Element.

Referenced by makeUndefined().

Element & cygnal::Element::makeUndefined ( const std::string &  name  ) 

Make this Element a Property with an Undefined data type.

Parameters:
name The name of the Property
Returns:
A reference to this Element.

References makeUndefined(), and setName().

Element & cygnal::Element::makeUnsupported (  ) 

Make this Element a Property with an Unsupported value.

Returns:
A reference to this Element.
Element & cygnal::Element::makeUnsupported ( boost::uint8_t *  data  ) 

Make this Element a Property with an Unsupported value.

Parameters:
data A real pointer to the raw data to use as the value.
size The number of bytes to use as the value.
Returns:
A reference to this Element.

References UNUSED.

Element & cygnal::Element::makeXMLObject (  ) 

Make this Element as an XML Object data type. This is like a string object, but the type is different.

Returns:
A reference to this Element.
Element& cygnal::Element::makeXMLObject ( const std::string &  name,
const std::string &  data 
)

Make this Element a Property with an XML Object as the value.

Parameters:
name The name of the Property
data A smart pointer to an Element to use as the value.
Returns:
A reference to this Element.
Element& cygnal::Element::makeXMLObject ( const std::string &  name  ) 

Make this Element a Property with an XML Object as the value.

Parameters:
name The name of the Property
data The boolean to use as the value of the property.
Returns:
A reference to this Element.
Element & cygnal::Element::makeXMLObject ( boost::uint8_t *  data  ) 
Element& cygnal::Element::operator= ( const std::string &  str  ) 

Make this Element be the same as an ASCII string. This sets both the data type and the value.

Parameters:
el An ASCII string value.
Returns:
A reference to this Element.
Element & cygnal::Element::operator= ( Element el  ) 

Make this Element be the same as another Element.

Parameters:
el A reference to an Element class.
Returns:
A reference to this Element.

References getDataSize(), getName(), getNameSize(), getType(), setName(), and to_reference().

Element & cygnal::Element::operator= ( bool  flag  ) 

Make this Element be the same as a boolean value. This sets both the data type and the value.

Parameters:
el A boolean value.
Returns:
A reference to this Element.

References makeBoolean().

Element & cygnal::Element::operator= ( double  num  ) 

Make this Element be the same as a double. This sets both the data type and the value.

Parameters:
el A double value.
Returns:
A reference to this Element.

References makeNumber().

bool cygnal::Element::operator== ( boost::shared_ptr< cygnal::Element  ) 

Test equivalance against another Element. This compares all the data and the data type in the current Element with the supplied one, so it can be a performance hit. This is primarily only used for testing purposes.

Parameters:
buf A smart pointer to an Element.
Returns:
A boolean true if the Elements are indentical.
bool cygnal::Element::operator== ( bool  x  ) 

Test equivalance against a boolean value This compares all the data and the data type in the current Element to see if it is a Boolean and if the values ard the same. This is primarily only used for testing purposes.

Parameters:
buf A boolean value
Returns:
A boolean true if the Elements are indentical.
bool cygnal::Element::operator== ( Element el  ) 

Test equivalance against another Element. This compares all the data and the data type in the current Element with the supplied one, so it can be a performance hit. This is primarily only used for testing purposes.

Parameters:
buf A reference to an Element.
Returns:
A boolean true if the Elements are indentical.

References getDataSize(), getName(), getNameSize(), getType(), propertySize(), and to_reference().

boost::shared_ptr< Element > cygnal::Element::operator[] ( size_t  index  ) 

Get the Element or Property at a specified location.

Parameters:
index The location as a numerical value of the item in the array to get.
Returns:
A smart pointer to the Element or property.
boost::shared_ptr<Element> cygnal::Element::popProperty (  )  [inline]

Get a smart pointer to the Element for this Property.

Returns:
A smart pointer to the Element for this Property
Remarks:
This does not remove the Element from array of properties.

References _properties.

size_t cygnal::Element::propertySize (  )  const [inline]

Get the count of properties for this Element.

Returns:
The number of Properties associated with this object.

References _properties.

Referenced by operator==().

void cygnal::Element::setName ( boost::uint8_t *  name,
size_t  size 
)

Set the name of this Element or property. Only top level Objects or properties have a name.

Parameters:
name A real pointer to the raw bytes to use as the name for this Element.
size The number of bytes to use for the name.
Returns:
nothing.
Remarks:
This add a NULL string terminator so the name can be printed.
Parameters:
name A real pointer to the raw bytes to use as the name for this Element.
size The number of bytes to use for the name.
Returns:
nothing.
Remarks:
This adds a NULL string terminator so the name can be printed.
void cygnal::Element::setName ( const std::string &  name  ) 

Set the name of this Element or property. Only top level Objects or properties have a name.

Parameters:
str the name to use for this Element.
Returns:
nothing.

Referenced by makeECMAArray(), makeNull(), makeNumber(), makeObject(), makeStrictArray(), makeTypedObject(), makeUndefined(), operator=(), and setName().

void cygnal::Element::setName ( const char *  name,
size_t  size 
)

Set the name of this Element or property. Only top level Objects or properties have a name.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
name A real pointer to the raw bytes to use as the name for this Element.
size The number of bytes to use for the name.
Returns:
nothing.
Remarks:
This adds a NULL string terminator so the name can be printed.

References setName().

void cygnal::Element::setType ( amf0_type_e  type  )  [inline]

Get the data type of this Element.

Parameters:
type The data type to use as the value.
Returns:
nothing.
bool cygnal::Element::to_bool (  )  const

Cast the data in this Element to a boolean value.

Returns:
boolean value.

Referenced by dump().

boost::uint32_t cygnal::Element::to_integer (  )  const

Cast the data in this Element to an integer (4 bytes) value.

Cast the data in this Element to a short value.

Returns:
integer (4 bytes) value.
short value.
double cygnal::Element::to_number (  )  const

Cast the data in this Element to a double value.

Returns:
double value.

Referenced by dump().

const boost::uint8_t * cygnal::Element::to_reference (  )  const
boost::uint8_t * cygnal::Element::to_reference (  ) 

Cast the data in this Element to an real pointer to data.

Returns:
A real pointer to the base address of the raw data in memory.

Referenced by operator=(), and operator==().

boost::uint16_t cygnal::Element::to_short (  )  const

Cast the data in this Element to a short (2 bytes) value.

Cast the data in this Element to a short value.

Returns:
short (2 bytes) value.
short value.
const char * cygnal::Element::to_string (  )  const

Cast the data in this Element to an ASCII string value.

Returns:
A NULL terminated ASCII string.

Referenced by dump().


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