1 // ExternalInterface.h: ActionScript "ExternalInterface" support
3 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 #ifndef GNASH_EXTERNALINTERFACE_H
22 #define GNASH_EXTERNALINTERFACE_H
28 #include <boost/shared_ptr.hpp>
30 #include "dsodefs.h" /* For DSOEXPORT */
43 struct DSOEXPORT ExternalInterface
45 struct DSOLOCAL invoke_t
{
48 std::vector
<as_value
> args
;
51 /// Convert an AS object to an XML string.
52 static std::string
toXML(const as_value
&obj
) {
54 return ei
._toXML(obj
);
57 static as_value
parseXML(const std::string
&xml
);
58 static std::vector
<as_value
> parseArguments(const std::string
&xml
);
60 // Parse the XML Invoke message.
61 static boost::shared_ptr
<invoke_t
> parseInvoke(const std::string
&str
);
62 // Check for data from the browser and parse it.
63 DSOEXPORT
static boost::shared_ptr
<invoke_t
> ExternalEventCheck(int fd
);
65 // These methods are for constructing Invoke messages.
66 // Create an Invoke message for the standalone Gnash
67 DSOEXPORT
static std::string
makeInvoke (const std::string
&method
,
68 const std::vector
<as_value
> &args
);
70 static std::string
makeString (const std::string
&str
) {
71 return "<string>" + str
+ "</string>";
74 DSOEXPORT
static size_t writeBrowser(int fd
, const std::string
&xml
);
75 DSOEXPORT
static std::string
readBrowser(int fd
);
79 DSOEXPORT
std::string
_toXML(const as_value
&obj
);
80 DSOEXPORT
std::string
_objectToXML(as_object
* obj
);
81 DSOEXPORT
std::string
_arrayToXML(as_object
*obj
);
83 std::set
<as_object
*> _visited
;
86 } // end of gnash namespace
92 // indent-tabs-mode: nil