Public Member Functions

gnash::amf::Reader Class Reference

Deserialize an AMF buffer to as_values. More...

#include <AMFConverter.h>

Collaboration diagram for gnash::amf::Reader:
Collaboration graph
[legend]

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:
pos The 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.
end The end of the buffer.
gl A 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:
val An as_value to be created from the AMF data.
type The 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.

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