X-Git-Url: http://git.armaanb.net/?a=blobdiff_plain;f=src%2Fsarge.h;fp=src%2Fsarge.h;h=ab24c72d31c8b3bf96eda8c444ba8f3bea9a479d;hb=cac3baac18464ada793614bf79e59b1cb824a2cb;hp=0000000000000000000000000000000000000000;hpb=f5ab06bf079103425674d2583b149ded02e53d13;p=gen-shell.git diff --git a/src/sarge.h b/src/sarge.h new file mode 100644 index 0000000..ab24c72 --- /dev/null +++ b/src/sarge.h @@ -0,0 +1,54 @@ +/* + sarge.h - Header file for the Sarge command line argument parser project. + + Revision 0 + + Notes: + - + + 2019/03/16, Maya Posch + +*/ + + +#include +#include +#include +#include + + +struct Argument { + Argument() : hasValue(false), parsed(false) { /* */ } + std::string arg_short; + std::string arg_long; + std::string description; + bool hasValue; + std::string value; + bool parsed; +}; + + + +class Sarge { + std::vector > args; + std::map argNames; + bool parsed = false; + int flagCounter = 0; + std::string execName; + std::string description; + std::string usage; + std::vector textArguments; + +public: + void setArgument(std::string arg_short, std::string arg_long, std::string desc, bool hasVal); + void setArguments(std::vector args); + void setDescription(std::string desc) { this->description = desc; } + void setUsage(std::string use) { this->usage = use; } + bool parseArguments(int argc, char** argv); + bool getFlag(std::string arg_flag, std::string &arg_value); + bool exists(std::string arg_flag); + bool getTextArgument(uint32_t index, std::string &value); + void printHelp(); + int flagCount() { return flagCounter; } + std::string executableName() { return execName; } +};