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

Deserialize an AMF buffer to as_values. More...

#include <AMFConverter.h>

Public Member Functions

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

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

§ Reader()

gnash::amf::Reader::Reader ( const std::uint8_t *&  pos,
const std::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.

References gnash::amf::NOTYPE, and gnash::key::t.

Member Function Documentation

§ operator()()

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

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