From 982562fa19bb87a3dab352e562f386f61c171b7b Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 17 Feb 2008 18:59:52 +0000 Subject: major rewrite of Cvar, Func and Entity --- src/core/commandbuffer.h | 47 +++++++++++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 18 deletions(-) (limited to 'src/core/commandbuffer.h') 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 #include 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__ -- cgit v1.2.3