diff options
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__  | 
