add some hacky code to allow passing sfc files with -b
[openc2e.git] / dialect.h
blob8fa87c2d09d0fc1fdeabedb7459c29da9d4259a1
1 #ifndef DIALECT_H
2 #define DIALECT_H 1
4 #include "cmddata.h"
5 #include <string>
6 #include <map>
7 #include <boost/shared_ptr.hpp>
9 class Dialect {
10 private:
11 const int cmdcnt;
12 const struct cmdinfo *cmds;
13 public:
14 const std::string name;
15 const struct cmdinfo *cmdbase() const { return cmds; }
16 const struct cmdinfo *getcmd(int idx) const {
17 assert(idx >= 0 && idx < cmdcnt);
18 return cmdbase() + idx;
20 int cmdcount() const { return cmdcnt; }
22 const cmdinfo *find_command(const char *name) const;
24 Dialect(const cmdinfo *cmds, const std::string &n);
26 int cmd_index(const cmdinfo *) const;
29 extern std::map<std::string, boost::shared_ptr<Dialect> > dialects;
31 void registerDelegates();
32 void freeDelegates();
34 /* vim: set noet: */
36 #endif