summaryrefslogtreecommitdiff
path: root/i/marvin/src/interpreter/interpreter.hh
diff options
context:
space:
mode:
authorschodet2006-04-19 18:49:31 +0000
committerschodet2006-04-19 18:49:31 +0000
commit08e65445760a453a95f9039f9ea6ab626789a12d (patch)
tree3ef2b3c884c190e2f43f150553134312733d63a8 /i/marvin/src/interpreter/interpreter.hh
parent88f1c7071d15f867244c1bb31d3766e657c0a5c1 (diff)
Ajout de la gestion de l'aide dans l'interpreteur.
Diffstat (limited to 'i/marvin/src/interpreter/interpreter.hh')
-rw-r--r--i/marvin/src/interpreter/interpreter.hh13
1 files changed, 12 insertions, 1 deletions
diff --git a/i/marvin/src/interpreter/interpreter.hh b/i/marvin/src/interpreter/interpreter.hh
index 4164c28..1f6e688 100644
--- a/i/marvin/src/interpreter/interpreter.hh
+++ b/i/marvin/src/interpreter/interpreter.hh
@@ -51,14 +51,23 @@ class Interpreter
template<class T, typename F>
class MemFunc;
private:
+ struct FuncDesc
+ {
+ Func *func;
+ std::string desc;
+ FuncDesc (Func *func_, const std::string &desc_)
+ : func (func_), desc (desc_) { }
+ };
/// Type of the private function map.
- typedef std::map<std::string, Func *> Funcs;
+ typedef std::map<std::string, FuncDesc> Funcs;
/// The function map itself.
Funcs funcs_;
public:
/// Destructor.
~Interpreter (void);
/// Add a function, Interpreter owns f.
+ void add (const std::string &s, Func *f, const std::string &desc);
+ /// Add a function without description, Interpreter owns f.
void add (const std::string &s, Func *f);
/// Call a function by name.
void call (const std::string &s, const Args &a,
@@ -67,6 +76,8 @@ class Interpreter
void interpretString (const std::string &s, bool dryrun = false);
/// Interpret a file.
void interpretFile (const std::string &file, bool dryrun = false);
+ /// Return an help string.
+ std::string help (void) const;
/// Take all the template sophistications out of the programmer hands.
template<class T, typename F>
static Func *memFunc (T &i, F f);