Gnash
0.8.10
|
A class to compose AMF buffers. More...
#include <AMFConverter.h>
Public Types | |
typedef std::map< as_object *, size_t > | OffsetTable |
Public Member Functions | |
Writer (SimpleBuffer &buf, bool strictArray=false) | |
bool | writeObject (as_object *obj) |
Write any simple Object type: not DisplayObjects. | |
bool | writeString (const std::string &str) |
Write a string. | |
bool | writeNull () |
Write a null value. | |
bool | writeUndefined () |
Write an undefined value. | |
bool | writeNumber (double d) |
Write a double. | |
bool | writeBoolean (bool b) |
Write a boolean. | |
bool | writePropertyName (const std::string &name) |
Encode the name of an object's property. | |
void | writeData (const boost::uint8_t *data, size_t length) |
Write custom data for special cases. |
A class to compose AMF buffers.
A single amf::Writer class can take successive values and encode them in a single buffer. The class takes care of object references. This class merely encodes basic types such as strings, numbers, and ActionScript Objects. It does not handle as_values. However, it is designed for use with as_value::writeAMF0(), which uses an instance of this class to serialize itself.
typedef std::map<as_object*, size_t> gnash::amf::Writer::OffsetTable |
gnash::amf::Writer::Writer | ( | SimpleBuffer & | buf, |
bool | strictArray = false |
||
) | [inline] |
bool gnash::amf::Writer::writeBoolean | ( | bool | b | ) |
void gnash::amf::Writer::writeData | ( | const boost::uint8_t * | data, |
size_t | length | ||
) |
Write custom data for special cases.
References gnash::SimpleBuffer::append().
bool gnash::amf::Writer::writeNull | ( | ) |
Write a null value.
References gnash::SimpleBuffer::appendByte(), and gnash::amf::NULL_AMF0.
Referenced by gnash::as_value::writeAMF0().
bool gnash::amf::Writer::writeNumber | ( | double | d | ) |
bool gnash::amf::Writer::writeObject | ( | as_object * | obj | ) |
Write any simple Object type: not DisplayObjects.
Handles functions, dates, XML, and arrays. The object must not be null.
Native objects are handled specially.
XML is written like a long string (but with an XML marker).
References assert, gnash::as_object::to_function(), gnash::SimpleBuffer::appendByte(), gnash::amf::REFERENCE_AMF0, gnash::SimpleBuffer::appendNetworkShort(), gnash::as_object::relay(), gnash::isNativeType(), gnash::key::d, gnash::Date_as::getTimeValue(), gnash::amf::DATE_AMF0, gnash::amf::writePlainNumber(), gnash::amf::XML_OBJECT_AMF0, gnash::key::s, gnash::XML_as::toString(), gnash::amf::writePlainString(), gnash::amf::LONG_STRING_AMF0, gnash::amf::UNSUPPORTED_AMF0, gnash::getVM(), gnash::as_object::array(), gnash::arrayLength(), gnash::as_object::visitProperties(), gnash::IsStrictArray::strict(), gnash::amf::STRICT_ARRAY_AMF0, gnash::SimpleBuffer::appendNetworkLong(), gnash::key::i, gnash::getMember(), gnash::arrayKey(), gnash::as_value::writeAMF0(), _, gnash::amf::ECMA_ARRAY_AMF0, gnash::amf::OBJECT_AMF0, and gnash::amf::OBJECT_END_AMF0.
Referenced by gnash::as_value::writeAMF0().
bool gnash::amf::Writer::writePropertyName | ( | const std::string & | name | ) |
Encode the name of an object's property.
You should encode the value of the property immediately afterwards.
References gnash::amf::writePlainString(), and gnash::amf::STRING_AMF0.
bool gnash::amf::Writer::writeString | ( | const std::string & | str | ) |
Write a string.
Handles long and short strings.
References gnash::amf::write().
Referenced by gnash::as_value::writeAMF0().
bool gnash::amf::Writer::writeUndefined | ( | ) |
Write an undefined value.
References gnash::SimpleBuffer::appendByte(), and gnash::amf::UNDEFINED_AMF0.
Referenced by gnash::as_value::writeAMF0().