cmake/Source/cmSubcommandTable.h

34 lines
862 B
C
Raw Normal View History

2020-02-01 23:06:01 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
2021-09-14 00:13:48 +02:00
#pragma once
2020-02-01 23:06:01 +01:00
#include "cmConfigure.h" // IWYU pragma: keep
#include <initializer_list>
#include <string>
#include <utility>
#include <vector>
#include <cm/string_view>
2020-08-30 11:54:41 +02:00
#include <cmext/string_view>
2020-02-01 23:06:01 +01:00
class cmExecutionStatus;
class cmSubcommandTable
{
public:
using Command = bool (*)(std::vector<std::string> const&,
cmExecutionStatus&);
using Elem = std::pair<cm::string_view, Command>;
using InitElem = std::pair<cm::static_string_view, Command>;
cmSubcommandTable(std::initializer_list<InitElem> init);
bool operator()(cm::string_view key, std::vector<std::string> const& args,
cmExecutionStatus& status) const;
private:
std::vector<Elem> Impl;
};