X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=appli%2Fexamples%2Fexample_LoadPlugins.cxx;h=d090d38318e718f877c5726f5f28ff3affa85d46;hb=2553991938011b002691361f0ed4ae95a552a686;hp=383c85b6cbf07b79d3049462af4d8785323abecc;hpb=b007dfbd638db86c5e8da53299da58f4c9d9e8b8;p=cpPlugins.git diff --git a/appli/examples/example_LoadPlugins.cxx b/appli/examples/example_LoadPlugins.cxx index 383c85b..d090d38 100644 --- a/appli/examples/example_LoadPlugins.cxx +++ b/appli/examples/example_LoadPlugins.cxx @@ -7,25 +7,28 @@ int main( int argc, char* argv[] ) { if( argc < 2 ) { - std::cerr << "Usage: " << argv[ 0 ] << " plugins_file" << std::endl; + std::cerr << "Usage: " << argv[ 0 ] << " plugins_file(s)" << std::endl; return( 1 ); } // fi - std::string plugins_file = argv[ 1 ]; // Create interface typedef cpPlugins::Interface::Interface TInterface; typedef TInterface::TClasses TClasses; TInterface plugins; - plugins.Load( plugins_file ); + for( int i = 1; i < argc; ++i ) + if( !plugins.Load( argv[ i ] ) ) + std::cerr + << "Error loading plugins file \"" + << argv[ i ] << "\"" + << std::endl; std::cout << "---------------------------------------------" << std::endl; std::cout << "Loaded classes:" << std::endl; TClasses::const_iterator cIt = plugins.GetClasses( ).begin( ); - TClasses::const_iterator end_cIt = plugins.GetClasses( ).end( ); - for( ; cIt != end_cIt; ++cIt ) - std::cout << "\t:= " << cIt->first << std::endl; + for( ; cIt != plugins.GetClasses( ).end( ); ++cIt ) + std::cout << " := " << cIt->first << std::endl; std::cout << "---------------------------------------------" << std::endl; return( 0 );