ROSE  0.9.10.54
Functions | Variables
CommandlineProcessing Namespace Reference

Description

Command line processing utility functions. Functions in this namespace are in the ROSE Utilities library and.

Functions

ROSE_UTIL_API std::vector< std::string > generateArgListFromString (std::string commandline)
 Separate a string into individual parameters and store them into a string vector.
 
ROSE_UTIL_API std::string generateStringFromArgList (const std::vector< std::string > &argList)
 Convert a vector of string to a single string.
 
ROSE_UTIL_API std::vector< std::string > generateArgListFromArgcArgv (int argc, const char *argv[])
 Convert an argc-argv pair into a string vector.
 
std::vector< std::string > generateArgListFromArgcArgv (int argc, char *argv[])
 
ROSE_UTIL_API void generateArgcArgvFromList (std::vector< std::string > argList, int &argc, char **&argv)
 Convert a string vector back to an argc-argv pair.
 
ROSE_UTIL_API std::vector< std::string > generateOptionList (const std::vector< std::string > &argList, std::string inputPrefix)
 Looks for inputPrefix prefixed options. More...
 
ROSE_UTIL_API std::vector< std::string > generateOptionListWithDeclaredParameters (const std::vector< std::string > &argList, std::string inputPrefix)
 Looks for inputPrefix-prefixed options. More...
 
ROSE_UTIL_API std::vector< std::string > generateOptionWithNameParameterList (std::vector< std::string > &argList, std::string inputPrefix, std::string newPrefix="")
 Find all options matching 'inputPrefix:optionName' || 'inputPrefix:optionName optionValue' from argList, strip off 'inputPrefix:' or replace it by 'newPrefix' if provided. More...
 
ROSE_UTIL_API bool isOption (std::vector< std::string > &argv, std::string optionPrefix, std::string Option, bool removeOption)
 Search 'argv' for an option like optionPrefixOption, remove the option if 'removeOption' is true. e.g. isOption(argv,"-rose:","(C99|C99_only)",false) More...
 
ROSE_UTIL_API bool isOptionWithParameter (std::vector< std::string > &argv, std::string optionPrefix, std::string Option, int &optionParameter, bool removeOption)
 Search 'argv' for 'optionPrefixOption value', store the integer value into 'optionParameter'. More...
 
ROSE_UTIL_API bool isOptionWithParameter (std::vector< std::string > &argv, std::string optionPrefix, std::string Option, float &optionParameter, bool removeOption)
 Search 'argv' for 'optionPrefixOption value', store the float value into 'optionParameter'. Remove the original option if 'removeOption' is true.
 
ROSE_DLL_API bool isOptionWithParameter (std::vector< std::string > &argv, std::string optionPrefix, std::string Option, std::string &optionParameter, bool removeOption)
 Search 'argv' for 'optionPrefixOption value', store the string type value into 'optionParameter'. Remove the original option if 'removeOption' is true.
 
ROSE_UTIL_API void addListToCommandLine (std::vector< std::string > &argv, std::string prefix, std::vector< std::string > argList)
 Add the strings in argList to the command line represented by argc and argv, prepend 'prefix' to each of the arguments.
 
ROSE_UTIL_API void removeArgs (std::vector< std::string > &argv, std::string prefix)
 Remove all options matching a specified prefix 'prefix' from the argument list 'argv'.
 
ROSE_UTIL_API void removeArgsWithParameters (std::vector< std::string > &argv, std::string prefix)
 Remove all options matching a specified prefix 'prefix' from the argument list 'argv', as well as the option values following them.
 
ROSE_UTIL_API void removeAllFileNamesExcept (std::vector< std::string > &argv, std::vector< std::string > filenameList, std::string exceptFilename)
 Remove file names specified in filenameList from argv, except for 'exceptFilename'.
 
ROSE_UTIL_API std::string generateStringFromArgList (std::vector< std::string > argList, bool skipInitialEntry, bool skipSourceFiles)
 Build a string from the argList.
 
ROSE_DLL_API std::vector< std::string > generateSourceFilenames (std::vector< std::string > argList, bool binaryMode)
 Build the list of isolated file names from the command line.
 
ROSE_UTIL_API void addSourceFileSuffix (const std::string &suffix)
 Add another valid source file suffix.
 
ROSE_UTIL_API void addCppSourceFileSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isSourceFilename (std::string name)
 
ROSE_UTIL_API bool isObjectFilename (std::string name)
 
ROSE_DLL_API bool isExecutableFilename (std::string name)
 
ROSE_DLL_API bool isValidFileWithExecutableFileSuffixes (std::string name)
 
ROSE_UTIL_API bool isCFileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isUPCFileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isCppFileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isFortranFileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isFortranFileNameSuffixRequiringCPP (const std::string &suffix)
 
ROSE_UTIL_API bool isFortran77FileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isFortran90FileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isFortran95FileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isFortran2003FileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isFortran2008FileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isCoArrayFortranFileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isPHPFileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isPythonFileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isCsharpFileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isAdaFileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isJovialFileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isCobolFileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isCudaFileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isOpenCLFileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isJavaFileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API bool isX10FileNameSuffix (const std::string &suffix)
 
ROSE_UTIL_API void initSourceFileSuffixList ()
 
ROSE_UTIL_API void initObjectFileSuffixList ()
 
ROSE_DLL_API void initExecutableFileSuffixList ()
 
ROSE_DLL_API bool isOptionTakingSecondParameter (std::string argument)
 
ROSE_DLL_API bool isOptionTakingThirdParameter (std::string argument)
 

Variables

std::vector< std::string > extraCppSourceFileSuffixes
 

Function Documentation

ROSE_UTIL_API std::vector<std::string> CommandlineProcessing::generateOptionList ( const std::vector< std::string > &  argList,
std::string  inputPrefix 
)

Looks for inputPrefix prefixed options.

Push the stripped-off option in the result list. Warning: As opposed to what the former documentation was saying this function doesn't modify argList.

ROSE_UTIL_API std::vector<std::string> CommandlineProcessing::generateOptionListWithDeclaredParameters ( const std::vector< std::string > &  argList,
std::string  inputPrefix 
)

Looks for inputPrefix-prefixed options.

Push the stripped-off option in the result list. If isOptionTakingSecondParameter of the inputPrefix-prefixed returns true, add the parameter(s) to the result list.

ROSE_UTIL_API std::vector<std::string> CommandlineProcessing::generateOptionWithNameParameterList ( std::vector< std::string > &  argList,
std::string  inputPrefix,
std::string  newPrefix = "" 
)

Find all options matching 'inputPrefix:optionName' || 'inputPrefix:optionName optionValue' from argList, strip off 'inputPrefix:' or replace it by 'newPrefix' if provided.

Returns a string list of matched options. All matching options and values are removed from argList.

ROSE_UTIL_API bool CommandlineProcessing::isOption ( std::vector< std::string > &  argv,
std::string  optionPrefix,
std::string  Option,
bool  removeOption 
)

Search 'argv' for an option like optionPrefixOption, remove the option if 'removeOption' is true. e.g. isOption(argv,"-rose:","(C99|C99_only)",false)

The argument 'option' adds () to the actual option, and allows the |(OR) operations.For example: CommandlineProcessing::isOption(argv,"-rose:","(skip_syntax_check)",true) CommandlineProcessing::isOption(argv,"-rose:","(C99|C99_only)",false)

ROSE_UTIL_API bool CommandlineProcessing::isOptionWithParameter ( std::vector< std::string > &  argv,
std::string  optionPrefix,
std::string  Option,
int &  optionParameter,
bool  removeOption 
)

Search 'argv' for 'optionPrefixOption value', store the integer value into 'optionParameter'.

Remove the original option if 'removeOption' is true. Available value types are: str, float, double, int, short, long, unsigned int, unsigned short, unsigned long, char, etc.