[sword-svn] r2951 - trunk/bindings/swig
scribe at crosswire.org
scribe at crosswire.org
Mon Aug 5 11:19:23 MST 2013
Author: scribe
Date: 2013-08-05 11:19:23 -0700 (Mon, 05 Aug 2013)
New Revision: 2951
Modified:
trunk/bindings/swig/swbuf.i
trunk/bindings/swig/swkey.i
Log:
added __str__ methods so these classes can be cast to string objects in their target language
Modified: trunk/bindings/swig/swbuf.i
===================================================================
--- trunk/bindings/swig/swbuf.i 2013-08-05 14:07:42 UTC (rev 2950)
+++ trunk/bindings/swig/swbuf.i 2013-08-05 18:19:23 UTC (rev 2951)
@@ -33,5 +33,11 @@
char charAt2(unsigned int pos) {
return self->charAt((unsigned long)pos);
}
+ %extend {
+ char *__str__() {
+ return const_cast<char *>(self->c_str());
+ }
+ }
+
};
Modified: trunk/bindings/swig/swkey.i
===================================================================
--- trunk/bindings/swig/swkey.i 2013-08-05 14:07:42 UTC (rev 2950)
+++ trunk/bindings/swig/swkey.i 2013-08-05 18:19:23 UTC (rev 2951)
@@ -9,3 +9,12 @@
%rename (getPosition) sword::SW_POSITION::operator char;
%include "swkey.h"
+
+%extend sword::SWKey {
+ %extend {
+ char *__str__() {
+ return const_cast<char *>(self->getText());
+ }
+ }
+
+};
More information about the sword-cvs
mailing list