X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2Futils%2Fbamtools_options.cpp;h=565c90e56cdacb1084b6895505947393f788d3e1;hb=9f1ce8c47aeadb6dc1320b52ee671c3341b97935;hp=931fbd8be4740892fe7fbe60db79726d7325bfac;hpb=0180d7256f5c781364b04559b39ed2db41585787;p=bamtools.git diff --git a/src/utils/bamtools_options.cpp b/src/utils/bamtools_options.cpp index 931fbd8..565c90e 100644 --- a/src/utils/bamtools_options.cpp +++ b/src/utils/bamtools_options.cpp @@ -1,9 +1,8 @@ // *************************************************************************** // bamtools_options.cpp (c) 2010 Derek Barnett, Erik Garrison // Marth Lab, Department of Biology, Boston College -// All rights reserved. // --------------------------------------------------------------------------- -// Last modified: 2 June 2010 +// Last modified: 10 October 2011 // --------------------------------------------------------------------------- // Parses command line arguments and creates a help menu // --------------------------------------------------------------------------- @@ -11,33 +10,36 @@ // The Mosaik suite's command line parser class: COptions // (c) 2006 - 2009 Michael Str�mberg // Marth Lab, Department of Biology, Boston College -// Dual licenced under the GNU General Public License 2.0+ license or as -// a commercial license with the Marth Lab. +// Re-licensed under MIT License with author's permission. // // * Modified slightly to fit BamTools, otherwise code is same. // * (BamTools namespace, added stdin/stdout) (DB) // *************************************************************************** -#include "bamtools_options.h" +#include "utils/bamtools_options.h" +using namespace BamTools; + #include #include #include #include #include using namespace std; -using namespace BamTools; string Options::m_programName; // the program name string Options::m_description; // the main description string Options::m_exampleArguments; // the example arguments vector Options::m_optionGroups; // stores the option groups map Options::m_optionsMap; // stores the options in a map -string Options::m_stdin = "stdin"; // string representation of stdin -string Options::m_stdout = "stdout"; // string representation of stdout +const string Options::m_stdin = "stdin"; // string representation of stdin +const string Options::m_stdout = "stdout"; // string representation of stdout // adds a simple option to the parser -void Options::AddOption(const string& argument, const string& optionDescription, bool& foundArgument, OptionGroup* group) { - +void Options::AddOption(const string& argument, + const string& optionDescription, + bool& foundArgument, + OptionGroup* group) +{ Option o; o.Argument = argument; o.Description = optionDescription; @@ -110,7 +112,8 @@ void Options::DisplayHelp(void) { const std::string stringValue = optionIter->DefaultValue; sb << stringValue; } else { - printf("ERROR: Found an unsupported data type for argument %s when casting the default value.\n", optionIter->Argument.c_str()); + printf("ERROR: Found an unsupported data type for argument %s when casting the default value.\n", + optionIter->Argument.c_str()); exit(1); } @@ -231,15 +234,18 @@ void Options::Parse(int argc, char* argv[], int offset) { vector* pVectorValue = (vector*)ovMapIter->second.pValue; pVectorValue->push_back(val); } else { - printf("ERROR: Found an unsupported data type for argument %s when parsing the arguments.\n", argument.c_str()); + printf("ERROR: Found an unsupported data type for argument %s when parsing the arguments.\n", + argument.c_str()); exit(1); } } else { - errorBuilder << ERROR_SPACER << "The argument (" << argument << ") expects a value, but none was found." << endl; + errorBuilder << ERROR_SPACER << "The argument (" << argument + << ") expects a value, but none was found." << endl; foundError = true; } } else { - errorBuilder << ERROR_SPACER << "The argument (" << argument << ") expects a value, but none was found." << endl; + errorBuilder << ERROR_SPACER << "The argument (" << argument + << ") expects a value, but none was found." << endl; foundError = true; } } @@ -249,7 +255,8 @@ void Options::Parse(int argc, char* argv[], int offset) { // check if we missed any required parameters for (ovMapIter = m_optionsMap.begin(); ovMapIter != m_optionsMap.end(); ++ovMapIter) { if (ovMapIter->second.IsRequired && !*ovMapIter->second.pFoundArgument) { - errorBuilder << ERROR_SPACER << ovMapIter->second.ValueTypeDescription << " was not specified. Please use the " << ovMapIter->first << " parameter." << endl; + errorBuilder << ERROR_SPACER << ovMapIter->second.ValueTypeDescription + << " was not specified. Please use the " << ovMapIter->first << " parameter." << endl; foundError = true; } } @@ -264,7 +271,10 @@ void Options::Parse(int argc, char* argv[], int offset) { } // sets the program info -void Options::SetProgramInfo(const string& programName, const string& description, const string& arguments) { +void Options::SetProgramInfo(const string& programName, + const string& description, + const string& arguments) +{ m_programName = programName; m_description = description; m_exampleArguments = arguments;