summaryrefslogtreecommitdiff
path: root/command.h
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-01-08 22:43:35 +0100
committertomsmeding <tom.smeding@gmail.com>2017-01-08 22:43:35 +0100
commit4addb711c6a1a282b0a59bf03e850a86ba2ead69 (patch)
treef7e9c4a594d1c4fa41a6ebc6371279762a9a580a /command.h
Initial
Diffstat (limited to 'command.h')
-rw-r--r--command.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/command.h b/command.h
new file mode 100644
index 0000000..5ee7d24
--- /dev/null
+++ b/command.h
@@ -0,0 +1,29 @@
+#pragma once
+
+#include <initializer_list>
+#include <string>
+#include <vector>
+
+#include "global.h"
+
+using namespace std;
+
+
+class Command{
+ const string cmd;
+ const vector<string> args;
+
+public:
+ Command(string cmd);
+ Command(string cmd,vector<string> args);
+ Command(string cmd,initializer_list<string> l);
+ Command(initializer_list<string> l);
+ template <typename... A>
+ Command(string cmd,A... a)
+ :cmd(cmd),args{a...}{}
+
+ const string& command() const;
+ const vector<string>& arguments() const;
+ const string& argument(i64 index) const;
+ const string& operator[](i64 index) const; // 0 is command, >=1 is arguments
+};