~ubuntu-branches/debian/squeeze/sword/squeeze

« back to all changes in this revision

Viewing changes to bindings/swig/swmgr.i

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Glassey
  • Date: 2004-01-15 15:50:07 UTC
  • Revision ID: james.westby@ubuntu.com-20040115155007-n9mz4x0zxrs1isd3
Tags: upstream-1.5.7
ImportĀ upstreamĀ versionĀ 1.5.7

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%{
 
2
#include <swmgr.h>
 
3
using namespace sword;
 
4
%}
 
5
 
 
6
typedef map < SWBuf, SWModule *, less < SWBuf > > ModMap;
 
7
typedef list < SWBuf > StringList;
 
8
typedef map < SWBuf, SWFilter * > FilterMap;
 
9
 
 
10
class SWMgr {
 
11
public:
 
12
//member data
 
13
  static void findConfig (char *configType, char **prefixPath, char **configPath);
 
14
 
 
15
  SWConfig *config;
 
16
  SWConfig *sysconfig;
 
17
  ModMap Modules;
 
18
  char *prefixPath;
 
19
  char *configPath;
 
20
 
 
21
//member functions
 
22
  SWMgr (SWConfig* iconfig = 0, SWConfig* isysconfig = 0, bool autoload = true, SWFilterMgr* filterMgr = 0);
 
23
  SWMgr(const char *iConfigPath, bool autoload = true, SWFilterMgr *filterMgr = 0);
 
24
  virtual ~SWMgr();
 
25
 
 
26
  virtual signed char Load ();
 
27
  virtual void setGlobalOption (const char *option, const char *value);
 
28
  virtual const char *getGlobalOption (const char *option);
 
29
  virtual const char *getGlobalOptionTip (const char *option);
 
30
  virtual StringList getGlobalOptions ();
 
31
  virtual StringList getGlobalOptionValues (const char *option);
 
32
  virtual signed char setCipherKey (const char *modName, const char *key);
 
33
        
 
34
  SWModule *getModule(const char *modName);
 
35
  virtual void InstallScan(const char *dir);
 
36
  
 
37
%extend {
 
38
        const int moduleCount() {
 
39
                return self->Modules.size();
 
40
        }
 
41
        
 
42
        SWModule* getModuleAt( const int pos ) {
 
43
                if (pos < 0 || pos > self->Modules.size() )
 
44
                        return 0;
 
45
        
 
46
                ModMap::iterator it = self->Modules.begin(); 
 
47
                
 
48
                for (int i = 0; i < pos; ++i) {
 
49
                        it++;
 
50
                }
 
51
 
 
52
                if ( it != self->Modules.end() ) {
 
53
                        return (*it).second;
 
54
                }
 
55
                
 
56
                return 0;
 
57
        }
 
58
 
59
};