Gnash
0.8.11dev
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
libcore
AMFConverter.h
Go to the documentation of this file.
1
//
2
// Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3
// Free Software Foundation, Inc
4
//
5
// This program is free software; you can redistribute it and/or modify
6
// it under the terms of the GNU General Public License as published by
7
// the Free Software Foundation; either version 3 of the License, or
8
// (at your option) any later version.
9
//
10
// This program is distributed in the hope that it will be useful,
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
// GNU General Public License for more details.
14
//
15
// You should have received a copy of the GNU General Public License
16
// along with this program; if not, write to the Free Software
17
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19
20
#ifndef GNASH_AMFCONVERTER_H
21
#define GNASH_AMFCONVERTER_H
22
23
#include <map>
24
#include <string>
25
#include <vector>
26
27
#include "
dsodefs.h
"
28
#include "
AMF.h
"
29
30
namespace
gnash {
31
class
as_object;
32
class
as_value;
33
class
SimpleBuffer;
34
class
Global_as;
35
}
36
37
namespace
gnash {
38
40
//
44
namespace
amf {
45
47
//
50
//
55
class
Writer
56
{
57
public
:
58
59
typedef
std::map<as_object*, size_t>
OffsetTable
;
60
61
Writer
(
SimpleBuffer
& buf,
bool
strictArray =
false
)
62
:
63
_buf(buf),
64
_strictArray(strictArray)
65
{}
66
68
//
70
bool
writeObject
(
as_object
* obj);
71
73
//
75
bool
writeString
(
const
std::string& str);
76
78
bool
writeNull
();
79
81
bool
writeUndefined
();
82
84
bool
writeNumber
(
double
d
);
85
87
bool
writeBoolean
(
bool
b
);
88
90
//
92
bool
writePropertyName
(
const
std::string& name);
93
95
void
writeData
(
const
boost::uint8_t*
data
,
size_t
length
);
96
97
private
:
98
99
OffsetTable
_offsets;
100
SimpleBuffer
& _buf;
101
bool
_strictArray;
102
103
};
104
105
107
//
111
//
115
//
121
class
Reader
122
{
123
public
:
124
126
//
129
//
135
Reader
(
const
boost::uint8_t*& pos,
const
boost::uint8_t*
end
,
Global_as
& gl)
136
:
137
_pos(pos),
138
_end(end),
139
_global(gl)
140
{}
141
143
//
149
bool
operator()
(
as_value
& val,
Type
t
=
NOTYPE
);
150
151
private
:
152
154
as_value
readXML();
155
157
as_value
readDate();
158
160
as_value
readObject();
161
163
as_value
readReference();
164
166
as_value
readArray();
167
169
as_value
readStrictArray();
170
172
std::vector<as_object*> _objectRefs;
173
175
const
boost::uint8_t*& _pos;
176
178
const
boost::uint8_t*
const
_end;
179
181
Global_as
& _global;
182
183
};
184
185
}
// namespace amf
186
}
// namespace gnash
187
188
#endif
Generated on Wed Jan 22 2014 22:47:18 for Gnash by
1.8.1.2