initial commit
This commit is contained in:
commit
4b60ece582
327 changed files with 28286 additions and 0 deletions
43
lib/wServerUtils/commands.h
Normal file
43
lib/wServerUtils/commands.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
#ifndef SERVERUTILS_COMMANDS_H
|
||||
#define SERVERUTILS_COMMANDS_H
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <wType/address.h>
|
||||
#include <wType/vocabulary.h>
|
||||
#include <wType/event.h>
|
||||
#include <wType/string.h>
|
||||
|
||||
#include <wModel/vocabulary.h>
|
||||
|
||||
namespace U {
|
||||
|
||||
class Commands : public M::Vocabulary
|
||||
{
|
||||
struct Command;
|
||||
typedef std::map<W::String, Command*> Map;
|
||||
public:
|
||||
Commands(const W::Address& address, QObject* parent = 0);
|
||||
~Commands();
|
||||
|
||||
void addCommand(const W::String& key, W::Handler* handler, const W::Vocabulary& args);
|
||||
void removeCommand(const W::String& key);
|
||||
void enableCommand(const W::String& key, bool value);
|
||||
|
||||
private:
|
||||
void enableCommand(Command* cmd);
|
||||
void disableCommand(Command* cmd);
|
||||
|
||||
Map* commands;
|
||||
|
||||
struct Command {
|
||||
W::String name;
|
||||
W::Handler* handler;
|
||||
W::Vocabulary arguments;
|
||||
bool enabled;
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif // SERVERUTILS_COMMANDS_H
|
Loading…
Add table
Add a link
Reference in a new issue