/usr/include/gpsim/cmd_manager.h is in gpsim-dev 0.26.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #ifndef __CMD_MANAGER_H__
#define __CMD_MANAGER_H__
#include <stdio.h>
#include "cmd_gpsim.h"
#include "gpsim_interface.h"
#include <vector>
#include <string>
#include <functional>
using namespace std;
class CommandHandlerKey : public ICommandHandler {
public:
CommandHandlerKey(const char *name) {
m_name = name;
}
virtual const char *GetName(void) {return m_name; }
virtual int Execute(const char * commandline, ISimConsole *out) {
return CMD_ERR_COMMANDNOTDEFINED;}
virtual int ExecuteScript(list<string *> &script, ISimConsole *out)
{ return CMD_ERR_ERROR;}
const char * m_name;
};
class CCommandManager {
public:
CCommandManager();
int Register(ICommandHandler * ch);
int Execute(string &sName, const char *cmdline);
static CCommandManager m_CommandManger;
static CCommandManager &GetManager();
ICommandHandler * find(const char *name);
ISimConsole &GetConsole() {
return GetUserInterface().GetConsole();
}
void ListToConsole();
private:
struct lessThan : binary_function<ICommandHandler*, ICommandHandler*, bool> {
bool operator()(const ICommandHandler* left, const ICommandHandler* right) const {
return strcmp(((ICommandHandler*)left)->GetName(),
((ICommandHandler*)right)->GetName()) < 0;
}
};
typedef vector<ICommandHandler*> List;
List m_HandlerList;
};
#endif
|