首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >FireBreath多重MIMETypes

FireBreath多重MIMETypes
EN

Stack Overflow用户
提问于 2014-10-16 13:31:05
回答 1查看 59关注 0票数 0

如何将多个MIMETypes添加到我的FireBreath插件中,以及插件如何响应多个MIMETypes。我尝试在Pluginconfig.cmake中添加一个额外的字符串到set(FBSTRING_MIMEType“application/x testplugin”"application/x-test-plugin")中,并运行了失败的prepmac脚本。请在这方面帮助我。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-10-16 16:43:01

来自NOTES.txt的FireBreath回购:

代码语言:javascript
复制
Modified original FBTestPlugin as follows to support multiple mimetypes
in a single codebase:

1.  Edit PluginConfig.cmake, add multiple entries for the following
    entries: FBSTRING_MIMEType, ACTIVEX_PROGID, FBControl_GUID, and
    FBSTRING_PluginDescription.  Make sure that you provide unique values for
    all entries, including the GUIDs in FBControl_GUID.

2.  Edit Factory.cpp, modify PluginFactory::createPlugin() and add code
    to check mimetype and create the appropriate object.  Also add
    "mimetype" as a parameter to
    "boost::make_shared<FBTestPlugin>(mimetype)".  The new code can construct
    the "standard" FBTestPlugin plugin, or a new "SimpleMath" plugin from
    either the FBTestPlugin or FBTestMathPlugin C++ objects.

3.  In FBTestPlugin.h, modify the FBTestPlugin constructor to take
    "const std::string& mimetype" as an argument.  Add "std::string
    m_mimetype;" as a private variable to FBTestPlugin.

4.  In FBTestPlugin.cpp, modify the FBTestPlugin constructor to take
    "const std::string& mimetype" as an argument and to set m_mimetype from
    the mimetype parameter.  Modify createJSAPI() to return 
    "boost::make_shared<SimpleMathAPI>(m_host)"
    instead of 
        "boost::make_shared<FBTestPluginAPI>(FB::ptr_cast<FBTestPlugin>(shared_from_this()), m_host)"
    depending on the mimetype.  Include "SimpleMath.h".
    Modify the plugin text in the drawing code depending on the mimetype for visual feedback to user.

5.  Modify SimpleMathAPI.h and SimpleMathAPI.cpp to add "self" property
    and "GetSelf()" method, both of which return shared_from_this().

6.  Copy FBTestPlugin.* to FBTestMathPlugin.* and change object name.
    Simplify FBTestMathPlugin by removing the LeakFinder.  Modify
    createJSAPI() to return only the SimpleMathAPI object.  Modify the
    plugin text in the drawing code for visual feedback to user.

7.  Modified test code in test.html to test multiple mimetypes.  Create
    three plugins, and test math functions using all three.
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26405772

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档