diff options
author | Stijn Buys <ingar@osirion.org> | 2008-02-17 18:59:52 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2008-02-17 18:59:52 +0000 |
commit | 982562fa19bb87a3dab352e562f386f61c171b7b (patch) | |
tree | aeade8d5b7d3c68f5c222af1d8ecc6a734e1b43f /src/core/commandbuffer.h | |
parent | d198b7b8d9ff713d891f35ab173d1f428f610e7d (diff) |
major rewrite of Cvar, Func and Entity
Diffstat (limited to 'src/core/commandbuffer.h')
-rw-r--r-- | src/core/commandbuffer.h | 47 |
1 files changed, 29 insertions, 18 deletions
diff --git a/src/core/commandbuffer.h b/src/core/commandbuffer.h index 22f53d2..8970d89 100644 --- a/src/core/commandbuffer.h +++ b/src/core/commandbuffer.h @@ -4,35 +4,46 @@ the terms of the GNU General Public License version 2 */ -#ifndef __INCLUDED_COMMANDBUFFER_H__ -#define __INCLUDED_COMMANDBUFFER_H__ +#ifndef __INCLUDED_CORE_COMMANDBUFFER_H__ +#define __INCLUDED_CORE_COMMANDBUFFER_H__ -// project headers -#include "core/core.h" - -// C++ headers +#include <string> #include <sstream> namespace core { -/// global buffer to hold the command stream -extern std::stringstream cmd; - -namespace commandbuffer +class CommandBuffer { +public: + /// register command buffer functions + static void init(); -/// execute the commands in the buffer -void execute(); + /// remove command buffer functions + static void shutdown(); -/// flush the command buffer -void clear(); + /// execute the commands in the buffer + static void exec(); -/// tab completion -void complete(std::string &input, size_t &pos); + /// clear the command buffer + static void clear(); -} + /// global buffer to hold the command stream + static std::stringstream cmd; + + /// input command completion + static void complete(std::string &input, size_t &pos); + + /// the global command buffer + static std::stringstream cmdbuf; + +private: + static void exec(std::string const & cmdline); +}; + +/// the global command buffer +inline std::stringstream & cmd() { return CommandBuffer::cmdbuf; } } -#endif // COMMANDBUFFER +#endif // __INCLUDED_CORE_COMMANDBUFFER_H__ |