gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, objecturi, updated. 0ac1a80c041ef371a


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, objecturi, updated. 0ac1a80c041ef371acb0825aa28046791ef8b74e
Date: Fri, 24 Sep 2010 10:15:07 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, objecturi has been updated
       via  0ac1a80c041ef371acb0825aa28046791ef8b74e (commit)
       via  47572a1538e09ace5213bd6e4d526bb130c1c03a (commit)
       via  635d9a9c41df0571d6608b4f0a2272bd144ff6b9 (commit)
       via  5f93bf0366d0a1019b7c7766f0500befaaab7e9a (commit)
       via  ac15f9583d8057afab472dc8f0c0127dd5357f66 (commit)
       via  46e898f6e931e6a7afcae4958f85a92abe0c5880 (commit)
       via  c57e682fc5d3d0810e9df583e699efe3602f9732 (commit)
      from  bb5ed5d6ee5e5db13be240b9e1df86e6c67635a6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=0ac1a80c041ef371acb0825aa28046791ef8b74e


commit 0ac1a80c041ef371acb0825aa28046791ef8b74e
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Sep 24 12:12:05 2010 +0200

    Copyright.

diff --git a/libcore/ObjectURI.h b/libcore/ObjectURI.h
index 69e2d62..52842de 100644
--- a/libcore/ObjectURI.h
+++ b/libcore/ObjectURI.h
@@ -1,3 +1,20 @@
+// 
+//   Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+//   Foundation, Inc
+// 
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+// 
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+// 
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #ifndef GNASH_OBJECTURI_H
 #define GNASH_OBJECTURI_H

http://git.savannah.gnu.org/cgit//commit/?id=47572a1538e09ace5213bd6e4d526bb130c1c03a


commit 47572a1538e09ace5213bd6e4d526bb130c1c03a
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Sep 24 12:03:10 2010 +0200

    Don't use the address of a function (no thanks gcc).

diff --git a/libcore/DisplayObject.cpp b/libcore/DisplayObject.cpp
index efd2da9..4efa707 100644
--- a/libcore/DisplayObject.cpp
+++ b/libcore/DisplayObject.cpp
@@ -177,7 +177,8 @@ DisplayObject::pathElement(const ObjectURI& uri)
     
     // The check is case-insensitive for SWF6 and below.
     // TODO: cache ObjectURI(NSV::PROP_THIS) [as many others...]
-    if (ObjectURI::CaseEquals(st, caseless)(uri, ObjectURI(NSV::PROP_THIS))) {
+    if (ObjectURI::CaseEquals(st, caseless(*obj))
+            (uri, ObjectURI(NSV::PROP_THIS))) {
         return obj;
     }
        return 0;

http://git.savannah.gnu.org/cgit//commit/?id=635d9a9c41df0571d6608b4f0a2272bd144ff6b9


commit 635d9a9c41df0571d6608b4f0a2272bd144ff6b9
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Sep 24 11:47:58 2010 +0200

    Documentation.

diff --git a/libcore/ObjectURI.h b/libcore/ObjectURI.h
index fb177de..69e2d62 100644
--- a/libcore/ObjectURI.h
+++ b/libcore/ObjectURI.h
@@ -38,14 +38,16 @@ struct ObjectURI
     /// Log strings.
     class Logger;
 
-    /// Default constructor, no name, no caseless name
+    /// Default constructor.
+    //
+    /// This must be equivalent to an empty string.
     ObjectURI()
         :
         name(0),
         nameNoCase(0)
     {}
 
-    /// Construct an ObjectURI from name and namespace.
+    /// Construct an ObjectURI from name
     ObjectURI(string_table::key name)
         :
         name(name),
@@ -60,7 +62,7 @@ struct ObjectURI
     const std::string& toString(string_table& st) const {
         return st.value(name);
     }
-
+    
     string_table::key noCase(string_table& st) const {
 
         if (!name) return 0;

http://git.savannah.gnu.org/cgit//commit/?id=5f93bf0366d0a1019b7c7766f0500befaaab7e9a


commit 5f93bf0366d0a1019b7c7766f0500befaaab7e9a
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Sep 24 11:38:31 2010 +0200

    Drop functions, use functors for comparison etc.

diff --git a/libcore/DisplayList.cpp b/libcore/DisplayList.cpp
index c6d4e52..ccf9e1b 100644
--- a/libcore/DisplayList.cpp
+++ b/libcore/DisplayList.cpp
@@ -109,8 +109,7 @@ class NameEquals
 public:
     NameEquals(string_table& st, const ObjectURI& uri, bool caseless)
         :
-        _st(st),
-        _caseless(caseless),
+        _ce(st, caseless),
         _name(uri)
     {}
 
@@ -124,16 +123,11 @@ public:
         // destroyed DisplayObjects in the DisplayList.
         if (item->isDestroyed()) return false;
         
-        if ( _caseless ) { 
-            return equalsNoCase(_st, item->get_name(), _name);
-        } else {
-            return item->get_name() ==  _name;
-        }
+        return _ce(item->get_name(), _name);
     }
 
 private:
-    string_table& _st;
-    const bool _caseless;
+    const ObjectURI::CaseEquals _ce;
     const ObjectURI& _name;
 };
 
diff --git a/libcore/DisplayObject.cpp b/libcore/DisplayObject.cpp
index a044ec0..efd2da9 100644
--- a/libcore/DisplayObject.cpp
+++ b/libcore/DisplayObject.cpp
@@ -177,7 +177,7 @@ DisplayObject::pathElement(const ObjectURI& uri)
     
     // The check is case-insensitive for SWF6 and below.
     // TODO: cache ObjectURI(NSV::PROP_THIS) [as many others...]
-    if (equals(st, uri, ObjectURI(NSV::PROP_THIS), caseless(*obj))) {
+    if (ObjectURI::CaseEquals(st, caseless)(uri, ObjectURI(NSV::PROP_THIS))) {
         return obj;
     }
        return 0;
diff --git a/libcore/ObjectURI.h b/libcore/ObjectURI.h
index 5557aed..fb177de 100644
--- a/libcore/ObjectURI.h
+++ b/libcore/ObjectURI.h
@@ -26,22 +26,16 @@ namespace gnash {
 struct ObjectURI
 {
 
-    struct LessThan
-    {
-        LessThan(string_table& st, bool caseless = false)
-            :
-            _st(st),
-            _caseless(caseless)
-        {}
-        bool operator()(const ObjectURI& a, const ObjectURI& b) const {
-            if (_caseless) return a.noCase(_st) < b.noCase(_st);
-            return a.name < b.name;
-        }
-    private:
-        string_table& _st;
-        const bool _caseless;
-    };
+    /// Comparison taking case into account (or not).
+    class CaseLessThan;
+
+    /// Simple, case-sensitive less-than comparison for containers.
+    class LessThan;
+
+    /// Case-sensitive equality
+    class CaseEquals;
 
+    /// Log strings.
     class Logger;
 
     /// Default constructor, no name, no caseless name
@@ -97,39 +91,54 @@ private:
     mutable string_table::key nameNoCase;
 };
 
-inline bool
-equalsNoCase(string_table& st, const ObjectURI& a, const ObjectURI& b)
-{
-    return a.noCase(st) == b.noCase(st);
-}
-
-/// ObjectURIs are equal if name is equal
-inline bool
-operator==(const ObjectURI& a, const ObjectURI& b)
+/// Get the name element of an ObjectURI
+inline string_table::key
+getName(const ObjectURI& o)
 {
-    return a.name == b.name;
+    return o.name;
 }
 
-inline bool
-equals(string_table& st, const ObjectURI& a, const ObjectURI& b, bool caseless)
+class ObjectURI::LessThan
 {
-    if ( caseless ) return equalsNoCase(st, a, b);
-    else return a == b;
-}
+public:
+    bool operator()(const ObjectURI& a, const ObjectURI& b) const {
+        return a.name < b.name;
+    }
+};
 
-/// Comparator for ObjectURI so it can serve as a key in stdlib containers.
-inline bool
-operator<(const ObjectURI& a, const ObjectURI& b)
+class ObjectURI::CaseLessThan
 {
-    return a.name < b.name;
-}
+public:
+    CaseLessThan(string_table& st, bool caseless = false)
+        :
+        _st(st),
+        _caseless(caseless)
+    {}
+    bool operator()(const ObjectURI& a, const ObjectURI& b) const {
+        if (_caseless) return a.noCase(_st) < b.noCase(_st);
+        return a.name < b.name;
+    }
+private:
+    string_table& _st;
+    const bool _caseless;
+};
 
-/// Get the name element of an ObjectURI
-inline string_table::key
-getName(const ObjectURI& o)
+class ObjectURI::CaseEquals
 {
-    return o.name;
-}
+public:
+    CaseEquals(string_table& st, bool caseless = false)
+        :
+        _st(st),
+        _caseless(caseless)
+    {}
+    bool operator()(const ObjectURI& a, const ObjectURI& b) const {
+        if (_caseless) return a.noCase(_st) == b.noCase(_st);
+        return a.name == b.name;
+    }
+private:
+    string_table& _st;
+    const bool _caseless;
+};
 
 class ObjectURI::Logger
 {
diff --git a/libcore/PropertyList.cpp b/libcore/PropertyList.cpp
index a38e8f0..9174863 100644
--- a/libcore/PropertyList.cpp
+++ b/libcore/PropertyList.cpp
@@ -78,11 +78,11 @@ PropertyList::PropertyList(as_object& obj)
                 boost::tuple<>(),
                 boost::make_tuple(
                     KeyExtractor(),
-                    ObjectURI::LessThan(getStringTable(obj), false)
+                    ObjectURI::LessThan()
                 ),
                 boost::make_tuple(
                     KeyExtractor(),
-                    ObjectURI::LessThan(getStringTable(obj), true)
+                    ObjectURI::CaseLessThan(getStringTable(obj), true)
                 )
             )
         ),
diff --git a/libcore/PropertyList.h b/libcore/PropertyList.h
index 25cae3c..a519803 100644
--- a/libcore/PropertyList.h
+++ b/libcore/PropertyList.h
@@ -60,10 +60,9 @@ namespace gnash {
 /// owner.
 class PropertyList : boost::noncopyable
 {
-
 public:
 
-    typedef std::set<ObjectURI> PropertyTracker;
+    typedef std::set<ObjectURI, ObjectURI::LessThan> PropertyTracker;
     typedef Property value_type;
 
     /// Identifier for the sequenced index
@@ -92,7 +91,7 @@ public:
     typedef boost::multi_index::ordered_non_unique<
         boost::multi_index::tag<NoCase>,
         KeyExtractor,
-        ObjectURI::LessThan> NoCaseIndex;
+        ObjectURI::CaseLessThan> NoCaseIndex;
 
     /// The container of the Properties.
     typedef boost::multi_index_container<
diff --git a/libcore/as_environment.cpp b/libcore/as_environment.cpp
index 2c0d6eb..fea5252 100644
--- a/libcore/as_environment.cpp
+++ b/libcore/as_environment.cpp
@@ -605,10 +605,12 @@ as_environment::find_object(const std::string& path,
                 as_object* global = _vm.getGlobal();
                 const bool nocase = caseless(*global);
 
-                if (swfVersion > 5 &&
-                        equals(st, subpartURI, globalURI, nocase)) {
-                    element = global;
-                    break;
+                if (swfVersion > 5) {
+                    const ObjectURI::CaseEquals ce(st, nocase);
+                    if (ce(subpartURI, globalURI)) {
+                        element = global;
+                        break;
+                    }
                 }
 
                 // Look for globals.
diff --git a/libcore/as_object.h b/libcore/as_object.h
index 926d9de..92e3875 100644
--- a/libcore/as_object.h
+++ b/libcore/as_object.h
@@ -794,7 +794,7 @@ private:
     /// interfaces is generally small and the opcode rarely used anyway.
     std::vector<as_object*> _interfaces;
 
-    typedef std::map<ObjectURI, Trigger> TriggerContainer;
+    typedef std::map<ObjectURI, Trigger, ObjectURI::LessThan> TriggerContainer;
     boost::scoped_ptr<TriggerContainer> _trigs;
 };
 

http://git.savannah.gnu.org/cgit//commit/?id=ac15f9583d8057afab472dc8f0c0127dd5357f66


commit ac15f9583d8057afab472dc8f0c0127dd5357f66
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Sep 24 11:12:34 2010 +0200

    Restrict access, handle empty name case.

diff --git a/libcore/ObjectURI.h b/libcore/ObjectURI.h
index 44facfe..5557aed 100644
--- a/libcore/ObjectURI.h
+++ b/libcore/ObjectURI.h
@@ -63,24 +63,26 @@ struct ObjectURI
         return (name == 0);
     }
 
-    const std::string&
-    toString(string_table& st) const
-    {
+    const std::string& toString(string_table& st) const {
         return st.value(name);
     }
 
     string_table::key noCase(string_table& st) const {
 
-        if ( ! nameNoCase ) {
+        if (!name) return 0;
+
+        if (!nameNoCase) {
             nameNoCase = st.noCase(name);
 #ifdef GNASH_STATS_OBJECT_URI_NOCASE
-            static stats::KeyLookup statNonSkip("ObjectURI::noCase non-skips", 
st, 0, 0, 0);
+            static stats::KeyLookup statNonSkip("ObjectURI::noCase non-skips",
+                    st, 0, 0, 0);
             statNonSkip.check(name);
 #endif
         }
 #ifdef GNASH_STATS_OBJECT_URI_NOCASE
         else {
-            static stats::KeyLookup stat("ObjectURI::noCase skips", st, 0, 0, 
0);
+            static stats::KeyLookup stat("ObjectURI::noCase skips",
+                    st, 0, 0, 0);
             stat.check(name);
         }
 #endif
@@ -90,6 +92,8 @@ struct ObjectURI
 
     string_table::key name;
 
+private:
+
     mutable string_table::key nameNoCase;
 };
 

http://git.savannah.gnu.org/cgit//commit/?id=46e898f6e931e6a7afcae4958f85a92abe0c5880


commit 46e898f6e931e6a7afcae4958f85a92abe0c5880
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Sep 24 10:49:47 2010 +0200

    Document and clean up.

diff --git a/libcore/PropertyList.cpp b/libcore/PropertyList.cpp
index aba1a92..a38e8f0 100644
--- a/libcore/PropertyList.cpp
+++ b/libcore/PropertyList.cpp
@@ -18,23 +18,25 @@
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 //
 
-#include "PropertyList.h"
-#include "Property.h" 
-#include "as_environment.h"
-#include "log.h"
-#include "as_function.h"
-#include "as_value.h" // for enumerateValues
-#include "VM.h" // For string_table
-#include "string_table.h"
-#include "GnashAlgorithm.h"
 #ifdef HAVE_CONFIG_H
 #include "gnashconfig.h" // GNASH_STATS_PROPERTY_LOOKUPS
 #endif
 
+#include "PropertyList.h"
+
 #include <utility> 
 #include <boost/bind.hpp> 
 #include <boost/tuple/tuple.hpp>
 
+#include "Property.h" 
+#include "as_environment.h"
+#include "log.h"
+#include "as_function.h"
+#include "as_value.h" 
+#include "VM.h" 
+#include "string_table.h"
+#include "GnashAlgorithm.h"
+
 // Define the following to enable printing address of each property added
 //#define DEBUG_PROPERTY_ALLOC
 
@@ -44,7 +46,6 @@
 // Define this to get stats of property lookups 
 //#define GNASH_STATS_PROPERTY_LOOKUPS 1
 
-
 #ifdef GNASH_STATS_PROPERTY_LOOKUPS
 # include "Stats.h"
 # include "namedStrings.h"
@@ -61,10 +62,12 @@ iterator_find(const PropertyList::container& p, const 
ObjectURI& uri, VM& vm)
     const bool caseless = vm.getSWFVersion() < 7;
 
     if (!caseless) {
-        return p.project<0>(p.get<PropertyList::Case>().find(uri));
+        return p.project<PropertyList::CreationOrder>(
+                p.get<PropertyList::Case>().find(uri));
     }
         
-    return p.project<0>(p.get<PropertyList::NoCase>().find(uri));
+    return p.project<PropertyList::CreationOrder>(
+            p.get<PropertyList::NoCase>().find(uri));
 }
 
 }
diff --git a/libcore/PropertyList.h b/libcore/PropertyList.h
index e509e6b..25cae3c 100644
--- a/libcore/PropertyList.h
+++ b/libcore/PropertyList.h
@@ -66,25 +66,27 @@ public:
     typedef std::set<ObjectURI> PropertyTracker;
     typedef Property value_type;
 
-    struct KeyExtractor
-    {
-        typedef ObjectURI result_type;
-        ObjectURI operator()(const value_type& v) {
-            return v.uri();
-        }
-        ObjectURI operator()(const value_type& v) const {
-            return v.uri();
-        }
-    };
+    /// Identifier for the sequenced index
+    struct CreationOrder {};
 
-    struct Case {};
-    struct NoCase {};
+    /// The sequenced index in creation order.
+    typedef boost::multi_index::sequenced<
+        boost::multi_index::tag<CreationOrder> > SequencedIndex;
+    
+    typedef boost::multi_index::const_mem_fun<value_type, const ObjectURI&,
+            &value_type::uri> KeyExtractor;
 
+    /// Identifier for the case-sensitive index
+    struct Case {};
+    
     /// The case-sensitive index
     typedef boost::multi_index::ordered_unique<
         boost::multi_index::tag<Case>,
         KeyExtractor,
         ObjectURI::LessThan> CaseIndex;
+
+    /// Identifier for the case-insensitive index
+    struct NoCase {};
     
     /// The case-insensitive index
     typedef boost::multi_index::ordered_non_unique<
@@ -92,10 +94,10 @@ public:
         KeyExtractor,
         ObjectURI::LessThan> NoCaseIndex;
 
+    /// The container of the Properties.
     typedef boost::multi_index_container<
         value_type,
-        boost::multi_index::indexed_by<
-            boost::multi_index::sequenced<>, CaseIndex, NoCaseIndex>
+        boost::multi_index::indexed_by<SequencedIndex, CaseIndex, NoCaseIndex>
         > container;
 
     typedef container::iterator iterator;
@@ -104,8 +106,6 @@ public:
     /// Construct the PropertyList 
     //
     /// @param obj      The as_object to which this PropertyList belongs.
-    ///                 This object is not fully constructed at this stage,
-    ///                 so this constructor should not do anything with it!
     PropertyList(as_object& obj);
 
     /// Visit properties 

http://git.savannah.gnu.org/cgit//commit/?id=c57e682fc5d3d0810e9df583e699efe3602f9732


commit c57e682fc5d3d0810e9df583e699efe3602f9732
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Sep 24 10:34:05 2010 +0200

    Adapt PropertyList to new ObjectURI behaviour.

diff --git a/libcore/ObjectURI.h b/libcore/ObjectURI.h
index b3da4c6..44facfe 100644
--- a/libcore/ObjectURI.h
+++ b/libcore/ObjectURI.h
@@ -26,6 +26,22 @@ namespace gnash {
 struct ObjectURI
 {
 
+    struct LessThan
+    {
+        LessThan(string_table& st, bool caseless = false)
+            :
+            _st(st),
+            _caseless(caseless)
+        {}
+        bool operator()(const ObjectURI& a, const ObjectURI& b) const {
+            if (_caseless) return a.noCase(_st) < b.noCase(_st);
+            return a.name < b.name;
+        }
+    private:
+        string_table& _st;
+        const bool _caseless;
+    };
+
     class Logger;
 
     /// Default constructor, no name, no caseless name
diff --git a/libcore/PropertyList.cpp b/libcore/PropertyList.cpp
index 46c4007..aba1a92 100644
--- a/libcore/PropertyList.cpp
+++ b/libcore/PropertyList.cpp
@@ -31,8 +31,9 @@
 #include "gnashconfig.h" // GNASH_STATS_PROPERTY_LOOKUPS
 #endif
 
-#include <utility> // for std::make_pair
+#include <utility> 
 #include <boost/bind.hpp> 
+#include <boost/tuple/tuple.hpp>
 
 // Define the following to enable printing address of each property added
 //#define DEBUG_PROPERTY_ALLOC
@@ -60,18 +61,31 @@ iterator_find(const PropertyList::container& p, const 
ObjectURI& uri, VM& vm)
     const bool caseless = vm.getSWFVersion() < 7;
 
     if (!caseless) {
-        return p.project<0>(p.get<1>().find(uri));
+        return p.project<0>(p.get<PropertyList::Case>().find(uri));
     }
         
-    ObjectURI uri2 = uri;
-    ObjectURI uri3 ( uri );
-
-    string_table& st = vm.getStringTable();
-    const string_table::key nocase = uri.noCase(st); 
-    return p.project<0>(p.get<2>().find(nocase));
+    return p.project<0>(p.get<PropertyList::NoCase>().find(uri));
 }
 
 }
+    
+PropertyList::PropertyList(as_object& obj)
+    :
+    _props(boost::make_tuple(
+                boost::tuple<>(),
+                boost::make_tuple(
+                    KeyExtractor(),
+                    ObjectURI::LessThan(getStringTable(obj), false)
+                ),
+                boost::make_tuple(
+                    KeyExtractor(),
+                    ObjectURI::LessThan(getStringTable(obj), true)
+                )
+            )
+        ),
+    _owner(obj)
+{
+}
 
 bool
 PropertyList::setValue(const ObjectURI& uri, const as_value& val,
@@ -79,14 +93,11 @@ PropertyList::setValue(const ObjectURI& uri, const 
as_value& val,
 {
        const_iterator found = iterator_find(_props, uri, getVM(_owner));
        
-    string_table& st = getStringTable(_owner);
-
-       if (found == _props.end())
-       {
+       if (found == _props.end()) {
                // create a new member
                Property a(uri, val, flagsIfMissing);
                // Non slot properties are negative ordering in insertion order
-               _props.push_back(std::make_pair(a, uri.noCase(st)));
+               _props.push_back(a);
 #ifdef GNASH_DEBUG_PROPERTY
         ObjectURI::Logger l(getStringTable(_owner));
                log_debug("Simple AS property %s inserted with flags %s",
@@ -95,7 +106,7 @@ PropertyList::setValue(const ObjectURI& uri, const as_value& 
val,
                return true;
        }
 
-       const Property& prop = found->first;
+       const Property& prop = *found;
        if (readOnly(prop) && ! prop.isDestructive())
        {
         ObjectURI::Logger l(getStringTable(_owner));
@@ -114,9 +125,9 @@ PropertyList::setFlags(const ObjectURI& uri, int setFlags, 
int clearFlags)
 {
        iterator found = iterator_find(_props, uri, getVM(_owner));
        if (found == _props.end()) return;
-    PropFlags f = found->first.getFlags();
+    PropFlags f = found->getFlags();
     f.set_flags(setFlags, clearFlags);
-       found->first.setFlags(f);
+       found->setFlags(f);
 
 }
 
@@ -124,9 +135,9 @@ void
 PropertyList::setFlagsAll(int setFlags, int clearFlags)
 {
     for (const_iterator it = _props.begin(); it != _props.end(); ++it) {
-        PropFlags f = it->first.getFlags();
+        PropFlags f = it->getFlags();
         f.set_flags(setFlags, clearFlags);
-        it->first.setFlags(f);
+        it->setFlags(f);
     }
 }
 
@@ -142,7 +153,7 @@ PropertyList::getProperty(const ObjectURI& uri) const
 #endif // GNASH_STATS_PROPERTY_LOOKUPS
        iterator found = iterator_find(_props, uri, getVM(_owner));
        if (found == _props.end()) return 0;
-       return const_cast<Property*>(&(found->first));
+       return const_cast<Property*>(&(*found));
 }
 
 std::pair<bool,bool>
@@ -155,7 +166,7 @@ PropertyList::delProperty(const ObjectURI& uri)
        }
 
        // check if member is protected from deletion
-       if (found->first.getFlags().get_dont_delete()) {
+       if (found->getFlags().get_dont_delete()) {
                return std::make_pair(true, false);
        }
 
@@ -171,7 +182,7 @@ PropertyList::dump(std::map<std::string, as_value>& to)
        for (const_iterator i=_props.begin(), ie=_props.end();
             i != ie; ++i)
        {
-               to.insert(std::make_pair(l(i->first.uri()), 
i->first.getValue(_owner)));
+               to.insert(std::make_pair(l(i->uri()), i->getValue(_owner)));
        }
 }
 
@@ -185,9 +196,9 @@ PropertyList::enumerateKeys(as_environment& env, 
PropertyTracker& donelist)
        for (const_iterator i = _props.begin(),
             ie = _props.end(); i != ie; ++i) {
 
-               if (i->first.getFlags().get_dont_enum()) continue;
+               if (i->getFlags().get_dont_enum()) continue;
 
-        const ObjectURI& uri = i->first.uri();
+        const ObjectURI& uri = i->uri();
 
                if (donelist.insert(uri).second) {
             const std::string& qname = st.value(getName(uri));
@@ -202,7 +213,7 @@ PropertyList::dump()
     ObjectURI::Logger l(getStringTable(_owner));
        for (const_iterator it=_props.begin(), itEnd=_props.end();
             it != itEnd; ++it) {
-               log_debug("  %s: %s", l(it->first.uri()), 
it->first.getValue(_owner));
+               log_debug("  %s: %s", l(it->uri()), it->getValue(_owner));
        }
 }
 
@@ -214,13 +225,11 @@ PropertyList::addGetterSetter(const ObjectURI& uri, 
as_function& getter,
        Property a(uri, &getter, setter, flagsIfMissing);
        iterator found = iterator_find(_props, uri, getVM(_owner));
     
-    string_table& st = getStringTable(_owner);
-       if (found != _props.end())
-       {
+       if (found != _props.end()) {
                // copy flags from previous member (even if it's a normal 
member ?)
-               a.setFlags(found->first.getFlags());
-               a.setCache(found->first.getCache());
-               _props.replace(found, std::make_pair(a, uri.noCase(st)));
+               a.setFlags(found->getFlags());
+               a.setCache(found->getCache());
+               _props.replace(found, a);
 
 #ifdef GNASH_DEBUG_PROPERTY
         ObjectURI::Logger l(getStringTable(_owner));
@@ -229,10 +238,9 @@ PropertyList::addGetterSetter(const ObjectURI& uri, 
as_function& getter,
 #endif
 
        }
-       else
-       {
+       else {
                a.setCache(cacheVal);
-               _props.push_back(std::make_pair(a, uri.noCase(st)));
+               _props.push_back(a);
 #ifdef GNASH_DEBUG_PROPERTY
         ObjectURI::Logger l(getStringTable(_owner));
                log_debug("AS GetterSetter %s inserted with flags %s", l(uri),
@@ -249,13 +257,12 @@ PropertyList::addGetterSetter(const ObjectURI& uri, 
as_c_function_ptr getter,
 {
        Property a(uri, getter, setter, flagsIfMissing);
 
-    string_table& st = getStringTable(_owner);
        const_iterator found = iterator_find(_props, uri, getVM(_owner));
        if (found != _props.end())
        {
                // copy flags from previous member (even if it's a normal 
member ?)
-               a.setFlags(found->first.getFlags());
-               _props.replace(found, std::make_pair(a, uri.noCase(st)));
+               a.setFlags(found->getFlags());
+               _props.replace(found, a);
 
 #ifdef GNASH_DEBUG_PROPERTY
         ObjectURI::Logger l(getStringTable(_owner));
@@ -266,7 +273,7 @@ PropertyList::addGetterSetter(const ObjectURI& uri, 
as_c_function_ptr getter,
        }
        else
        {
-               _props.push_back(std::make_pair(a, uri.noCase(st)));
+               _props.push_back(a);
 #ifdef GNASH_DEBUG_PROPERTY
                string_table& st = getStringTable(_owner);
                log_debug("Native GetterSetter %s in namespace %s inserted with 
"
@@ -293,8 +300,7 @@ PropertyList::addDestructiveGetter(const ObjectURI& uri, 
as_function& getter,
        // destructive getter don't need a setter
        Property a(uri, &getter, (as_function*)0, flagsIfMissing, true);
 
-    string_table& st = getStringTable(_owner);
-       _props.push_back(std::make_pair(a, uri.noCase(st)));
+       _props.push_back(a);
 
 #ifdef GNASH_DEBUG_PROPERTY
     ObjectURI::Logger l(getStringTable(_owner));
@@ -314,8 +320,7 @@ PropertyList::addDestructiveGetter(const ObjectURI& uri,
 
        // destructive getter don't need a setter
        Property a(uri, getter, (as_c_function_ptr)0, flagsIfMissing, true);
-    string_table& st = getStringTable(_owner);
-       _props.push_back(std::make_pair(a, uri.noCase(st)));
+       _props.push_back(a);
 
 #ifdef GNASH_DEBUG_PROPERTY
     ObjectURI::Logger l(getStringTable(_owner));
@@ -334,7 +339,7 @@ PropertyList::clear()
 void
 PropertyList::setReachable() const
 {
-    foreachFirst(_props.begin(), _props.end(),
+    std::for_each(_props.begin(), _props.end(),
             boost::mem_fn(&Property::setReachable));
 }
 
diff --git a/libcore/PropertyList.h b/libcore/PropertyList.h
index 0de03aa..e509e6b 100644
--- a/libcore/PropertyList.h
+++ b/libcore/PropertyList.h
@@ -64,30 +64,40 @@ class PropertyList : boost::noncopyable
 public:
 
     typedef std::set<ObjectURI> PropertyTracker;
-    typedef std::pair<Property, string_table::key> value_type;
+    typedef Property value_type;
 
-    struct NameExtractor
+    struct KeyExtractor
     {
         typedef ObjectURI result_type;
-        const result_type& operator()(const value_type& r) const {
-            return r.first.uri();
+        ObjectURI operator()(const value_type& v) {
+            return v.uri();
         }
-        const result_type& operator()(value_type& r) {
-            return r.first.uri();
+        ObjectURI operator()(const value_type& v) const {
+            return v.uri();
         }
     };
+
+    struct Case {};
+    struct NoCase {};
+
+    /// The case-sensitive index
+    typedef boost::multi_index::ordered_unique<
+        boost::multi_index::tag<Case>,
+        KeyExtractor,
+        ObjectURI::LessThan> CaseIndex;
     
-    typedef boost::multi_index::member<value_type, value_type::second_type,
-            &value_type::second> KeyExtractor;
+    /// The case-insensitive index
+    typedef boost::multi_index::ordered_non_unique<
+        boost::multi_index::tag<NoCase>,
+        KeyExtractor,
+        ObjectURI::LessThan> NoCaseIndex;
 
     typedef boost::multi_index_container<
         value_type,
         boost::multi_index::indexed_by<
-            boost::multi_index::sequenced<>,
-            boost::multi_index::ordered_unique<NameExtractor>,
-            boost::multi_index::ordered_non_unique<KeyExtractor>
-            >
+            boost::multi_index::sequenced<>, CaseIndex, NoCaseIndex>
         > container;
+
     typedef container::iterator iterator;
     typedef container::const_iterator const_iterator;
 
@@ -96,12 +106,7 @@ public:
     /// @param obj      The as_object to which this PropertyList belongs.
     ///                 This object is not fully constructed at this stage,
     ///                 so this constructor should not do anything with it!
-    PropertyList(as_object& obj)
-        :
-        _props(),
-        _owner(obj)
-    {
-    }
+    PropertyList(as_object& obj);
 
     /// Visit properties 
     //
@@ -127,9 +132,9 @@ public:
         for (const_iterator it = _props.begin(), ie = _props.end();
                 it != ie; ++it)
         {
-            if (!cmp(it->first)) continue;
-            as_value val = it->first.getValue(_owner);
-            if (!visitor.accept(it->first.uri(), val)) return;
+            if (!cmp(*it)) continue;
+            as_value val = it->getValue(_owner);
+            if (!visitor.accept(it->uri(), val)) return;
         }
     }
 

-----------------------------------------------------------------------

Summary of changes:
 libcore/DisplayList.cpp    |   12 +---
 libcore/DisplayObject.cpp  |    3 +-
 libcore/ObjectURI.h        |  116 +++++++++++++++++++++++++++++++-------------
 libcore/PropertyList.cpp   |  108 ++++++++++++++++++++++-------------------
 libcore/PropertyList.h     |   66 +++++++++++++------------
 libcore/as_environment.cpp |   10 ++--
 libcore/as_object.h        |    2 +-
 7 files changed, 187 insertions(+), 130 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]