Gnash  0.8.11dev
external.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2010, 2011, 2012, 2014, 2016 Free Software Foundation, Inc
3 //
4 // This program is free software; you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation; either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 //
18 
19 #ifndef GNASH_PLUGIN_EXTERNAL_H
20 #define GNASH_PLUGIN_EXTERNAL_H
21 
22 #ifdef HAVE_CONFIG_H
23 #include "gnashconfig.h"
24 #endif
25 
26 #include <memory>
27 #include <string>
28 #include <vector>
29 #include <map>
30 
31 #include "npapi.h"
32 #include "npruntime.h"
33 
34 #include "pluginScriptObject.h"
35 
36 namespace gnash {
37 
38 namespace plugin {
39 
41 {
42  typedef struct {
43  std::string name;
44  std::string type;
45  std::vector<GnashNPVariant> args;
46  } invoke_t;
47 
48  // Create an Invoke message for the standalone Gnash
49  static std::string makeInvoke (const std::string &method, std::vector<std::string> args);
50 
51  static std::string makeNull ();
52  static std::string makeTrue ();
53  static std::string makeFalse ();
54  static std::string makeString (const std::string &str);
55  static std::string makeProperty (const std::string &str, const std::string &data);
56  static std::string makeProperty (const std::string &str, double num);
57  static std::string makeProperty (const std::string &str, int num);
58  static std::string makeNumber (double num);
59  static std::string makeNumber (int num);
60  static std::string makeNumber (unsigned int num);
61  static std::string makeArray (std::vector<std::string> &args);
62  static std::string makeObject (std::map<std::string, std::string> &args);
63 
64  static GnashNPVariant parseXML(GnashPluginScriptObject *scriptobj, const std::string &xml);
65  static std::shared_ptr<invoke_t> parseInvoke(GnashPluginScriptObject *scriptobj, const std::string &xml);
66 
67  static std::map<std::string, GnashNPVariant> parseProperties(GnashPluginScriptObject *scriptobj, const std::string &xml);
68  static std::vector<GnashNPVariant> parseArguments(GnashPluginScriptObject *scriptobj, const std::string &xml);
69  static std::string convertNPVariant (const NPVariant *npv);
70 };
71 
72 }
73 }
74 
75 #endif // GNASH_PLUGIN_EXTERNAL_H
76 
77 // local Variables:
78 // mode: C++
79 // indent-tabs-mode: nil
80 // End:
std::vector< GnashNPVariant > args
Definition: external.h:45
static std::string makeNull()
Definition: external.cpp:66
static std::vector< GnashNPVariant > parseArguments(GnashPluginScriptObject *scriptobj, const std::string &xml)
Definition: external.cpp:430
std::string type
Definition: external.h:44
static std::string makeString(const std::string &str)
Definition: external.cpp:96
SimpleBuffer data
Definition: LocalConnection_as.cpp:151
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
static std::string makeNumber(double num)
Definition: external.cpp:133
Definition: pluginScriptObject.h:57
static std::string makeInvoke(const std::string &method, std::vector< std::string > args)
Definition: external.cpp:43
static std::string makeArray(std::vector< std::string > &args)
Definition: external.cpp:163
static std::string makeProperty(const std::string &str, const std::string &data)
Definition: external.cpp:123
Definition: external.h:40
static std::map< std::string, GnashNPVariant > parseProperties(GnashPluginScriptObject *scriptobj, const std::string &xml)
Definition: external.cpp:402
std::string name
Definition: external.h:43
static std::string makeTrue()
Definition: external.cpp:76
static std::string makeFalse()
Definition: external.cpp:86
static std::shared_ptr< invoke_t > parseInvoke(GnashPluginScriptObject *scriptobj, const std::string &xml)
Definition: external.cpp:203
static std::string convertNPVariant(const NPVariant *npv)
Definition: external.cpp:369
static GnashNPVariant parseXML(GnashPluginScriptObject *scriptobj, const std::string &xml)
Definition: external.cpp:266
static std::string makeObject(std::map< std::string, std::string > &args)
Definition: external.cpp:181
This class holds ownership of (a copy of) an NPVariant.
Definition: GnashNPVariant.h:115