#include <iostream>
#include <string>
-#include <cpPlugins/Interface/Plugins.h>
+#include <cpPlugins/Interface/Interface.h>
// -------------------------------------------------------------------------
-typedef cpPlugins::Interface::Plugins TPlugins;
-typedef TPlugins::TStringContainer TStringContainer;
+typedef cpPlugins::Interface::Interface TInterface;
// -------------------------------------------------------------------------
int main( int argc, char* argv[] )
} // fi
- // Create interface
- cpPlugins::Interface::Plugins plugins;
-
- if( !plugins.LoadPluginsPath( argv[ 1 ] ) )
- std::cerr
- << "Error loading plugins from folder \""
- << argv[ 1 ] << "\""
- << std::endl;
-
- const TStringContainer& loaded_plugins = plugins.GetLoadedPlugins( );
- auto pIt = loaded_plugins.begin( );
- for( ; pIt != loaded_plugins.end( ); ++pIt )
- std::cout << "Plugin: " << *pIt << std::endl;
-
- TStringContainer categories;
- plugins.GetLoadedCategories( categories );
- for( auto cIt = categories.begin( ); cIt != categories.end( ); ++cIt )
+ // Create interface and load plugins
+ TInterface interface;
+ interface.LoadFromFolder( argv[ 1 ], true );
+
+ // Show info
+ auto i = interface.GetLoadedPlugins( ).begin( );
+ for( ; i != interface.GetLoadedPlugins( ).end( ); ++i )
{
- std::cout << "Category: " << *cIt << std::endl;
- const TStringContainer& filters = plugins.GetLoadedFilters( *cIt );
- for( auto fIt = filters.begin( ); fIt != filters.end( ); ++fIt )
- std::cout << "\t" << *fIt << std::endl;
+ std::cout << "Folder: " << i->first << std::endl;
+ auto j = i->second.begin( );
+ for( ; j != i->second.end( ); ++j )
+ std::cout << "\tPlugin: " << *j << std::endl;
} // rof
+ // Show loaded classes
+ auto c = interface.GetClasses( ).begin( );
+ for( ; c != interface.GetClasses( ).end( ); ++c )
+ std::cout << "Class -> " << c->first << std::endl;
+
return( 0 );
}