package_name_and_function -> PackageNameAndFunction

This commit is contained in:
Alexander Karatarakis 2017-04-03 16:21:21 -07:00
parent fb45692ada
commit 6ac7eb7bfb
2 changed files with 12 additions and 12 deletions

View File

@ -154,20 +154,20 @@ namespace vcpkg::Commands
}
template <class T>
struct package_name_and_function
struct PackageNameAndFunction
{
std::string name;
T function;
};
const std::vector<package_name_and_function<CommandTypeA>>& get_available_commands_type_a();
const std::vector<package_name_and_function<CommandTypeB>>& get_available_commands_type_b();
const std::vector<package_name_and_function<CommandTypeC>>& get_available_commands_type_c();
const std::vector<PackageNameAndFunction<CommandTypeA>>& get_available_commands_type_a();
const std::vector<PackageNameAndFunction<CommandTypeB>>& get_available_commands_type_b();
const std::vector<PackageNameAndFunction<CommandTypeC>>& get_available_commands_type_c();
template <typename T>
T find(const std::string& command_name, const std::vector<package_name_and_function<T>> available_commands)
T find(const std::string& command_name, const std::vector<PackageNameAndFunction<T>> available_commands)
{
for (const package_name_and_function<T>& cmd : available_commands)
for (const PackageNameAndFunction<T>& cmd : available_commands)
{
if (cmd.name == command_name)
{

View File

@ -3,9 +3,9 @@
namespace vcpkg::Commands
{
const std::vector<package_name_and_function<CommandTypeA>>& get_available_commands_type_a()
const std::vector<PackageNameAndFunction<CommandTypeA>>& get_available_commands_type_a()
{
static std::vector<package_name_and_function<CommandTypeA>> t = {
static std::vector<PackageNameAndFunction<CommandTypeA>> t = {
{"install", &Install::perform_and_exit},
{ "ci", &CI::perform_and_exit },
{"remove", &Remove::perform_and_exit},
@ -16,9 +16,9 @@ namespace vcpkg::Commands
return t;
}
const std::vector<package_name_and_function<CommandTypeB>>& get_available_commands_type_b()
const std::vector<PackageNameAndFunction<CommandTypeB>>& get_available_commands_type_b()
{
static std::vector<package_name_and_function<CommandTypeB>> t = {
static std::vector<PackageNameAndFunction<CommandTypeB>> t = {
{"/?", &Help::perform_and_exit},
{"help", &Help::perform_and_exit},
{"search", &Search::perform_and_exit},
@ -35,9 +35,9 @@ namespace vcpkg::Commands
return t;
}
const std::vector<package_name_and_function<CommandTypeC>>& get_available_commands_type_c()
const std::vector<PackageNameAndFunction<CommandTypeC>>& get_available_commands_type_c()
{
static std::vector<package_name_and_function<CommandTypeC>> t = {
static std::vector<PackageNameAndFunction<CommandTypeC>> t = {
{"version", &Version::perform_and_exit},
{"contact", &Contact::perform_and_exit},
{"hash", &Hash::perform_and_exit},