ROSE  0.9.6a
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CommandlineProcessing Namespace Reference

Functions

ROSE_UTIL_API
Rose_STL_Container
< std::string > 
generateArgListFromString (std::string commandline)
 Separate a string into individual parameters and store them into a string vector. More...
 
ROSE_UTIL_API std::string generateStringFromArgList (const Rose_STL_Container< std::string > &argList)
 Convert a vector of string to a single string. More...
 
ROSE_UTIL_API
Rose_STL_Container
< std::string > 
generateArgListFromArgcArgv (int argc, const char *argv[])
 Convert an argc-argv pair into a string vector. More...
 
Rose_STL_Container< std::string > generateArgListFromArgcArgv (int argc, char *argv[])
 
ROSE_UTIL_API void generateArgcArgvFromList (Rose_STL_Container< std::string > argList, int &argc, char **&argv)
 Convert a string vector back to an argc-argv pair. More...
 
ROSE_UTIL_API
Rose_STL_Container
< std::string > 
generateOptionList (const Rose_STL_Container< std::string > &argList, std::string inputPrefix)
 Looks for inputPrefix prefixed options. More...
 
ROSE_UTIL_API
Rose_STL_Container
< std::string > 
generateOptionListWithDeclaredParameters (const Rose_STL_Container< std::string > &argList, std::string inputPrefix)
 Looks for inputPrefix-prefixed options. More...
 
ROSE_UTIL_API
Rose_STL_Container
< std::string > 
generateOptionWithNameParameterList (Rose_STL_Container< 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. More...
 
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. More...
 
ROSE_UTIL_API void addListToCommandLine (std::vector< std::string > &argv, std::string prefix, Rose_STL_Container< std::string > argList)
 Add the strings in argList to the command line represented by argc and argv, prepend 'prefix' to each of the arguments. More...
 
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'. More...
 
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. More...
 
ROSE_UTIL_API void removeAllFileNamesExcept (std::vector< std::string > &argv, Rose_STL_Container< std::string > filenameList, std::string exceptFilename)
 Remove file names specified in filenameList from argv, except for 'exceptFilename'. More...
 
ROSE_UTIL_API std::string generateStringFromArgList (Rose_STL_Container< std::string > argList, bool skipInitialEntry, bool skipSourceFiles)
 Build a string from the argList. More...
 
ROSE_DLL_API
Rose_STL_Container
< std::string > 
generateSourceFilenames (Rose_STL_Container< std::string > argList, bool binaryMode)
 Build the list of isolated file names from the command line. More...
 
ROSE_UTIL_API void addSourceFileSuffix (const std::string &suffix)
 Add another valid source file suffix. More...
 
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 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

Rose_STL_Container< std::string > extraCppSourceFileSuffixes
 
static Rose_STL_Container
< std::string > 
validSourceFileSuffixes
 
static Rose_STL_Container
< std::string > 
validObjectFileSuffixes
 
static Rose_STL_Container
< std::string > 
validExecutableFileSuffixes
 

Function Documentation

ROSE_UTIL_API Rose_STL_Container<std::string> CommandlineProcessing::generateArgListFromString ( std::string  commandline)

Separate a string into individual parameters and store them into a string vector.

ROSE_UTIL_API std::string CommandlineProcessing::generateStringFromArgList ( const Rose_STL_Container< std::string > &  argList)

Convert a vector of string to a single string.

ROSE_UTIL_API Rose_STL_Container<std::string> CommandlineProcessing::generateArgListFromArgcArgv ( int  argc,
const char *  argv[] 
)

Convert an argc-argv pair into a string vector.

Referenced by generateArgListFromArgcArgv().

Rose_STL_Container<std::string> CommandlineProcessing::generateArgListFromArgcArgv ( int  argc,
char *  argv[] 
)
inline

Definition at line 23 of file commandline_processing.h.

References generateArgListFromArgcArgv().

ROSE_UTIL_API void CommandlineProcessing::generateArgcArgvFromList ( Rose_STL_Container< std::string >  argList,
int &  argc,
char **&  argv 
)

Convert a string vector back to an argc-argv pair.

ROSE_UTIL_API Rose_STL_Container<std::string> CommandlineProcessing::generateOptionList ( const Rose_STL_Container< 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 Rose_STL_Container<std::string> CommandlineProcessing::generateOptionListWithDeclaredParameters ( const Rose_STL_Container< 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 Rose_STL_Container<std::string> CommandlineProcessing::generateOptionWithNameParameterList ( Rose_STL_Container< 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.

ROSE_UTIL_API bool CommandlineProcessing::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 CommandlineProcessing::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 CommandlineProcessing::addListToCommandLine ( std::vector< std::string > &  argv,
std::string  prefix,
Rose_STL_Container< 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 CommandlineProcessing::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 CommandlineProcessing::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 CommandlineProcessing::removeAllFileNamesExcept ( std::vector< std::string > &  argv,
Rose_STL_Container< std::string >  filenameList,
std::string  exceptFilename 
)

Remove file names specified in filenameList from argv, except for 'exceptFilename'.

ROSE_UTIL_API std::string CommandlineProcessing::generateStringFromArgList ( Rose_STL_Container< std::string >  argList,
bool  skipInitialEntry,
bool  skipSourceFiles 
)

Build a string from the argList.

ROSE_DLL_API Rose_STL_Container<std::string> CommandlineProcessing::generateSourceFilenames ( Rose_STL_Container< std::string >  argList,
bool  binaryMode 
)

Build the list of isolated file names from the command line.

ROSE_UTIL_API void CommandlineProcessing::addSourceFileSuffix ( const std::string &  suffix)

Add another valid source file suffix.

ROSE_UTIL_API void CommandlineProcessing::addCppSourceFileSuffix ( const std::string &  suffix)
ROSE_UTIL_API bool CommandlineProcessing::isSourceFilename ( std::string  name)
ROSE_UTIL_API bool CommandlineProcessing::isObjectFilename ( std::string  name)
ROSE_DLL_API bool CommandlineProcessing::isExecutableFilename ( std::string  name)
ROSE_DLL_API bool CommandlineProcessing::isValidFileWithExecutableFileSuffixes ( std::string  name)
ROSE_UTIL_API bool CommandlineProcessing::isCFileNameSuffix ( const std::string &  suffix)
ROSE_UTIL_API bool CommandlineProcessing::isUPCFileNameSuffix ( const std::string &  suffix)
ROSE_UTIL_API bool CommandlineProcessing::isCppFileNameSuffix ( const std::string &  suffix)
ROSE_UTIL_API bool CommandlineProcessing::isFortranFileNameSuffix ( const std::string &  suffix)
ROSE_UTIL_API bool CommandlineProcessing::isFortranFileNameSuffixRequiringCPP ( const std::string &  suffix)
ROSE_UTIL_API bool CommandlineProcessing::isFortran77FileNameSuffix ( const std::string &  suffix)
ROSE_UTIL_API bool CommandlineProcessing::isFortran90FileNameSuffix ( const std::string &  suffix)
ROSE_UTIL_API bool CommandlineProcessing::isFortran95FileNameSuffix ( const std::string &  suffix)
ROSE_UTIL_API bool CommandlineProcessing::isFortran2003FileNameSuffix ( const std::string &  suffix)
ROSE_UTIL_API bool CommandlineProcessing::isFortran2008FileNameSuffix ( const std::string &  suffix)
ROSE_UTIL_API bool CommandlineProcessing::isCoArrayFortranFileNameSuffix ( const std::string &  suffix)
ROSE_UTIL_API bool CommandlineProcessing::isPHPFileNameSuffix ( const std::string &  suffix)
ROSE_UTIL_API bool CommandlineProcessing::isPythonFileNameSuffix ( const std::string &  suffix)
ROSE_UTIL_API bool CommandlineProcessing::isCudaFileNameSuffix ( const std::string &  suffix)
ROSE_UTIL_API bool CommandlineProcessing::isOpenCLFileNameSuffix ( const std::string &  suffix)
ROSE_UTIL_API bool CommandlineProcessing::isJavaFileNameSuffix ( const std::string &  suffix)
ROSE_UTIL_API bool CommandlineProcessing::isX10FileNameSuffix ( const std::string &  suffix)
ROSE_UTIL_API void CommandlineProcessing::initSourceFileSuffixList ( )
ROSE_UTIL_API void CommandlineProcessing::initObjectFileSuffixList ( )
ROSE_DLL_API void CommandlineProcessing::initExecutableFileSuffixList ( )
ROSE_DLL_API bool CommandlineProcessing::isOptionTakingSecondParameter ( std::string  argument)
ROSE_DLL_API bool CommandlineProcessing::isOptionTakingThirdParameter ( std::string  argument)

Variable Documentation

Rose_STL_Container<std::string> CommandlineProcessing::extraCppSourceFileSuffixes
Rose_STL_Container<std::string> CommandlineProcessing::validSourceFileSuffixes
static

Definition at line 128 of file commandline_processing.h.

Rose_STL_Container<std::string> CommandlineProcessing::validObjectFileSuffixes
static

Definition at line 131 of file commandline_processing.h.

Rose_STL_Container<std::string> CommandlineProcessing::validExecutableFileSuffixes
static

Definition at line 134 of file commandline_processing.h.