Skip to content

CommandlineProcessing

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

Types

Name

Description

ArgvStorage

RAII storage for argv‐style arguments without heap allocation.

Functions

Name

Description

addCppSourceFileSuffix
void addCppSourceFileSuffix(std::string const& suffix);

Add another valid source file suffix.

addListToCommandLine
void addListToCommandLine(std::vector<std::string>& argv, std::string prefix, std::vector<std::string> argList);

Add the strings in argList to the command line.

deleteArgcArgv
void deleteArgcArgv(int argc, char** argv);

Release argv allocated by generateArgcArgvFromList.

generateArgListFromArgcArgv
std::vector<std::string> generateArgListFromArgcArgv(int argc, char* argv[]);

Convert an argc‐argv pair into a string vector.

generateArgListFromString
std::vector<std::string> generateArgListFromString(std::string commandline);

Separate a string into individual parameters.

generateArgcArgvFromList
void generateArgcArgvFromList(std::vector<std::string> argList, int& argc, char**& argv);

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

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

Looks for inputPrefix prefixed options.

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

Looks for inputPrefix‐prefixed options.

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

Find all options matching the given prefix.

generateSourceFilenames
std::vector<std::string> generateSourceFilenames(std::vector<std::string> argList, bool binaryMode);

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

generateStringFromArgList
std::string generateStringFromArgList(std::vector<std::string> const& argList);

Build a string from the argList.

initExecutableFileSuffixList
void initExecutableFileSuffixList();

initObjectFileSuffixList
void initObjectFileSuffixList();

initSourceFileSuffixList
void initSourceFileSuffixList();

isCFileNameSuffix
bool isCFileNameSuffix(std::string const& suffix);

isCoArrayFortranFileNameSuffix
bool isCoArrayFortranFileNameSuffix(std::string const& suffix);

isCppFileNameSuffix
bool isCppFileNameSuffix(std::string const& suffix);

isCudaFileNameSuffix
bool isCudaFileNameSuffix(std::string const& suffix);

isExecutableFilename
bool isExecutableFilename(std::string name);

isFortran2003FileNameSuffix
bool isFortran2003FileNameSuffix(std::string const& suffix);

isFortran2008FileNameSuffix
bool isFortran2008FileNameSuffix(std::string const& suffix);

isFortran77FileNameSuffix
bool isFortran77FileNameSuffix(std::string const& suffix);

isFortran90FileNameSuffix
bool isFortran90FileNameSuffix(std::string const& suffix);

isFortran95FileNameSuffix
bool isFortran95FileNameSuffix(std::string const& suffix);

isFortranFileNameSuffix
bool isFortranFileNameSuffix(std::string const& suffix);

isFortranFileNameSuffixRequiringCPP
bool isFortranFileNameSuffixRequiringCPP(std::string const& suffix);

isObjectFilename
bool isObjectFilename(std::string name);

isOpenCLFileNameSuffix
bool isOpenCLFileNameSuffix(std::string const& suffix);

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

Search 'argv' for an option like optionPrefixOption.

isOptionTakingSecondParameter
bool isOptionTakingSecondParameter(std::string argument);

isOptionTakingThirdParameter
bool isOptionTakingThirdParameter(std::string argument);

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

isOptionWithParameter overloads

isSourceFilename
bool isSourceFilename(std::string name);

isValidFileWithExecutableFileSuffix
bool isValidFileWithExecutableFileSuffix(std::string name);

removeAllFileNamesExcept
void removeAllFileNamesExcept(std::vector<std::string>& argv, std::vector<std::string> filenameList, std::string exceptFilename);

Remove file names specified in filenameList from argv.

removeArgs
void removeArgs(std::vector<std::string>& argv, std::string prefix);

Remove all options matching a specified prefix.

removeArgsWithParameters
void removeArgsWithParameters(std::vector<std::string>& argv, std::string prefix);

Remove all options matching a specified prefix along with their values.

Variables