summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorGonzalo Garramuno <ggarra@advancedsl.com.ar>2007-05-05 11:19:54 +0000
committerGonzalo Garramuno <ggarra@advancedsl.com.ar>2007-05-05 11:19:54 +0000
commitf92ebdbe079728391326de566b91d21d2be6ad89 (patch)
tree1952b6e133d8db5663bd4a86de1fbe5ee84ab21e /Lib
parent1c46a18c509f432c3fdbc27082a823f3ab8ed668 (diff)
downloadswig-f92ebdbe079728391326de566b91d21d2be6ad89.tar.gz
remove std::set from new extended functions, as
it was failing due to non-assignable iterator. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9774 626c5289-ae23-0410-ae9c-e8d60b6d4f22
Diffstat (limited to 'Lib')
-rw-r--r--Lib/ruby/rubyclasses.swg39
-rw-r--r--Lib/ruby/rubycontainer.swg58
-rw-r--r--Lib/ruby/rubycontainer_extended.swg11
-rw-r--r--Lib/ruby/rubyiterators.swg2
4 files changed, 72 insertions, 38 deletions
diff --git a/Lib/ruby/rubyclasses.swg b/Lib/ruby/rubyclasses.swg
index 6cf7c9fb5..d8b97232e 100644
--- a/Lib/ruby/rubyclasses.swg
+++ b/Lib/ruby/rubyclasses.swg
@@ -200,5 +200,42 @@ namespace std {
%}
+//
+// Fragment that contains traits to properly deal with GC_VALUE.
+// These functions may be invoked as a need of the from(), asval(),
+// asptr() and as() template functors, usually used in %typemaps.
+//
+%fragment(SWIG_Traits_frag(swig::GC_VALUE),"header",fragment="StdTraits") {
+namespace swig {
+ template <> struct traits<GC_VALUE > {
+ typedef value_category category;
+ static const char* type_name() { return "GC_VALUE"; }
+ };
+
+ template <> struct traits_from<GC_VALUE> {
+ typedef GC_VALUE value_type;
+ static VALUE from(const value_type& val) {
+ return static_cast<VALUE>(val);
+ }
+ };
+
+ template <>
+ struct traits_check<GC_VALUE, value_category> {
+ static bool check(GC_VALUE) {
+ return true;
+ }
+ };
+
+ template <> struct traits_asval<GC_VALUE > {
+ typedef GC_VALUE value_type;
+ static int asval(VALUE obj, value_type *val) {
+ if (val) *val = obj;
+ return SWIG_OK;
+ }
+ };
+} // swig
+} // %fragment(traits for swig::GC_VALUE)
+
+
+#endif // __cplusplus
-#endif
diff --git a/Lib/ruby/rubycontainer.swg b/Lib/ruby/rubycontainer.swg
index 9f5b95ad8..d151adb84 100644
--- a/Lib/ruby/rubycontainer.swg
+++ b/Lib/ruby/rubycontainer.swg
@@ -36,36 +36,6 @@
%include <std_except.i>
-%fragment(SWIG_Traits_frag(swig::GC_VALUE),"header",fragment="StdTraits") {
-namespace swig {
- template <> struct traits<GC_VALUE > {
- typedef value_category category;
- static const char* type_name() { return "GC_VALUE"; }
- };
-
- template <> struct traits_from<GC_VALUE> {
- typedef GC_VALUE value_type;
- static VALUE from(const value_type& val) {
- return static_cast<VALUE>(val);
- }
- };
-
- template <>
- struct traits_check<GC_VALUE, value_category> {
- static bool check(GC_VALUE) {
- return true;
- }
- };
-
- template <> struct traits_asval<GC_VALUE > {
- typedef GC_VALUE value_type;
- static int asval(VALUE obj, value_type *val) {
- if (val) *val = obj;
- return SWIG_OK;
- }
- };
-} // swig
-} // %fragment(traits for swig::GC_VALUE)
%fragment("RubySequence_Base","header")
{
@@ -425,6 +395,10 @@ namespace swig
}
}
+/**
+ * Macros used to typemap an STL iterator -> SWIGIterator conversion.
+ *
+ */
%define %swig_sequence_iterator(Sequence...)
#if defined(SWIG_EXPORT_ITERATOR_METHODS)
class iterator;
@@ -514,6 +488,11 @@ namespace swig
%enddef
+
+/**
+ * Macro used to define common Ruby printing methods for STL container
+ *
+ */
%define %swig_sequence_printing_methods(Sequence...)
%extend {
@@ -569,6 +548,10 @@ namespace swig
%enddef
+/**
+ * Macro used to add common methods to all STL sequence-type containers
+ *
+ */
%define %swig_sequence_methods_common(Sequence...)
%swig_container_methods(%arg(Sequence))
%swig_sequence_iterator(%arg(Sequence))
@@ -674,6 +657,11 @@ namespace swig
%enddef
+/**
+ * Macro used to add functions for back insertion of values in
+ * STL Sequence containers
+ *
+ */
%define %swig_sequence_back_inserters( Sequence... )
%extend {
@@ -705,6 +693,11 @@ namespace swig
}
%enddef
+
+/**
+ * Macro used to add functions for Sequences
+ *
+ */
%define %swig_sequence_methods(Sequence...)
%swig_sequence_methods_common(%arg(Sequence));
%swig_sequence_back_inserters(%arg(Sequence));
@@ -842,6 +835,11 @@ namespace swig
%enddef
+/**
+ * Macro used to add functions for front insertion of
+ * elements in STL sequence containers that support it.
+ *
+ */
%define %swig_sequence_front_inserters( Sequence... )
%extend {
diff --git a/Lib/ruby/rubycontainer_extended.swg b/Lib/ruby/rubycontainer_extended.swg
index e868bcb0c..360e399ce 100644
--- a/Lib/ruby/rubycontainer_extended.swg
+++ b/Lib/ruby/rubycontainer_extended.swg
@@ -6,9 +6,9 @@
* @brief This file contains additional functions that make containers
* behave closer to ruby primitive types.
* However, some of these functions place some restrictions on
- * the underlying object inside of the container (that it has
- * an == comparison function, that it has an = assignment
- * operator, etc).
+ * the underlying object inside of the container and the iterator
+ * (that it has to have an == comparison function, that it has to have
+ * an = assignment operator, etc).
*
*/
@@ -54,7 +54,7 @@
//
- // map!
+ // map! -- the equivalent of std::transform
//
Container< Type >* map_bang() {
@@ -134,7 +134,6 @@
%__swig_container_extend_primtypes( std::vector );
-%__swig_container_extend_primtypes( std::set );
-%__swig_container_extend_primtypes( std::list );
%__swig_container_extend_primtypes( std::deque );
+%__swig_container_extend_primtypes( std::list );
diff --git a/Lib/ruby/rubyiterators.swg b/Lib/ruby/rubyiterators.swg
index 78ddd3959..eafa265f4 100644
--- a/Lib/ruby/rubyiterators.swg
+++ b/Lib/ruby/rubyiterators.swg
@@ -9,7 +9,7 @@
* Users can derive form the RubySwigIterator to implemet their
* own iterators. As an example (real one since we use it for STL/STD
* containers), the template RubySwigIterator_T does the
- * implementation for genereic C++ iterators.
+ * implementation for generic C++ iterators.
* ----------------------------------------------------------------------------- */
%include <std_common.i>