summaryrefslogtreecommitdiff
path: root/libs/pbd/pbd/signals.py
diff options
context:
space:
mode:
authorCarl Hetherington <carl@carlh.net>2012-05-15 00:06:33 +0000
committerCarl Hetherington <carl@carlh.net>2012-05-15 00:06:33 +0000
commita6fdd6c915d527d0f5502a7739eefac25d413448 (patch)
treeed42259a67bcaff49c0882b9cda9de356883b286 /libs/pbd/pbd/signals.py
parent67b74ed1c7a3887ddd0e289c54c09ac8f7529518 (diff)
Maybe fix typename / no-typename problems better.
git-svn-id: svn://localhost/ardour2/branches/3.0@12282 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/pbd/signals.py')
-rw-r--r--libs/pbd/pbd/signals.py41
1 files changed, 17 insertions, 24 deletions
diff --git a/libs/pbd/pbd/signals.py b/libs/pbd/pbd/signals.py
index e5ea09ae2e..da7756c359 100644
--- a/libs/pbd/pbd/signals.py
+++ b/libs/pbd/pbd/signals.py
@@ -66,6 +66,14 @@ def signal(f, n, v):
for a in An:
an.append(a.lower())
+ # If the template is fully specialized, use of typename SomeTypedef::iterator is illegal
+ # in c++03 (should use just SomeTypedef::iterator) [although use of typename is ok in c++0x]
+ # http://stackoverflow.com/questions/6076015/typename-outside-of-template
+ if n == 0 and v:
+ typename = ""
+ else:
+ typename = "typename "
+
if v:
print >>f,"template <%s>" % comma_separated(An, "typename ")
print >>f,"class Signal%d<%s> : public SignalBase" % (n, comma_separated(["void"] + An))
@@ -94,19 +102,14 @@ def signal(f, n, v):
print >>f,"public:"
print >>f,""
- print >>f,"\t~Signal%d () {" % n,
+ print >>f,"\t~Signal%d () {" % n
- print >>f,"""
- boost::mutex::scoped_lock lm (_mutex);
-#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 6))
- for (typename Slots::iterator i = _slots.begin(); i != _slots.end(); ++i) {
-#else
- for (Slots::iterator i = _slots.begin(); i != _slots.end(); ++i) {
-#endif
- i->first->signal_going_away ();
- }
- }
-"""
+ print >>f,"\t\tboost::mutex::scoped_lock lm (_mutex);"
+ print >>f,"\t\tfor (%sSlots::iterator i = _slots.begin(); i != _slots.end(); ++i) {" % typename
+
+ print >>f,"\t\t\ti->first->signal_going_away ();"
+ print >>f,"\t\t}"
+ print >>f,"\t}"
if n == 0:
p = ""
@@ -115,7 +118,7 @@ def signal(f, n, v):
p = ", %s" % comma_separated(Anan)
q = ", %s" % comma_separated(an)
- print >>f,"\tstatic void compositor (typename boost::function<void(%s)> f, EventLoop* event_loop, EventLoop::InvalidationRecord* ir%s) {" % (comma_separated(An), p)
+ print >>f,"\tstatic void compositor (%sboost::function<void(%s)> f, EventLoop* event_loop, EventLoop::InvalidationRecord* ir%s) {" % (typename, comma_separated(An), p)
print >>f,"\t\tevent_loop->call_slot (ir, boost::bind (f%s));" % q
print >>f,"\t}"
@@ -227,17 +230,7 @@ def signal(f, n, v):
print >>f,"\t\t}"
if not v:
print >>f,"\t\tstd::list<R> r;"
- if n == 0 and v:
- print >>f,"""
-#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 6))
- for (typename Slots::iterator i = s.begin(); i != s.end(); ++i) {
-#else
- for (Slots::iterator i = s.begin(); i != s.end(); ++i) {
-#endif
-"""
- else:
- print >>f,"\t\tfor (typename Slots::iterator i = s.begin(); i != s.end(); ++i) {"
-
+ print >>f,"for (%sSlots::iterator i = s.begin(); i != s.end(); ++i) {" % typename
print >>f,"""
bool still_there = false;
{