Gnash  0.8.11dev
Public Types | Public Member Functions | List of all members
gnash::amf::Writer Class Reference

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. More...
 
bool writeString (const std::string &str)
 Write a string. More...
 
bool writeNull ()
 Write a null value. More...
 
bool writeUndefined ()
 Write an undefined value. More...
 
bool writeNumber (double d)
 Write a double. More...
 
bool writeBoolean (bool b)
 Write a boolean. More...
 
bool writePropertyName (const std::string &name)
 Encode the name of an object's property. More...
 
void writeData (const std::uint8_t *data, size_t length)
 Write custom data for special cases. More...
 

Detailed Description

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.

Member Typedef Documentation

§ OffsetTable

typedef std::map<as_object*, size_t> gnash::amf::Writer::OffsetTable

Constructor & Destructor Documentation

§ Writer()

gnash::amf::Writer::Writer ( SimpleBuffer buf,
bool  strictArray = false 
)
inline

Member Function Documentation

§ writeBoolean()

bool gnash::amf::Writer::writeBoolean ( bool  b)

Write a boolean.

References gnash::amf::write().

Referenced by gnash::as_value::writeAMF0(), and Writer().

§ writeData()

void gnash::amf::Writer::writeData ( const std::uint8_t *  data,
size_t  length 
)

Write custom data for special cases.

Referenced by Writer().

§ writeNull()

bool gnash::amf::Writer::writeNull ( )

Write a null value.

References gnash::log_debug().

Referenced by gnash::as_value::writeAMF0(), and Writer().

§ writeNumber()

bool gnash::amf::Writer::writeNumber ( double  d)

Write a double.

References gnash::amf::write().

Referenced by gnash::as_value::writeAMF0(), and Writer().

§ writeObject()

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 gnash::as_object::to_function().

Referenced by gnash::as_value::writeAMF0(), and Writer().

§ writePropertyName()

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().

Referenced by Writer().

§ writeString()

bool gnash::amf::Writer::writeString ( const std::string &  str)

Write a string.

Handles long and short strings.

References gnash::amf::write().

Referenced by gnash::registerLocalConnectionNative(), gnash::as_value::writeAMF0(), and Writer().

§ writeUndefined()

bool gnash::amf::Writer::writeUndefined ( )

Write an undefined value.

References gnash::log_debug().

Referenced by gnash::as_value::writeAMF0(), and Writer().


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