From Eric Sokolowski and Robert Osfield, moved command line option usage setup

from osgviewer example into osg::ArgumentParser and osgViewer::Viewer to make
them more universally available.
This commit is contained in:
Robert Osfield
2008-05-12 10:55:55 +00:00
parent 61cb0833b9
commit 965c72f5bd
5 changed files with 46 additions and 17 deletions

View File

@@ -43,9 +43,11 @@ class OSG_EXPORT ApplicationUsage : public osg::Referenced
enum Type
{
NO_HELP = 0x0,
COMMAND_LINE_OPTION = 0x1,
ENVIRONMENTAL_VARIABLE = 0x2,
KEYBOARD_MOUSE_BINDING = 0x4
KEYBOARD_MOUSE_BINDING = 0x4,
HELP_ALL = KEYBOARD_MOUSE_BINDING|ENVIRONMENTAL_VARIABLE|COMMAND_LINE_OPTION
};
void addUsageExplanation(Type type,const std::string& option,const std::string& explanation);

View File

@@ -190,6 +190,14 @@ class OSG_EXPORT ArgumentParser
/** Write error messages to the given ostream, if at or above the given severity. */
void writeErrorMessages(std::ostream& output,ErrorSeverity sevrity=BENIGN);
/** This convinience method handles help requests on the command line.
* Return the type(s) of help requested. The return value of this
* function is suitable for passing into getApplicationUsage()->write().
* If ApplicationUsage::NO_HELP is returned then no help commandline option
* was found on the command line. */
ApplicationUsage::Type readHelpType();
protected: