/*********************************************************************//**
*	\brief Commands library.
*	Knihovna obsahuje vsechny prikazy a k nim prirazene
*			funkce a parametry. Pri nejake akci je prikaz vytazen
*			podle klice a zavola se prislusna funkce s parametrem.
*
*	\author Michal Jirous
*	\date 29.7.2008
*	\file ctrl_commands.h
**********************************************************************/

#ifndef __COMMANDS_H__
#define __COMMANDS_H__

#include <string>
#include <map>

//class CControl;
struct command
{
	std::string sCommand;
	std::string sAliasData;	//prikazy aliasu
	command *reverse;
	//command *next;	
	void (*function)(void*);
	bool par, isDefault, isAllowed;

	command( std::string sCommand, void (*fnc)(void*), bool parameter = false, bool systemAllowed = false );
	command();
};


namespace commandsLibrary
{

	

	void init();
	void initCommands();
	bool doCommand( std::string s, void* par = NULL );
	bool doCommand(command *cmd, void* par = NULL );
	void addCom( std::string com, void (*func)(void*), std::string reverse = std::string(""), bool parameter = false, bool systemAllower = false);
	void addAliasCom( std::string com, void (*func)(void*), std::string reverse = std::string(""),bool parameter = false, std::string aliasData = std::string(""));
	std::map<std::string,command>::iterator *getCommandIter( std::string com);
	command *getCommand( std::string com);

};

#endif
