argumentparser.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef ARGUMENTPARSER_H
  2. #define ARGUMENTPARSER_H
  3. #include "settings.h"
  4. class ArgumentParser
  5. {
  6. public:
  7. enum FileType
  8. {
  9. Invalid,
  10. Widget,
  11. Directory,
  12. URL
  13. };
  14. public:
  15. ArgumentParser(int argc, char *argv[]);
  16. ~ArgumentParser();
  17. QString getFile() const;
  18. QString getPlatform() const;
  19. GeneratorTarget getTarget() const;
  20. ArgumentParser::FileType getFileType() const;
  21. bool guiEnabled() const;
  22. private:
  23. enum ParameterType
  24. {
  25. ValidDirectory,
  26. ValidFile,
  27. Boolean,
  28. String,
  29. Option
  30. };
  31. private:
  32. void parse(int argc, char *argv[]);
  33. bool checkSetting(QString setting, QString value);
  34. bool checkOption(QString option, QString value);
  35. private:
  36. QMap<QString, Settings::Parameter> *m_settings;
  37. QMap<QString, ParameterType> *m_commandOptions;
  38. QMap<Settings::Parameter, ParameterType> *m_parameterTypes;
  39. QStringList *m_invalidArguments;
  40. GeneratorTarget m_target;
  41. FileType m_type;
  42. QString m_file;
  43. QString m_platform;
  44. bool m_gui;
  45. };
  46. #endif // ARGUMENTPARSER_H