1 #ifndef _command__hpp__included__
2 #define _command__hpp__included__
17 * Register a new command.
19 * parameter cmd: The command to register.
20 * throws std::bad_alloc: Not enough memory.
22 command(const std::string
& cmd
) throw(std::bad_alloc
);
25 * Deregister a command.
27 virtual ~command() throw();
32 * parameter arguments: Arguments to command.
33 * parameter window: Handle to graphics system.
34 * throws std::bad_alloc: Not enough memory.
35 * throws std::runtime_error: Command execution failed.
37 virtual void invoke(const std::string
& arguments
, window
* win
) throw(std::bad_alloc
, std::runtime_error
) = 0;
40 * Look up and invoke a command. The command will undergo alias expansion and recursion checking.
42 * parameter cmd: Command to exeucte.
43 * parameter window: Handle to graphics system.
45 static void invokeC(const std::string
& cmd
, window
* win
) throw();
48 * Get short help for command.
50 virtual std::string
get_short_help() throw(std::bad_alloc
);
53 * Get long help for command.
55 virtual std::string
get_long_help() throw(std::bad_alloc
);
57 command(const command
&);
58 command
& operator=(const command
&);
59 std::string commandname
;
63 * Splits string to fields on ' ' and '\t', with multiple whitespace collapsed into one.
69 * Create a new splitter.
71 * parameter _line: The line to start splitting.
72 * throws std::bad_alloc: Not enough memory.
74 tokensplitter(const std::string
& _line
) throw(std::bad_alloc
);
76 * Is there more coming?
78 * returns: True if there is more, false otherwise.
79 * throws std::bad_alloc: Not enough memory.
81 operator bool() throw();
85 * returns: The next token from line. If there is no more tokens, returns "".
86 * throws std::bad_alloc: Not enough memory.
88 operator std::string() throw(std::bad_alloc
);
90 * Get all that is remaining.
92 * returns: All remaining parts of line as-is.
93 * throws std::bad_alloc: Not enough memory.
95 std::string
tail() throw(std::bad_alloc
);