From 12461f9a942b3736b540d68eb1ccca0f26abb268 Mon Sep 17 00:00:00 2001 From: dooglus Date: Wed, 9 Jan 2008 13:09:09 +0000 Subject: [PATCH] Add a static same_type_as() member function so we can compare types even when we don't have an instance of the ValueBase class. git-svn-id: http://svn.voria.com/code@1297 1f10aa63-cdf2-0310-b900-c93c546f37ac --- synfig-core/trunk/src/synfig/value.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/synfig-core/trunk/src/synfig/value.h b/synfig-core/trunk/src/synfig/value.h index 2bf39bb..db2cbf3 100644 --- a/synfig-core/trunk/src/synfig/value.h +++ b/synfig-core/trunk/src/synfig/value.h @@ -205,14 +205,20 @@ public: { const Type testtype(get_type(x)); - return same_type_as(testtype); + return same_type_as(type, testtype); } bool same_type_as(const Type testtype)const { - if(testtype==type)return true; - if( (type==TYPE_REAL || type==TYPE_TIME) && - (testtype==TYPE_REAL || testtype==TYPE_TIME) ) + return same_type_as(type, testtype); + } + + //! Compares two types. Returns true if they are the same type. + static bool same_type_as(const Type type1, const Type type2) + { + if (type1 == type2) return true; + if ((type1 == TYPE_REAL || type1 == TYPE_TIME) && + (type2 == TYPE_REAL || type2 == TYPE_TIME)) return true; return false; } -- 2.7.4