From 3f4a0d5370ae6c34afe180df96add3b8522f4af1 Mon Sep 17 00:00:00 2001 From: mattkae Date: Wed, 11 May 2022 09:23:58 -0400 Subject: initial commit --- elpa/irony-20220110.849/server/src/Command.h | 73 ++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 elpa/irony-20220110.849/server/src/Command.h (limited to 'elpa/irony-20220110.849/server/src/Command.h') diff --git a/elpa/irony-20220110.849/server/src/Command.h b/elpa/irony-20220110.849/server/src/Command.h new file mode 100644 index 0000000..9f36aa4 --- /dev/null +++ b/elpa/irony-20220110.849/server/src/Command.h @@ -0,0 +1,73 @@ +/**-*-C++-*- + * \file + * \author Guillaume Papin + * + * \brief Command parser declarations. + * + * This file is distributed under the GNU General Public License. See + * COPYING for details. + */ + +#ifndef IRONY_MODE_SERVER_COMMAND_H_ +#define IRONY_MODE_SERVER_COMMAND_H_ + +#include "support/CIndex.h" +#include "support/TemporaryFile.h" +#include "Style.h" + +#include +#include +#include + +class TemporaryFile; + +// TODO: a tagged union? +struct Command { + Command() { + clear(); + } + + void clear() { + action = Unknown; + flags.clear(); + file.clear(); + unsavedFile.clear(); + dir.clear(); + prefix.clear(); + style = PrefixMatchStyle::Exact; + line = 0; + column = 0; + opt = false; + } + +#define X(sym, str, desc) sym, + enum Action { +#include "Commands.def" + } action; + + std::vector flags; + std::string file; + std::string unsavedFile; + std::string dir; + std::string prefix; + PrefixMatchStyle style; + unsigned line; + unsigned column; + bool opt; +}; + +std::ostream &operator<<(std::ostream &os, const Command::Action &action); +std::ostream &operator<<(std::ostream &os, const Command &command); + +class CommandParser { +public: + CommandParser(); + + Command *parse(const std::vector &argv); + +private: + Command command_; + TemporaryFile tempFile_; +}; + +#endif // IRONY_MODE_SERVER_COMMAND_H_ -- cgit v1.2.1