Gnash 0.8.9
|
00001 // 00002 // Copyright (C) 2010, 2011 Free Software Foundation, Inc 00003 // 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software 00016 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00017 // 00018 00019 #ifndef GNASH_PLUGIN_EXTERNAL_H 00020 #define GNASH_PLUGIN_EXTERNAL_H 00021 00022 #ifdef HAVE_CONFIG_H 00023 #include "gnashconfig.h" 00024 #endif 00025 00026 #include <string> 00027 #include <sstream> 00028 #include <vector> 00029 #include <map> 00030 #include <boost/shared_ptr.hpp> 00031 #include <boost/scoped_ptr.hpp> 00032 00033 #include "npapi.h" 00034 #include "npruntime.h" 00035 00036 #include "GnashNPVariant.h" 00037 00038 namespace gnash { 00039 00040 namespace plugin { 00041 00042 struct ExternalInterface 00043 { 00044 typedef struct { 00045 std::string name; 00046 std::string type; 00047 std::vector<GnashNPVariant> args; 00048 } invoke_t; 00049 00050 // Create an Invoke message for the standalone Gnash 00051 static std::string makeInvoke (const std::string &method, std::vector<std::string> args); 00052 00053 static std::string makeNull (); 00054 static std::string makeTrue (); 00055 static std::string makeFalse (); 00056 static std::string makeString (const std::string &str); 00057 static std::string makeProperty (const std::string &str, const std::string &data); 00058 static std::string makeProperty (const std::string &str, double num); 00059 static std::string makeProperty (const std::string &str, int num); 00060 static std::string makeNumber (double num); 00061 static std::string makeNumber (int num); 00062 static std::string makeNumber (unsigned int num); 00063 static std::string makeArray (std::vector<std::string> &args); 00064 static std::string makeObject (std::map<std::string, std::string> &args); 00065 00066 static GnashNPVariant parseXML(const std::string &xml); 00067 static boost::shared_ptr<invoke_t> parseInvoke(const std::string &xml); 00068 00069 static std::map<std::string, GnashNPVariant> parseProperties(const std::string &xml); 00070 static std::vector<GnashNPVariant> parseArguments(const std::string &xml); 00071 static std::string convertNPVariant (const NPVariant *npv); 00072 }; 00073 00074 } 00075 } 00076 00077 #endif // GNASH_PLUGIN_EXTERNAL_H 00078 00079 // local Variables: 00080 // mode: C++ 00081 // indent-tabs-mode: nil 00082 // End: