aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/swig/swmodule.i
blob: f65fd1b03ff5b54f38a4e0e73d331cc92f7e662c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
%{
 #include "swmodule.h"
%}

class SWModule {
public:
  bool terminateSearch;

  SWModule (const char *imodname = 0, const char *imoddesc = 0, SWDisplay * idisp = 0, char *imodtype = 0, SWTextEncoding encoding = ENC_UNKNOWN, SWTextDirection dir = DIRECTION_LTR, SWTextMarkup markup = FMT_UNKNOWN, const char* modlang = 0);
  virtual char Error();
  virtual const bool isUnicode() const;
  virtual const ConfigEntMap& getConfig() const;
  virtual const char *getConfigEntry(const char *key) const;

  virtual char SetKey (const SWKey *ikey);
  virtual SWKey& Key() const;
  virtual SWKey *CreateKey ();
  virtual const char* KeyText(const char *imodtype = 0);
  virtual char Display();

//Search functions
  static void nullPercent (char percent, void *userData);
  virtual ListKey & Search (const char *istr, int searchType = 0, int flags = 0, SWKey * scope = 0, bool * justCheckIfSupported = 0, void (*percent) (char, void *) = &nullPercent, void *percentUserData = 0);
  virtual signed char createSearchFramework();
  virtual bool hasSearchFramework();
  virtual bool isSearchOptimallySupported (const char *istr, int searchType, int flags, SWKey * scope);

//navigation functions
%extend {
  const bool next() {
	(*self)++;
	return !self->Error();
  };
  const bool prev() {
	(*self)--;
	return !self->Error();
  };
  const bool inc(const int howFar) {
  	(*self)+=howFar;
	return !self->Error();
  };
  const bool dec(const int howFar) {
  	(*self)-=howFar;
	return !self->Error();
  };
  void setPosition(SW_POSITION pos) {
  	(*self) = pos;
  };
  void top() {
	(*self) = TOP;
  };
  void bottom() {
	(*self) = BOTTOM;
  };
}

//data functions
%extend {
  const char* text() {
  	return (const char*)*self;
  };
  const char* StripText() {
  	return self->StripText();
  };
}

  virtual char *getRawEntry();

  virtual void setSkipConsecutiveLinks(bool val);
  virtual bool getSkipConsecutiveLinks();
  virtual AttributeTypeList &getEntryAttributes() const;
  virtual void processEntryAttributes(bool val) const;
  virtual bool isProcessEntryAttributes() const;

//module info functions
  virtual char* Name (const char *imodname = 0);
  virtual char* Description (const char *imoddesc = 0);
  virtual char* Type (const char *imodtype = 0);
  virtual char  Direction(signed char newdir = -1);
  virtual char  Encoding(signed char enc = -1);
  virtual char  Markup(signed char enc = -1);
  virtual char* Lang (const char *imodlang = 0);

//write interface
  virtual bool isWritable ();
  static signed char createModule (const char *);
  virtual SWModule& setentry (const char *inbuf, long len);
  virtual void deleteEntry ();
  
%extend {
  void write(const char* text) {
    (*self)<<text;
  };
  
  void writeLink(const SWKey* key) {
    (*self)<<key;
  };
}
};