From efd20ea643e2ab2fc81ca2e7ef931ea8d63a2f26 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 24 Jul 2008 12:01:23 +0000 Subject: [PATCH] Added --format extname and --plugin pluginname extensions, and improved formating --- applications/osgconv/PluginQuery.cpp | 76 ++++++++++++++++++++++++++++ applications/osgconv/PluginQuery.h | 2 + applications/osgconv/osgconv.cpp | 54 ++++++-------------- 3 files changed, 94 insertions(+), 38 deletions(-) diff --git a/applications/osgconv/PluginQuery.cpp b/applications/osgconv/PluginQuery.cpp index 6bb4f0c5b..ee208b9f6 100644 --- a/applications/osgconv/PluginQuery.cpp +++ b/applications/osgconv/PluginQuery.cpp @@ -69,3 +69,79 @@ bool osgDB::queryPlugin(const std::string& fileName, ReaderWriterInfoList& infoL return false; } } + +static std::string padwithspaces(const std::string& str, unsigned int padLength) +{ + std::string newStr(str); + while(newStr.length()first.length()>longestOptionLength) longestOptionLength = fdm_itr->first.length(); + } + + for(fdm_itr = info.extensions.begin(); + fdm_itr != info.extensions.end(); + ++fdm_itr) + { + if (fdm_itr->first.length()>longestOptionLength) longestOptionLength = fdm_itr->first.length(); + } + + for(fdm_itr = info.options.begin(); + fdm_itr != info.options.end(); + ++fdm_itr) + { + if (fdm_itr->first.length()>longestOptionLength) longestOptionLength = fdm_itr->first.length(); + } + + unsigned int padLength = longestOptionLength+4; + + for(fdm_itr = info.protocols.begin(); + fdm_itr != info.protocols.end(); + ++fdm_itr) + { + out<<" protocol : "<first, padLength)<second<first, padLength-1)<second<first, padLength)<second< > ReaderWriterInfoList; bool queryPlugin(const std::string& fileName, ReaderWriterInfoList& infoList); +bool outputPluginDetails(std::ostream& out, const std::string& fileName); + } #endif diff --git a/applications/osgconv/osgconv.cpp b/applications/osgconv/osgconv.cpp index 84b8d1b5e..6e261cb1b 100644 --- a/applications/osgconv/osgconv.cpp +++ b/applications/osgconv/osgconv.cpp @@ -537,6 +537,21 @@ int main( int argc, char **argv ) return 0; } + std::string plugin; + if (arguments.read("--plugin", plugin)) + { + osgDB::outputPluginDetails(std::cout, plugin); + return 0; + } + + std::string ext; + if (arguments.read("--format", ext)) + { + plugin = osgDB::Registry::instance()->createLibraryNameForExtension(ext); + osgDB::outputPluginDetails(std::cout, plugin); + return 0; + } + if (arguments.read("--formats")) { osgDB::FileNameList plugins = osgDB::listAllAvailablePlugins(); @@ -544,43 +559,7 @@ int main( int argc, char **argv ) itr != plugins.end(); ++itr) { - std::cout<<"Plugin "<<*itr<first<<"\t"<second<first<<"\t"<second<first<<"\t"<second<setOptions(options); } - std::string ext; while (arguments.read("-e",ext)) { std::string libName = osgDB::Registry::instance()->createLibraryNameForExtension(ext);