diff options
| author | Ján Sučan <sucanjan@fit.cvut.cz> | 2017-05-10 15:13:29 +0200 |
|---|---|---|
| committer | Ján Sučan <sucanjan@fit.cvut.cz> | 2017-05-10 15:13:29 +0200 |
| commit | 02e24f0f533fe904c3a5275c4060c10c38d7c17a (patch) | |
| tree | 19d05c60e3d6a6782c4712de960a8f6705054063 /UserConfig.hpp | |
Uvodny commit, subory su rovnake ako na CD prilozenom k vytlacenemu texu bakalarskej prace, naviac je pridany len subor LICENCIA
Diffstat (limited to 'UserConfig.hpp')
| -rwxr-xr-x | UserConfig.hpp | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/UserConfig.hpp b/UserConfig.hpp new file mode 100755 index 0000000..4d3d6b3 --- /dev/null +++ b/UserConfig.hpp @@ -0,0 +1,67 @@ +#ifndef USER_CONFIG_HPP +#define USER_CONFIG_HPP 1 + +#include <iostream> +#include <list> +#include <vector> + +using std::string; +using std::list; +using std::vector; + +class CUserConfig { +private: + string mSerialPortName; + string mSerialSpeed; + bool mVerboseMode; + bool mHelp; + bool mVersion; + bool mIdent; + bool mSpeeds; + float mMcuFrequency; + bool mPrintProgress; + // Erase + bool mErase; + list<unsigned int> mEraseBlockList; + // Read + bool mRead; + string mReadOutputFilename; + int mReadLength; + // Write + bool mWrite; + bool mWriteEraseWholeMemory; + string mWriteInputFilename; + bool mWriteCheckByRead; + + string getArgument(vector<char *>::const_iterator args, vector<char *>::const_iterator end); + void parseEraseArguments(vector<char *>::const_iterator args, vector<char *>::const_iterator end); + void parseReadArguments(vector<char *>::const_iterator args, vector<char *>::const_iterator end); + void parseWriteArguments(vector<char *>::const_iterator args, vector<char *>::const_iterator end); + void parseCommandLine(vector<char *> & args); + +public: + CUserConfig(int argc, char **argv); + + const string getHelpMessage(const string & execName) const; + + string & getSerialPortName(); + string & getSerialSpeed(); + bool isSpeedsSet(); + bool isVerboseModeSet(); + bool isPrintProgressSet(); + bool isHelpSet(); + bool isVersionSet(); + bool isIdentSet(); + bool isEraseSet(); + list<unsigned int> getEraseBlockList(); + bool isReadSet(); + string & getReadOutputFname(); + bool isWriteSet(); + string & getWriteInputFname(); + int getReadLength(); + bool getWriteEraseWholeMemory(); + bool getWriteCheckByRead(); + float getMcuFrequency(); +}; + +#endif |
