Changeset 5909 for branches/newapi
- Timestamp:
- 12/02/07 20:06:43 (12 months ago)
- Location:
- branches/newapi/licq/src
- Files:
-
- 9 modified
-
CMakeLists.txt (modified) (1 diff)
-
daemon.cpp (modified) (6 diffs)
-
daemon.h (modified) (1 diff)
-
plugin/plugincache.h (modified) (2 diffs)
-
plugin/plugincacheimpl.cpp (modified) (3 diffs)
-
plugin/plugincacheimpl.h (modified) (3 diffs)
-
plugin/pluginmanager.h (modified) (3 diffs)
-
plugin/pluginmanagerimpl.h (modified) (3 diffs)
-
plugin/test/plugincachetest.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/newapi/licq/src/CMakeLists.txt
r5820 r5909 2 2 daemon.cpp 3 3 main.cpp 4 static.cpp 4 5 5 6 # backgroundcodes.c -
branches/newapi/licq/src/daemon.cpp
r5897 r5909 23 23 #include "licq/exception/unixexception.h" 24 24 #include "licq/version.h" 25 #include "plugin/plugincacheimpl.h" 26 #include "plugin/pluginloaderimpl.h" 27 #include "plugin/pluginmanagerimpl.h" 25 #include "plugin/plugincache.h" 26 #include "plugin/pluginmanager.h" 28 27 #include "util/streamlogsink.h" 29 28 #include "util/support.h" … … 91 90 : myLog(*Log::getThreadLog()) 92 91 { 93 myPluginLoader = new PluginLoaderImpl(); 94 myPluginCache = new PluginCacheImpl(myLog, *myPluginLoader); 95 myPluginManager = new PluginManagerImpl(*myPluginCache); 92 // Empty 96 93 } 97 94 98 95 LicqDaemon::Daemon::~Daemon() 99 96 { 100 delete myPluginManager; 101 delete myPluginCache; 102 delete myPluginLoader; 97 // Empty 103 98 } 104 99 … … 204 199 std::vector< boost::shared_ptr<const Licq::Plugin::Information> >* info) 205 200 { 206 myPluginManager->getPluginInformation(info);201 PluginManager::getInstance()->getPluginInformation(info); 207 202 } 208 203 … … 241 236 void LicqDaemon::Daemon::setupDefaultPluginPaths(bool reload) 242 237 { 243 myPluginCache->addSearchPath(myBaseDir + ".plugins/"); 238 PluginCache* cache = PluginManager::getInstance()->getPluginCache(); 239 cache->addSearchPath(myBaseDir + ".plugins/"); 244 240 245 241 if (reload) 246 myPluginCache->reload();242 cache->reload(); 247 243 } 248 244 … … 251 247 setupDefaultPluginPaths(false); 252 248 249 PluginCache* cache = PluginManager::getInstance()->getPluginCache(); 253 250 for (std::vector<std::string>::const_iterator it = paths.begin(); 254 251 it != paths.end(); ++it) 255 252 { 256 myPluginCache->addSearchPath(*it);257 } 258 259 myPluginCache->reload();253 cache->addSearchPath(*it); 254 } 255 256 cache->reload(); 260 257 } 261 258 262 259 void LicqDaemon::Daemon::printAvailablePlugins(std::ostream& os) const 263 260 { 264 const size_t size = myPluginCache->getSize(); 261 PluginCache* cache = PluginManager::getInstance()->getPluginCache(); 262 263 const size_t size = cache->getSize(); 265 264 if (size == 0) 266 265 { 267 os << "No plugins found.\n";266 os << tr("No plugins found.") << "\n"; 268 267 return; 269 268 } … … 272 271 { 273 272 boost::shared_ptr<const Licq::Plugin::Information> info = 274 myPluginCache->getInformation(i);273 cache->getInformation(i); 275 274 276 275 if (i != 0) -
branches/newapi/licq/src/daemon.h
r5897 r5909 52 52 53 53 private: 54 Log& myLog; 55 56 class PluginLoader* myPluginLoader; 57 class PluginCache* myPluginCache; 58 class PluginManager* myPluginManager; 54 Licq::Log& myLog; 59 55 60 56 std::string myBaseDir; -
branches/newapi/licq/src/plugin/plugincache.h
r5608 r5909 37 37 { 38 38 public: 39 virtual ~PluginCache() {}40 41 39 virtual bool addSearchPath(const std::string& path) = 0; 42 40 virtual void reload() = 0; … … 50 48 virtual boost::shared_ptr<const Licq::Plugin::Information> 51 49 getInformation(size_t index) = 0; 50 51 protected: 52 virtual ~PluginCache() { /* Empty */ } 52 53 }; 53 54 -
branches/newapi/licq/src/plugin/plugincacheimpl.cpp
r5807 r5909 25 25 #include "plugin/pluginlibrary.h" 26 26 #include "plugin/pluginloader.h" 27 #include "util/log.h" 27 28 #include "util/support.h" 28 29 #include "util/tr.h" … … 102 103 } 103 104 104 LicqDaemon::PluginCacheImpl::PluginCacheImpl(Licq::Log& log, 105 PluginLoader& loader, 105 LicqDaemon::PluginCacheImpl::PluginCacheImpl(PluginLoader& loader, 106 106 bool testMode) 107 : myLog(log), myLoader(loader), myInTestMode(testMode) 107 : myLog(*Log::getThreadLog()), 108 myLoader(loader), 109 myInTestMode(testMode) 108 110 { 109 111 // Empty … … 225 227 catch (const bfs::filesystem_error&) 226 228 { 227 // Empty229 // Empty 228 230 } 229 231 } -
branches/newapi/licq/src/plugin/plugincacheimpl.h
r5797 r5909 21 21 #define LICQDAEMON_PLUGINCACHEIMPL_H 22 22 23 #include "licq/interface/log.h"24 23 #include "plugin/plugincache.h" 25 24 … … 48 47 * @param[in] loader The PluginLoader to use to load plugins. 49 48 */ 50 PluginCacheImpl( Licq::Log& log,PluginLoader& loader, bool testMode = false);49 PluginCacheImpl(PluginLoader& loader, bool testMode = false); 51 50 52 51 /** … … 145 144 void clearCache(); 146 145 147 Licq::Log& myLog;146 class Licq::Log& myLog; 148 147 PluginLoader& myLoader; 149 148 const bool myInTestMode; -
branches/newapi/licq/src/plugin/pluginmanager.h
r5354 r5909 23 23 #include "licq/interface/plugin.h" 24 24 25 #include <boost/noncopyable.hpp> 25 26 #include <boost/shared_ptr.hpp> 26 27 #include <vector> … … 34 35 { 35 36 37 class PluginCache; 38 36 39 /** 37 40 * An abstract interface to ease unit testing. Please refer to 38 41 * PluginManagerImpl for the real documentation. 39 42 */ 40 class PluginManager 43 class PluginManager : private boost::noncopyable 41 44 { 42 45 public: 43 virtual ~PluginManager() {} 46 /** 47 * @returns The PluginManager singleton. 48 */ 49 static PluginManager* getInstance(); 44 50 45 51 virtual void getPluginInformation( … … 50 56 Licq::LogSink& sink, 51 57 int argc, char** argv) = 0; 58 59 virtual PluginCache* getPluginCache() const = 0; 60 61 protected: 62 virtual ~PluginManager() { /* Empty */ } 52 63 }; 53 64 -
branches/newapi/licq/src/plugin/pluginmanagerimpl.h
r5354 r5909 28 28 { 29 29 30 class PluginCache;31 30 class PluginInstance; 32 31 … … 48 47 int argc, char** argv); 49 48 49 /** 50 * @returns The plugin cache used. 51 */ 52 PluginCache* getPluginCache() const; 53 50 54 private: 51 55 PluginCache& myCache; … … 58 62 } // namespace LicqDaemon 59 63 64 inline LicqDaemon::PluginCache* 65 LicqDaemon::PluginManagerImpl::getPluginCache() const 66 { 67 return &myCache; 68 } 69 60 70 #endif -
branches/newapi/licq/src/plugin/test/plugincachetest.cpp
r5808 r5909 25 25 #include "plugin/pluginlibrary.h" 26 26 #include "plugin/pluginloader.h" 27 #include "test/log.h"28 27 29 28 #include <boost/filesystem/operations.hpp> … … 125 124 struct PluginCacheFixture 126 125 { 127 PluginCacheFixture() : myCache(myLog, myLoader, true) {} 128 Log myLog; 126 PluginCacheFixture() : myCache(myLoader, true) {} 129 127 MockPluginLoader myLoader; 130 128 LicqDaemon::PluginCacheImpl myCache;
