cmSubcommandTable.h 925 B

123456789101112131415161718192021222324252627282930313233343536
  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 cmSubcommandTable_h
  4. #define cmSubcommandTable_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include "cm_static_string_view.hxx"
  7. #include "cm_string_view.hxx"
  8. #include <initializer_list>
  9. #include <string>
  10. #include <utility>
  11. #include <vector>
  12. class cmExecutionStatus;
  13. class cmSubcommandTable
  14. {
  15. public:
  16. using Command = bool (*)(std::vector<std::string> const&,
  17. cmExecutionStatus&);
  18. using Elem = std::pair<cm::string_view, Command>;
  19. using InitElem = std::pair<cm::static_string_view, Command>;
  20. cmSubcommandTable(std::initializer_list<InitElem> init);
  21. bool operator()(cm::string_view key, std::vector<std::string> const& args,
  22. cmExecutionStatus& status) const;
  23. private:
  24. std::vector<Elem> Impl;
  25. };
  26. #endif