Include program counter on action limit notification log
[gnash.git] / libcore / ExternalInterface.h
blobd640fe23e2aa082237c49c272428260edd08ee70
1 // ExternalInterface.h: ActionScript "ExternalInterface" support
2 //
3 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
4 // Foundation, Inc
5 //
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
24 #include <string>
25 #include <vector>
26 #include <map>
27 #include <set>
28 #include <boost/shared_ptr.hpp>
30 #include "dsodefs.h" /* For DSOEXPORT */
32 namespace gnash {
33 class as_object;
34 class as_value;
35 struct ObjectURI;
36 class Global_as;
37 class movie_root;
38 class IOChannel;
41 namespace gnash {
43 struct DSOEXPORT ExternalInterface
45 struct DSOLOCAL invoke_t {
46 std::string name;
47 std::string type;
48 std::vector<as_value> args;
51 /// Convert an AS object to an XML string.
52 static std::string toXML(const as_value &obj) {
53 ExternalInterface ei;
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);
77 private:
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
88 #endif
90 // local Variables:
91 // mode: C++
92 // indent-tabs-mode: nil
93 // End: