Mercurial > irccd
comparison irccdctl/command.h @ 0:1158cffe5a5e
Initial import
author | David Demelier <markand@malikania.fr> |
---|---|
date | Mon, 08 Feb 2016 16:43:14 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1158cffe5a5e |
---|---|
1 /* | |
2 * command.h -- irccdctl command | |
3 * | |
4 * Copyright (c) 2013-2016 David Demelier <markand@malikania.fr> | |
5 * | |
6 * Permission to use, copy, modify, and/or distribute this software for any | |
7 * purpose with or without fee is hereby granted, provided that the above | |
8 * copyright notice and this permission notice appear in all copies. | |
9 * | |
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
17 */ | |
18 | |
19 #ifndef _IRCCDCTL_COMMAND_H_ | |
20 #define _IRCCDCTL_COMMAND_H_ | |
21 | |
22 /** | |
23 * @file command.h | |
24 * @brief Irccdctl base command class. | |
25 */ | |
26 | |
27 #include <vector> | |
28 #include <sstream> | |
29 #include <string> | |
30 | |
31 #include <logger.h> | |
32 #include <system.h> | |
33 | |
34 #include "irccdctl.h" | |
35 | |
36 namespace irccd { | |
37 | |
38 class Irccdctl; | |
39 | |
40 /** | |
41 * @class Command | |
42 * @brief Irccdctl base command class. | |
43 */ | |
44 class Command { | |
45 public: | |
46 /** | |
47 * Virtual destructor defaulted. | |
48 */ | |
49 virtual ~Command() = default; | |
50 | |
51 /** | |
52 * Show the command line help. | |
53 * | |
54 * @param irccdctl the irccdctl instance | |
55 */ | |
56 virtual void usage(Irccdctl &irccdctl) const = 0; | |
57 | |
58 /** | |
59 * Execute the function with the command line given arguments. | |
60 * | |
61 * The function can throw anything. | |
62 * | |
63 * @param irccdctl the irccdctl instance | |
64 * @param args the command line arguments | |
65 */ | |
66 virtual void exec(Irccdctl &irccdctl, const std::vector<std::string> &args) const = 0; | |
67 }; | |
68 | |
69 } // !irccd | |
70 | |
71 #endif // !_IRCCDCTL_COMMAND_H_ |