vendor/ogrerb/ogre/OgreStringVector.i in shattered_ogrerb-0.5.0.1 vs vendor/ogrerb/ogre/OgreStringVector.i in shattered_ogrerb-0.5.0.2
- old
+ new
@@ -1,5 +1,25 @@
%{
#include "OgreStringVector.h"
%}
+%{
+typedef std::vector<String> StringVector;
+%}
+
+%template(StringVector) std::vector<String>;
+
+/**
+ * Turn StringVectors into normal Ruby arrays
+ */
+%typemap(out) Ogre::StringVector {
+ VALUE arr = rb_ary_new();
+
+ int size = $1.size();
+ for(int i = 0; i < size; i++) {
+ rb_ary_push(arr, rb_str_new2($1[i].c_str()));
+ }
+
+ $result = arr;
+}
+
%include "OgreStringVector.h"