Gnash  0.8.10
Public Member Functions
gnash::amf::Reader Class Reference

Deserialize an AMF buffer to as_values. More...

#include <AMFConverter.h>

List of all members.

Public Member Functions

 Reader (const boost::uint8_t *&pos, const boost::uint8_t *end, Global_as &gl)
 Construct a Reader with pointers into an AMF buffer.
bool operator() (as_value &val, Type t=NOTYPE)
 Create a type from current position in the AMF buffer.

Detailed Description

Deserialize an AMF buffer to as_values.

This class relies on the public interface of as_value because we don't necessarily know in advance what basic type will be read from the buffer. Note that callers may change the current buffer position. They must check that the read position is not past the end when a Reader object is called. This is very important! For reading of basic types, there is no need to use VM resources. Object types required the construction of objects, which in turn needs a reference to a Global_as. For this reason, object reading functions are member functions, and the Reader requires a Global_as& reference in case it encounters object data.


Constructor & Destructor Documentation

gnash::amf::Reader::Reader ( const boost::uint8_t *&  pos,
const boost::uint8_t *  end,
Global_as gl 
) [inline]

Construct a Reader with pointers into an AMF buffer.

You can use the amf::Reader in combination with other reads on the data as long as the read position is never moved after end.

Parameters:
posThe read position in the buffer. This is moved after every read to point to the next data field. You must ensure that pos is not greater than end on every read.
endThe end of the buffer.
glA global reference for creating objects when necessary.

Member Function Documentation

bool gnash::amf::Reader::operator() ( as_value val,
Type  t = NOTYPE 
)

Create a type from current position in the AMF buffer.

Parameters:
valAn as_value to be created from the AMF data.
typeThe type of the data to read.
Returns:
false if this read failed for any reason. The constructed as_value is then invalid. True if the read succeeded and the as_value is valid.

References gnash::amf::NOTYPE, _, gnash::amf::BOOLEAN_AMF0, gnash::amf::readBoolean(), gnash::amf::STRING_AMF0, gnash::amf::readString(), gnash::amf::LONG_STRING_AMF0, gnash::amf::readLongString(), gnash::amf::NUMBER_AMF0, gnash::amf::readNumber(), gnash::amf::UNSUPPORTED_AMF0, gnash::amf::UNDEFINED_AMF0, gnash::amf::NULL_AMF0, gnash::amf::REFERENCE_AMF0, gnash::amf::OBJECT_AMF0, gnash::amf::ECMA_ARRAY_AMF0, gnash::amf::STRICT_ARRAY_AMF0, gnash::amf::DATE_AMF0, gnash::amf::XML_OBJECT_AMF0, and gnash::key::e.


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