mode.cc
Go to the documentation of this file.
00001 #include "mode.hh"
00002 #include "plugin.hh"
00003 #include <iostream>
00004 
00005 using namespace std;
00006 
00007 Mode::Mode(const std::string& name) 
00008     : m_name(name) {}
00009 
00010 Mode::~Mode() {}
00011 
00012 std::string Mode::getName() const { return m_name; }
00013 
00014 bool Mode::main(int argc, char* const argv[])
00015 {
00016     if (argc > 1 && argv[1] == string("help"))
00017     {
00018         help(cout);
00019         return true;
00020     }
00021     return apply(argc, argv);
00022 }
00023 
00024 list<string> Mode::getPluginNames() const
00025 {
00026     list<string> ret;
00027     for (PluginMap::const_iterator it = m_plugins.begin(); it != m_plugins.end(); ++it)
00028         ret.push_back(it->first);
00029     return ret;
00030 }
00031 Plugin* Mode::getPlugin(const std::string& name) const
00032 { 
00033     PluginMap::const_iterator it = m_plugins.find(name);
00034     return (it == m_plugins.end()) ? 0 : it->second;
00035 }
00036 void    Mode::addPlugin(Plugin* plugin)
00037 { 
00038     string name(plugin->getName());
00039     PluginMap::iterator it = m_plugins.find(name);
00040     if (it != m_plugins.end()) delete it->second;
00041     m_plugins[name] = plugin;
00042 }
00043 
00044 


typelib
Author(s): Sylvain Joyeux/sylvain.joyeux@m4x.org
autogenerated on Thu Jan 2 2014 11:38:41