Gnash  0.8.11dev
external.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2010, 2011, 2012 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 <string>
27 #include <vector>
28 #include <map>
29 #include <boost/shared_ptr.hpp>
30 
31 #include "npapi.h"
32 #include "npruntime.h"
33 
34 #include "GnashNPVariant.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(const std::string &xml);
65  static boost::shared_ptr<invoke_t> parseInvoke(const std::string &xml);
66 
67  static std::map<std::string, GnashNPVariant> parseProperties(const std::string &xml);
68  static std::vector<GnashNPVariant> parseArguments(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: