X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;ds=sidebyside;f=appli%2Fexamples%2Fexample_LoadPlugins.cxx;h=d090d38318e718f877c5726f5f28ff3affa85d46;hb=c3c3da5217b6eb255db9c0424f22d4e01250901e;hp=4bc43d041b427914bbcc00ed2ac73b593316a357;hpb=cb833d2fface96e020fe91584d2206860a8174ee;p=cpPlugins.git diff --git a/appli/examples/example_LoadPlugins.cxx b/appli/examples/example_LoadPlugins.cxx index 4bc43d0..d090d38 100644 --- a/appli/examples/example_LoadPlugins.cxx +++ b/appli/examples/example_LoadPlugins.cxx @@ -7,24 +7,27 @@ 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 ) + for( ; cIt != plugins.GetClasses( ).end( ); ++cIt ) std::cout << " := " << cIt->first << std::endl; std::cout << "---------------------------------------------" << std::endl;