summaryrefslogtreecommitdiff
path: root/command.cpp
blob: f8f91b9019839c2e0c843198f6cf470b9b361e25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "command.h"

using namespace std;


Command::Command(string cmd)
	:cmd(cmd){}

Command::Command(string cmd,vector<string> args)
	:cmd(cmd),args(args){}

Command::Command(string cmd,initializer_list<string> l)
	:cmd(cmd),args(l.begin(),l.end()){}

Command::Command(initializer_list<string> l)
	:cmd(*l.begin()),args(l.begin()+1,l.end()){}


const string& Command::command() const {
	return cmd;
}

const vector<string>& Command::arguments() const {
	return args;
}

const string& Command::argument(i64 index) const {
	return args.at(index);
}

const string& Command::operator[](i64 index) const {
	return index==0?cmd:args.at(index-1);
}