cmDisallowedCommand.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmDisallowedCommand_h
  4. #define cmDisallowedCommand_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <string>
  7. #include <utility>
  8. #include <vector>
  9. #include "cm_memory.hxx"
  10. #include "cmCommand.h"
  11. #include "cmPolicies.h"
  12. class cmExecutionStatus;
  13. class cmDisallowedCommand : public cmCommand
  14. {
  15. public:
  16. cmDisallowedCommand(std::unique_ptr<cmCommand> command,
  17. cmPolicies::PolicyID policy, const char* message)
  18. : Command(std::move(command))
  19. , Policy(policy)
  20. , Message(message)
  21. {
  22. }
  23. ~cmDisallowedCommand() override = default;
  24. std::unique_ptr<cmCommand> Clone() override
  25. {
  26. return cm::make_unique<cmDisallowedCommand>(this->Command->Clone(),
  27. this->Policy, this->Message);
  28. }
  29. bool InitialPass(std::vector<std::string> const& args,
  30. cmExecutionStatus& status) override;
  31. private:
  32. std::unique_ptr<cmCommand> Command;
  33. cmPolicies::PolicyID Policy;
  34. const char* Message;
  35. };
  36. #endif