cmDisallowedCommand.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 <vector>
  8. #include "cmCommand.h"
  9. #include "cmPolicies.h"
  10. class cmExecutionStatus;
  11. class cmDisallowedCommand : public cmCommand
  12. {
  13. public:
  14. cmDisallowedCommand(cmCommand* command, cmPolicies::PolicyID policy,
  15. const char* message)
  16. : Command(command)
  17. , Policy(policy)
  18. , Message(message)
  19. {
  20. }
  21. ~cmDisallowedCommand() override { delete this->Command; }
  22. cmCommand* Clone() override
  23. {
  24. return new cmDisallowedCommand(this->Command->Clone(), this->Policy,
  25. this->Message);
  26. }
  27. bool InitialPass(std::vector<std::string> const& args,
  28. cmExecutionStatus& status) override;
  29. void FinalPass() override { this->Command->FinalPass(); }
  30. bool HasFinalPass() const override { return this->Command->HasFinalPass(); }
  31. private:
  32. cmCommand* Command;
  33. cmPolicies::PolicyID Policy;
  34. const char* Message;
  35. };
  36. #endif