[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] [SCM] Gnash branch, objecturi, created. 7479110c129f0f2b6
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] [SCM] Gnash branch, objecturi, created. 7479110c129f0f2b61a4e0254305f65a4a8ea4c0 |
Date: |
Wed, 22 Sep 2010 15:33:15 +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 created
at 7479110c129f0f2b61a4e0254305f65a4a8ea4c0 (commit)
- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=7479110c129f0f2b61a4e0254305f65a4a8ea4c0
commit 7479110c129f0f2b61a4e0254305f65a4a8ea4c0
Author: Sandro Santilli <address@hidden>
Date: Wed Sep 22 17:32:16 2010 +0200
Change DisplayObject name to an ObjectURI, update all code accordingly
diff --git a/libcore/Button.cpp b/libcore/Button.cpp
index 5d03613..9444f70 100644
--- a/libcore/Button.cpp
+++ b/libcore/Button.cpp
@@ -227,14 +227,14 @@ private:
namespace {
void addInstanceProperty(Button& b, DisplayObject* d) {
if (!d) return;
- const string_table::key name = d->get_name();
+ const ObjectURI& name = d->get_name();
if (!name) return;
getObject(&b)->init_member(name, getObject(d), 0);
}
void removeInstanceProperty(Button& b, DisplayObject* d) {
if (!d) return;
- const string_table::key name = d->get_name();
+ const ObjectURI& name = d->get_name();
if (!name) return;
getObject(&b)->delProperty(name);
}
diff --git a/libcore/DisplayList.cpp b/libcore/DisplayList.cpp
index 64f264b..cc6ade8 100644
--- a/libcore/DisplayList.cpp
+++ b/libcore/DisplayList.cpp
@@ -106,11 +106,11 @@ private:
class NameEquals
{
public:
- NameEquals(string_table& st, string_table::key name, bool caseless)
+ NameEquals(string_table& st, const ObjectURI& uri, bool caseless)
:
_st(st),
_caseless(caseless),
- _name(caseless ? _st.noCase(name) : name)
+ _name(uri)
{}
bool operator() (const DisplayObject* item) {
@@ -123,17 +123,17 @@ public:
// destroyed DisplayObjects in the DisplayList.
if (item->isDestroyed()) return false;
- const string_table::key itname =
- _caseless ? _st.noCase(item->get_name()) : item->get_name();
-
- return itname == _name;
-
+ if ( _caseless ) {
+ return equalsNoCase(_st, item->get_name(), _name);
+ } else {
+ return item->get_name() == _name;
+ }
}
private:
string_table& _st;
const bool _caseless;
- const string_table::key _name;
+ const ObjectURI _name;
};
} // anonymous namespace
@@ -183,7 +183,7 @@ DisplayList::getDisplayObjectAtDepth(int depth) const
DisplayObject*
-DisplayList::getDisplayObjectByName(string_table& st, string_table::key name,
+DisplayList::getDisplayObjectByName(string_table& st, const ObjectURI& uri,
bool caseless) const
{
testInvariant();
@@ -191,7 +191,7 @@ DisplayList::getDisplayObjectByName(string_table& st,
string_table::key name,
const container_type::const_iterator e = _charsByDepth.end();
container_type::const_iterator it =
- std::find_if(_charsByDepth.begin(), e, NameEquals(st, name, caseless));
+ std::find_if(_charsByDepth.begin(), e, NameEquals(st, uri, caseless));
if (it == e) return 0;
diff --git a/libcore/DisplayList.h b/libcore/DisplayList.h
index 2238601..f4e2656 100644
--- a/libcore/DisplayList.h
+++ b/libcore/DisplayList.h
@@ -43,6 +43,7 @@
namespace gnash {
class SWFCxForm;
class Renderer;
+ class ObjectURI;
}
namespace gnash {
@@ -252,13 +253,13 @@ public:
/// The string_table to use for finding
/// lowercase equivalent of names if
/// `caseless' parameter is true.
- /// @param name
- /// Query string
+ /// @param uri
+ /// Object identifier
/// @param caseless
/// Wheter comparison must be case-insensitive.
///
DisplayObject* getDisplayObjectByName(string_table& st,
- string_table::key name, bool caseless) const;
+ const ObjectURI& uri, bool caseless) const;
/// \brief
/// Visit each DisplayObject in the list in depth order
diff --git a/libcore/DisplayObject.cpp b/libcore/DisplayObject.cpp
index 574a393..087ecc4 100644
--- a/libcore/DisplayObject.cpp
+++ b/libcore/DisplayObject.cpp
@@ -616,7 +616,7 @@ DisplayObject::getTargetPath() const
break;
}
- path.push_back(st.value(ch->get_name()));
+ path.push_back(ch->get_name().toString(st));
ch = parent;
}
@@ -684,7 +684,7 @@ DisplayObject::getTarget() const
break;
}
- path.push_back(st.value(ch->get_name()));
+ path.push_back(ch->get_name().toString(st));
ch = parent;
}
@@ -1366,7 +1366,7 @@ as_value
getNameProperty(DisplayObject& o)
{
string_table& st = getStringTable(*getObject(&o));
- const std::string& name = st.value(o.get_name());
+ const std::string& name = o.get_name().toString(st);
if (getSWFVersion(*getObject(&o)) < 6 && name.empty()) return as_value();
return as_value(name);
}
diff --git a/libcore/DisplayObject.h b/libcore/DisplayObject.h
index 0f98f7c..eb77454 100644
--- a/libcore/DisplayObject.h
+++ b/libcore/DisplayObject.h
@@ -31,6 +31,7 @@
#include <boost/cstdint.hpp> // For C99 int types
#include <boost/noncopyable.hpp>
+#include "ObjectURI.h" // for composition
#include "Transform.h"
#include "event_id.h"
#include "SWFRect.h"
@@ -424,11 +425,11 @@ public:
void setMask(DisplayObject* mask);
/// Set DisplayObject name, initializing the original target member
- void set_name(string_table::key name) {
- _name = name;
+ void set_name(const ObjectURI& uri) {
+ _name = uri;
}
- string_table::key get_name() const { return _name; }
+ const ObjectURI& get_name() const { return _name; }
/// Get the built-in function handlers code for the given event
//
@@ -1002,7 +1003,7 @@ protected:
void set_event_handlers(const Events& copyfrom);
/// Name of this DisplayObject (if any)
- string_table::key _name;
+ ObjectURI _name;
DisplayObject* _parent;
diff --git a/libcore/MovieClip.cpp b/libcore/MovieClip.cpp
index 5d37f86..f60c7a6 100644
--- a/libcore/MovieClip.cpp
+++ b/libcore/MovieClip.cpp
@@ -1640,7 +1640,7 @@ MovieClip::get_textfield_variable(const std::string& name)
DisplayObject*
-MovieClip::getDisplayListObject(string_table::key key)
+MovieClip::getDisplayListObject(const ObjectURI& uri)
{
as_object* obj = getObject(this);
@@ -1649,7 +1649,7 @@ MovieClip::getDisplayListObject(string_table::key key)
string_table& st = getStringTable(*obj);
// Try items on our display list.
- DisplayObject* ch = _displayList.getDisplayObjectByName(st, key,
+ DisplayObject* ch = _displayList.getDisplayObjectByName(st, uri,
caseless(*obj));
if (!ch) return 0;
@@ -1862,7 +1862,7 @@ MovieClip::getLoadedMovie(Movie* extern_movie)
// Copy own name
// TODO: check empty != none...
- const string_table::key name = get_name();
+ const ObjectURI& name = get_name();
if (name) extern_movie->set_name(name);
// Copy own clip depth (TODO: check this)
@@ -2048,14 +2048,14 @@ public:
// Don't enumerate unloaded DisplayObjects
if (ch->unloaded()) return;
- string_table::key name = ch->get_name();
+ const ObjectURI& name = ch->get_name();
// Don't enumerate unnamed DisplayObjects
if (!name) return;
// Referenceable DisplayObject always have an object.
assert(getObject(ch));
string_table& st = getStringTable(*getObject(ch));
- _env.push(st.value(name));
+ _env.push(name.toString(st));
}
};
diff --git a/libcore/MovieClip.h b/libcore/MovieClip.h
index 48e7d17..15321eb 100644
--- a/libcore/MovieClip.h
+++ b/libcore/MovieClip.h
@@ -459,10 +459,10 @@ public:
/// MovieClip object. They take priority over DisplayObject magic
/// properties and inherited properties, but not over own properties.
//
- /// @param name The name of the object. This function handles
+ /// @param name Object identifier. This function handles
/// case-sensitivity.
/// @return The object if found, otherwise 0.
- DisplayObject* getDisplayListObject(string_table::key name);
+ DisplayObject* getDisplayListObject(const ObjectURI& uri);
/// Overridden to look in DisplayList for a match
as_object* pathElement(string_table::key key);
http://git.savannah.gnu.org/cgit//commit/?id=c8f2817ad43dbba113d547a06ee8bfa38fd80866
commit c8f2817ad43dbba113d547a06ee8bfa38fd80866
Author: Sandro Santilli <address@hidden>
Date: Wed Sep 22 17:31:54 2010 +0200
Add toString method
diff --git a/libcore/ObjectURI.h b/libcore/ObjectURI.h
index 010d76a..a90cb30 100644
--- a/libcore/ObjectURI.h
+++ b/libcore/ObjectURI.h
@@ -35,6 +35,13 @@ struct ObjectURI
return (name == 0) ? 0 : this;
}
+ const std::string&
+ toString(string_table& st) const
+ {
+ return st.value(name);
+ }
+
+
string_table::key noCase(string_table& st) const {
if ( ! nameNoCase ) nameNoCase = st.noCase(name);
return nameNoCase;
http://git.savannah.gnu.org/cgit//commit/?id=23b75439fb9f6a3dcbf2685a03c84b8b8d5f5c27
commit 23b75439fb9f6a3dcbf2685a03c84b8b8d5f5c27
Author: Sandro Santilli <address@hidden>
Date: Wed Sep 22 17:06:42 2010 +0200
Add default operator, safe bool operator, case-insensitive comparison free
function
diff --git a/libcore/ObjectURI.h b/libcore/ObjectURI.h
index 8fa4618..010d76a 100644
--- a/libcore/ObjectURI.h
+++ b/libcore/ObjectURI.h
@@ -17,6 +17,13 @@ struct ObjectURI
class Logger;
+ /// Default constructor, no name, no caseless name
+ ObjectURI()
+ :
+ name(0),
+ nameNoCase(0)
+ {}
+
/// Construct an ObjectURI from name and namespace.
ObjectURI(string_table::key name)
:
@@ -24,6 +31,10 @@ struct ObjectURI
nameNoCase(0)
{}
+ operator const void*() const {
+ return (name == 0) ? 0 : this;
+ }
+
string_table::key noCase(string_table& st) const {
if ( ! nameNoCase ) nameNoCase = st.noCase(name);
return nameNoCase;
@@ -34,6 +45,12 @@ struct ObjectURI
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)
http://git.savannah.gnu.org/cgit//commit/?id=58ab38372bc7723848fe93b8dc0b00c478a5f54f
commit 58ab38372bc7723848fe93b8dc0b00c478a5f54f
Author: Sandro Santilli <address@hidden>
Date: Wed Sep 22 15:34:34 2010 +0200
add noCase support in ObjectURI
diff --git a/libcore/ObjectURI.h b/libcore/ObjectURI.h
index 25aafdf..8fa4618 100644
--- a/libcore/ObjectURI.h
+++ b/libcore/ObjectURI.h
@@ -20,10 +20,18 @@ struct ObjectURI
/// Construct an ObjectURI from name and namespace.
ObjectURI(string_table::key name)
:
- name(name)
+ name(name),
+ nameNoCase(0)
{}
+ string_table::key noCase(string_table& st) const {
+ if ( ! nameNoCase ) nameNoCase = st.noCase(name);
+ return nameNoCase;
+ }
+
string_table::key name;
+
+ mutable string_table::key nameNoCase;
};
/// ObjectURIs are equal if name is equal
-----------------------------------------------------------------------
hooks/post-receive
--
Gnash
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] [SCM] Gnash branch, objecturi, created. 7479110c129f0f2b61a4e0254305f65a4a8ea4c0,
Sandro Santilli <=