Main Page | Modules | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

jdb_module.h

Go to the documentation of this file.
00001 // AUTOMATICALLY GENERATED -- DO NOT EDIT!         -*- c++ -*-
00002 
00003 #ifndef jdb_module_h
00004 #define jdb_module_h
00005 
00006 #include <cstdarg>
00007 
00008 #include "initcalls.h"
00009 
00010 //
00011 // INTERFACE definition follows 
00012 //
00013 
00014 
00015 class Jdb_category;
00016 
00034 class Jdb_module
00035 {
00036 public:
00037 
00045   struct Cmd {
00051     int id;
00052 
00056     char const *scmd;
00057 
00061     char const *cmd;
00062 
00105     char const *fmt;
00106 
00115     char const *descr;
00116 
00123     void *argbuf;
00124 
00135   };
00136 
00144   enum Action_code {
00145 
00147     NOTHING = 0,
00148 
00150     LEAVE,
00151 
00153     GO_BACK,
00154 
00156     ERROR,
00157 
00162     EXTRA_INPUT,
00163 
00169     EXTRA_INPUT_WITH_NEXTCHAR,
00170   };
00171 
00172   typedef void (Gotkey)(char *&str, int maxlen, int c);
00173 
00189   Jdb_module( char const *category = "MISC" ) FIASCO_INIT;
00190 
00192   virtual ~Jdb_module();
00193 
00214   virtual Action_code action( int cmd, void *&args, char const* &fmt,
00215                               int &next_char ) = 0;
00216 
00226   virtual int const num_cmds() const = 0;
00227 
00241   virtual Cmd const *const cmds() const = 0;
00242 
00246   Jdb_category const *category() const;
00247 
00251   Jdb_module *next() const;
00252 
00261   Cmd const* has_cmd( char const* cmd, bool short_mode = false ) const;
00262 
00266   static Jdb_module *first();
00267 
00268 private:
00269   static Jdb_module *_first;
00270 
00271   Jdb_module *_next;
00272   Jdb_module *_prev;
00273   Jdb_category const *const _cat;
00274 
00275 };
00276 
00285 class Jdb_category
00286 {
00287 public:
00288 
00301   class Iterator 
00302   {
00303   private:
00304     Jdb_module const   *m;
00305     Jdb_category const *c;
00306 
00307   public:
00308 
00314     Iterator( Jdb_category const *_c, Jdb_module const *_m )
00315       : m(_m), c(_c)
00316     {
00317       while(m && m->category() != c) 
00318         m = m->next();
00319     }
00320 
00324     Iterator next() 
00325     {
00326 
00327       while(m && m->category() != c)
00328         m = m->next();
00329 
00330       Iterator i(c,m);
00331 
00332       if(m) 
00333         m = m->next();
00334 
00335       return i;
00336     }
00337 
00341     operator Jdb_module const * () 
00342     {
00343       return m;
00344     }
00345 
00346   };
00347 
00355   Jdb_category( char const *name, char const *desc, 
00356                 unsigned order = 0 ) FIASCO_INIT;
00357 
00361   char const *const name() const;
00362 
00366   char const *const description() const;
00367 
00371   Jdb_category const *next() const;
00372 
00376   Iterator modules() const;
00377 
00378 public:
00379 
00388   static Jdb_category const *find( char const *name, 
00389                                    bool _default = false );
00390 
00394   static Jdb_category const *first();
00395 
00396 private:
00397   char const *const _name;
00398   char const *const _desc;
00399   unsigned const _order;
00400 
00401   Jdb_category *_next;
00402 
00403 private:
00404 
00405   static Jdb_category *_first;
00406 
00407 };
00408 
00409 //
00410 // IMPLEMENTATION of inline functions (and needed classes)
00411 //
00412 
00413 
00414 
00415 
00416 inline Jdb_module *Jdb_module::first()
00417 {
00418   return _first;
00419 }
00420 
00421 
00422 
00423 inline Jdb_category const *
00424 Jdb_module::category() const
00425 {
00426   return _cat;
00427 }
00428 
00429 
00430 
00431 inline Jdb_module *
00432 Jdb_module::next() const
00433 {
00434   return _next;
00435 }
00436 
00437 
00438 
00439 inline Jdb_category const *Jdb_category::first()
00440 {
00441   return _first;
00442 }
00443 
00444 
00445 
00446 inline char const *const Jdb_category::name() const
00447 {
00448   return _name;
00449 }
00450 
00451 
00452 
00453 inline char const *const Jdb_category::description() const
00454 {
00455   return _desc;
00456 }
00457 
00458 
00459 
00460 inline Jdb_category const *Jdb_category::next() const
00461 {
00462   return _next;
00463 }
00464 
00465 #endif // jdb_module_h

Generated on Mon Sep 26 14:20:11 2005 for Fiasco by  doxygen 1.4.2