[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41221] trunk/blender/source/blender/ makesrna/intern/makesrna.c: RNA: fix collection iterator issue in c++ api with msvc.

Brecht Van Lommel brechtvanlommel at pandora.be
Sun Oct 23 14:58:20 CEST 2011


Revision: 41221
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41221
Author:   blendix
Date:     2011-10-23 12:58:19 +0000 (Sun, 23 Oct 2011)
Log Message:
-----------
RNA: fix collection iterator issue in c++ api with msvc.

Modified Paths:
--------------
    trunk/blender/source/blender/makesrna/intern/makesrna.c

Modified: trunk/blender/source/blender/makesrna/intern/makesrna.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/makesrna.c	2011-10-23 12:33:11 UTC (rev 41220)
+++ trunk/blender/source/blender/makesrna/intern/makesrna.c	2011-10-23 12:58:19 UTC (rev 41221)
@@ -2662,6 +2662,11 @@
 "class Array {\n"
 "public:\n"
 "	T data[Tsize];\n"
+"\n"
+"   Array() {}\n"
+"	Array(const Array<T, Tsize>& other) { memcpy(data, other.data, sizeof(T)*Tsize); }\n"
+"	const Array<T, Tsize>& operator=(const Array<T, Tsize>& other) { memcpy(data, other.data, sizeof(T)*Tsize); return *this; }\n"
+"\n"
 "	operator T*() { return data; }\n"
 "};\n"
 "\n"
@@ -2678,8 +2683,6 @@
 "	operator bool(void)\n"
 "	{ return iter.valid != 0; }\n"
 "	const CollectionIterator<T, Tbegin, Tnext, Tend>& operator++() { Tnext(&iter); t = T(iter.ptr); return *this; }\n"
-"	const CollectionIterator<T, Tbegin, Tnext, Tend>& operator=(const CollectionIterator<T, Tbegin, Tnext, Tend>& copy)\n"
-"	{ if(init) Tend(&iter); iter= copy.iter; if(iter.internal) iter.internal= MEM_dupallocN(iter.internal); t= copy.t; init= copy.init; return *this; }\n"
 "\n"
 "	T& operator*(void) { return t; }\n"
 "	T* operator->(void) { return &t; }\n"
@@ -2690,6 +2693,8 @@
 "	{ if(init) Tend(&iter); Tbegin(&iter, (PointerRNA*)&ptr.ptr); t = T(iter.ptr); init = true; }\n"
 "\n"
 "private:\n"
+"	const CollectionIterator<T, Tbegin, Tnext, Tend>& operator=(const CollectionIterator<T, Tbegin, Tnext, Tend>& copy) {}\n"
+""
 "	CollectionPropertyIterator iter;\n"
 "	T t;\n"
 "	bool init;\n"
@@ -2700,8 +2705,8 @@
 "public:\n"
 "	Collection(const PointerRNA& p) : ptr(p) {}\n"
 "\n"
-"	CollectionIterator<T, Tbegin, Tnext, Tend> begin()\n"
-"	{ CollectionIterator<T, Tbegin, Tnext, Tend> iter; iter.begin(ptr); return iter; }\n"
+"	void begin(CollectionIterator<T, Tbegin, Tnext, Tend>& iter)\n"
+"	{ iter.begin(ptr); }\n"
 "	CollectionIterator<T, Tbegin, Tnext, Tend> end()\n"
 "	{ return CollectionIterator<T, Tbegin, Tnext, Tend>(); } /* test */ \n"
 "\n"




More information about the Bf-blender-cvs mailing list