[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/as_object.cpp
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/as_object.cpp |
Date: |
Tue, 23 Jan 2007 12:00:09 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/01/23 12:00:09
Modified files:
. : ChangeLog
server : as_object.cpp
Log message:
* server/as_object.cpp (copyProperties): use set_member
while importing properties to properly scan the
inheritance chain.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2152&r2=1.2153
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_object.cpp?cvsroot=gnash&r1=1.26&r2=1.27
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2152
retrieving revision 1.2153
diff -u -b -r1.2152 -r1.2153
--- ChangeLog 23 Jan 2007 11:26:49 -0000 1.2152
+++ ChangeLog 23 Jan 2007 12:00:08 -0000 1.2153
@@ -1,5 +1,8 @@
2007-01-23 Sandro Santilli <address@hidden>
+ * server/as_object.cpp (copyProperties): use set_member
+ while importing properties to properly scan the
+ inheritance chain.
* server/PropertyList.h: add visitValues() templated function.
* server/sprite_instance.cpp (sprite_attach_movie):
Copy properties from initialization object *after*
Index: server/as_object.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_object.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -b -r1.26 -r1.27
--- server/as_object.cpp 22 Jan 2007 20:57:04 -0000 1.26
+++ server/as_object.cpp 23 Jan 2007 12:00:09 -0000 1.27
@@ -35,6 +35,42 @@
#include <boost/algorithm/string/case_conv.hpp>
#include <utility> // for std::pair
+
+// Anonymous namespace used for module-static defs
+namespace {
+
+using namespace gnash;
+
+// A PropertyList visitor copying properties to an object
+class PropsCopier {
+
+ as_object& _tgt;
+
+public:
+
+ /// \brief
+ /// Initialize a PropsCopier instance associating it
+ /// with a target object (an object whose members has to be set)
+ ///
+ PropsCopier(as_object& tgt)
+ :
+ _tgt(tgt)
+ {}
+
+ /// \brief
+ /// Use the set_member function to properly set *inherited* properties
+ /// of the given target object
+ ///
+ void operator() (const std::string& name, const as_value& val)
+ {
+ //log_msg("Setting member '%s' to value '%s'", name.c_str(),
val.to_string());
+ _tgt.set_member(name, val);
+ }
+};
+
+} // end of anonymous namespace
+
+
namespace gnash {
bool
@@ -359,10 +395,14 @@
}
}
+
void
as_object::copyProperties(const as_object& o)
{
- _members.import(o._members);
+ PropsCopier copier(*this);
+ o._members.visitValues(copier,
+ // Need const_cast due to getValue getting non-const ...
+ const_cast<as_object&>(o));
}
void