#ifndef USER_CONFIG_HPP #define USER_CONFIG_HPP 1 #include #include #include 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 mEraseBlockList; // Read bool mRead; string mReadOutputFilename; int mReadLength; // Write bool mWrite; bool mWriteEraseWholeMemory; string mWriteInputFilename; bool mWriteCheckByRead; string getArgument(vector::const_iterator args, vector::const_iterator end); void parseEraseArguments(vector::const_iterator args, vector::const_iterator end); void parseReadArguments(vector::const_iterator args, vector::const_iterator end); void parseWriteArguments(vector::const_iterator args, vector::const_iterator end); void parseCommandLine(vector & 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 getEraseBlockList(); bool isReadSet(); string & getReadOutputFname(); bool isWriteSet(); string & getWriteInputFname(); int getReadLength(); bool getWriteEraseWholeMemory(); bool getWriteCheckByRead(); float getMcuFrequency(); }; #endif