CmdManForTest.cpp 836 B

12345678910111213141516171819202122232425262728293031
  1. #include "../include/cmdman.h"
  2. class CmdManForTest : public CmdMan {
  3. public:
  4. CmdManForTest(FileMan &fm, void (*dpf)(string)) : CmdMan(fm, dpf) {}
  5. /*
  6. * initialize state
  7. */
  8. void initNotConnected() { currentState = connectionpossible; }
  9. void initConnected() { currentState = versionpossible; }
  10. void initVersionChecked() { currentState = loginpossible; }
  11. void initLoggedIn() { currentState = normal; }
  12. /*
  13. * check state
  14. */
  15. bool isNotConnected() { return currentState == connectionpossible; }
  16. bool isConnected() { return currentState == versionpossible; }
  17. bool isVersionChecked() { return currentState == loginpossible; }
  18. bool isLoggedIn() { return currentState == normal; }
  19. // connectionpossible, versionpossible, doversion, loginpossible, dologin, dosignup, normal, disconnecttoexit, disconnecttoexitearly
  20. };