Gnash  0.8.10
external.h
Go to the documentation of this file.
00001 // 
00002 //   Copyright (C) 2010, 2011, 2012 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 <vector>
00028 #include <map>
00029 #include <boost/shared_ptr.hpp>
00030 
00031 #include "npapi.h"
00032 #include "npruntime.h"
00033 
00034 #include "GnashNPVariant.h"
00035 
00036 namespace gnash {
00037 
00038 namespace plugin {
00039 
00040 struct ExternalInterface
00041 {
00042     typedef struct {
00043         std::string name;
00044         std::string type;
00045         std::vector<GnashNPVariant> args;
00046     } invoke_t;
00047     
00048     // Create an Invoke message for the standalone Gnash
00049     static std::string makeInvoke (const std::string &method, std::vector<std::string> args);
00050     
00051     static std::string makeNull ();
00052     static std::string makeTrue ();
00053     static std::string makeFalse ();
00054     static std::string makeString (const std::string &str);
00055     static std::string makeProperty (const std::string &str, const std::string &data);
00056     static std::string makeProperty (const std::string &str, double num);
00057     static std::string makeProperty (const std::string &str, int num);
00058     static std::string makeNumber (double num);
00059     static std::string makeNumber (int num);
00060     static std::string makeNumber (unsigned int num);
00061     static std::string makeArray (std::vector<std::string> &args);
00062     static std::string makeObject (std::map<std::string, std::string> &args);
00063     
00064     static GnashNPVariant parseXML(const std::string &xml);
00065     static boost::shared_ptr<invoke_t> parseInvoke(const std::string &xml);
00066     
00067     static std::map<std::string, GnashNPVariant> parseProperties(const std::string &xml);
00068     static std::vector<GnashNPVariant> parseArguments(const std::string &xml);
00069     static std::string convertNPVariant (const NPVariant *npv);
00070 };
00071 
00072 }
00073 }
00074 
00075 #endif // GNASH_PLUGIN_EXTERNAL_H
00076 
00077 // local Variables:
00078 // mode: C++
00079 // indent-tabs-mode: nil
00080 // End: