Command.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. //
  2. // Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved
  3. // LICENSE: Atomic Game Engine Editor and Tools EULA
  4. // Please see LICENSE_ATOMIC_EDITOR_AND_TOOLS.md in repository root for
  5. // license information: https://github.com/AtomicGameEngine/AtomicGameEngine
  6. //
  7. #pragma once
  8. #include <Atomic/Core/Object.h>
  9. using namespace Atomic;
  10. namespace ToolCore
  11. {
  12. EVENT(E_COMMANDERROR, CommandError)
  13. {
  14. PARAM(P_MESSAGE, Message); // string
  15. }
  16. EVENT(E_COMMANDFINISHED, CommandFinished)
  17. {
  18. }
  19. class Command : public Object
  20. {
  21. OBJECT(Command);
  22. public:
  23. Command(Context* context);
  24. virtual ~Command();
  25. bool Parse(const String& command);
  26. virtual bool Parse(const Vector<String>& arguments, unsigned startIndex, String& errorMsg) = 0;
  27. virtual void Run() = 0;
  28. virtual void Finished();
  29. virtual void Error(const String& errorMsg);
  30. virtual void Cancel() {}
  31. virtual bool RequiresProjectLoad() { return true; }
  32. virtual bool RequiresLicenseValidation() { return false; }
  33. private:
  34. float timeOut_;
  35. };
  36. }