fix compilation with clang++

This commit is contained in:
Maxime Coste 2013-04-03 18:51:40 +02:00
parent 161fab13f7
commit 0395f3b9fc
4 changed files with 11 additions and 7 deletions

View File

@ -51,7 +51,7 @@ class CommandManager : public Singleton<CommandManager>
public: public:
void execute(const String& command_line, Context& context, void execute(const String& command_line, Context& context,
const memoryview<String>& shell_params = {}, const memoryview<String>& shell_params = {},
const EnvVarMap& env_vars = {}); const EnvVarMap& env_vars = EnvVarMap{});
Completions complete(const Context& context, Completions complete(const Context& context,
const String& command_line, ByteCount cursor_pos); const String& command_line, ByteCount cursor_pos);

View File

@ -379,7 +379,7 @@ void define_command(const CommandParameters& params, Context& context)
if (parser.has_option("shell-params")) if (parser.has_option("shell-params"))
{ {
cmd = [=](const CommandParameters& params, Context& context) { cmd = [=](const CommandParameters& params, Context& context) {
CommandManager::instance().execute(commands, context, params, {}); CommandManager::instance().execute(commands, context, params);
}; };
} }
else else
@ -708,14 +708,16 @@ void try_catch(const CommandParameters& params, Context& context)
void define_color_alias(const CommandParameters& params, Context& context) void define_color_alias(const CommandParameters& params, Context& context)
{ {
ParametersParser parser(params, {}, ParametersParser::Flags::None, 2, 2); ParametersParser parser(params, OptionMap{},
ParametersParser::Flags::None, 2, 2);
ColorRegistry::instance().register_alias( ColorRegistry::instance().register_alias(
parser[0], parser[1], true); parser[0], parser[1], true);
} }
void set_client_name(const CommandParameters& params, Context& context) void set_client_name(const CommandParameters& params, Context& context)
{ {
ParametersParser parser(params, {}, ParametersParser::Flags::None, 1, 1); ParametersParser parser(params, OptionMap{},
ParametersParser::Flags::None, 1, 1);
ClientManager::instance().set_client_name(context, params[0]); ClientManager::instance().set_client_name(context, params[0]);
} }

View File

@ -164,7 +164,8 @@ void do_pipe(Context& context)
std::vector<String> strings; std::vector<String> strings;
for (auto& sel : context.editor().selections()) for (auto& sel : context.editor().selections())
strings.push_back(ShellManager::instance().pipe({sel.begin(), sel.end()}, strings.push_back(ShellManager::instance().pipe({sel.begin(), sel.end()},
cmdline, context, {}, {})); cmdline, context, {},
EnvVarMap{}));
editor.insert(strings, InsertMode::Replace); editor.insert(strings, InsertMode::Replace);
}); });
} }
@ -778,7 +779,7 @@ void create_local_client(const String& init_command)
{ {
if (not ClientManager::instance().empty() and fork()) if (not ClientManager::instance().empty() and fork())
{ {
this->~NCursesUI(); this->NCursesUI::~NCursesUI();
puts("detached from terminal\n"); puts("detached from terminal\n");
exit(0); exit(0);
} }

View File

@ -29,6 +29,7 @@ struct wrong_argument_count : runtime_error
wrong_argument_count() : runtime_error("wrong argument count") {} wrong_argument_count() : runtime_error("wrong argument count") {}
}; };
using OptionMap = std::unordered_map<String, bool>;
// ParameterParser provides tools to parse command parameters. // ParameterParser provides tools to parse command parameters.
// There are 3 types of parameters: // There are 3 types of parameters:
@ -55,7 +56,7 @@ struct ParametersParser
// they are understood as string options, else they are understood as // they are understood as string options, else they are understood as
// boolean option. // boolean option.
ParametersParser(const ParameterList& params, ParametersParser(const ParameterList& params,
std::unordered_map<String, bool> options, OptionMap options,
Flags flags = Flags::None, Flags flags = Flags::None,
size_t min_positionals = 0, size_t min_positionals = 0,
size_t max_positionals = -1); size_t max_positionals = -1);