Gnash
0.8.10
|
Deserialize an AMF buffer to as_values. More...
#include <AMFConverter.h>
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. |
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.
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.
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. |
Create a type from current position in the AMF buffer.
val | An as_value to be created from the AMF data. |
type | The type of the data to read. |
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.