aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/swig/swkey.i
blob: 1d12ce4caee8106810679dbf191222c68347234b (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
%{
 #include "swkey.h"
%}

class SW_POSITION {
public:
  SW_POSITION(char ipos);
};

#define POS_TOP ((char)1)
#define POS_BOTTOM ((char)2)

#define TOP SW_POSITION(POS_TOP)
#define BOTTOM SW_POSITION(POS_BOTTOM)


/**
* The SWKey class for the SWIG-Perl interface.
*/
class SWKey {
public:
  SWKey(const char *ikey = 0);
  //SWKey(SWKey const &k);
  virtual SWKey *clone () const;

  char Persist() const;

%extend {
  
  void setPersist(signed char persists) {
  	self->Persist(persists);
  };

}
  virtual char Error ();

  virtual void setText(const char *ikey);
  virtual const char *getText() const;
  virtual const char *getShortText() const;

  virtual int compare (const SWKey & ikey);
  virtual bool equals(const SWKey &ikey);
  //virtual void setPosition(SW_POSITION);

  virtual void decrement(int steps = 1);
  virtual void increment(int steps = 1);
  virtual char Traversable ();

  virtual long Index() const;
  //virtual long Index(long iindex);
  
%extend {

  /**
  * Goes to the next key. Only useful for VerseKeys at the moment.
  */
  void next() {
  	(*self)++;
  };
  void prev() {
  	(*self)++;
  };
  void setKey(const SWKey* key) {
  	self->copyFrom(*key);
  };

}

};