Files
haiku-beta6/src/tools/fs_shell/fssh.h
T
Ingo Weinhold 8dcb250c8a Thou shall not leave a blank line between copyright header and header
guard.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20976 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-05-02 14:26:29 +00:00

78 lines
1.5 KiB
C++

/*
* Copyright 2007, Ingo Weinhold, [email protected].
* Distributed under the terms of the MIT License.
*/
#ifndef _FSSH_FSSH_H
#define _FSSH_FSSH_H
#include "compatibility.h"
#include <map>
#include <string>
#include "fssh_defs.h"
typedef fssh_status_t command_function(int argc, const char* const* argv);
namespace FSShell {
enum {
COMMAND_RESULT_EXIT = 1,
};
// Command
class Command {
public:
Command(const char* name,
const char* description);
Command(command_function* function,
const char* name, const char* description);
virtual ~Command();
const char* Name() const;
const char* Description() const;
virtual fssh_status_t Do(int argc, const char* const* argv);
private:
std::string fName;
std::string fDescription;
command_function* fFunction;
};
// CommandManager
class CommandManager {
private:
CommandManager();
public:
static CommandManager* Default();
void AddCommand(Command* command);
void AddCommand(command_function* function,
const char* name, const char* description);
void AddCommands(command_function* function,
const char* name, const char* description,
...);
Command* FindCommand(const char* name) const;
void ListCommands() const;
private:
typedef std::map<std::string, Command*> CommandMap;
CommandMap fCommands;
static CommandManager* sManager;
};
} // namespace FSShell
#endif // _FSSH_FSSH_H