From: dooglus Date: Wed, 26 Nov 2008 17:10:18 +0000 (+0000) Subject: Add Duck::type_name() for debugging purposes. X-Git-Url: https://git.pterodactylus.net/?a=commitdiff_plain;h=0d1c42fcf8502e869fb0e427ca3dc1c3d39e77ce;p=synfig.git Add Duck::type_name() for debugging purposes. git-svn-id: https://synfig.svn.sourceforge.net/svnroot/synfig@2284 1f10aa63-cdf2-0310-b900-c93c546f37ac --- diff --git a/synfig-studio/trunk/src/gtkmm/duck.cpp b/synfig-studio/trunk/src/gtkmm/duck.cpp index 6b012a7..e88306e 100644 --- a/synfig-studio/trunk/src/gtkmm/duck.cpp +++ b/synfig-studio/trunk/src/gtkmm/duck.cpp @@ -222,3 +222,23 @@ Duck::get_sub_trans_origin()const { return origin_duck?origin_duck->get_sub_trans_point():origin; } + +#ifdef _DEBUG +synfig::String +Duck::type_name(Type id) +{ + String ret; + + if (id & TYPE_POSITION) { if (!ret.empty()) ret += ", "; ret += "position"; } + if (id & TYPE_TANGENT ) { if (!ret.empty()) ret += ", "; ret += "tangent" ; } + if (id & TYPE_RADIUS ) { if (!ret.empty()) ret += ", "; ret += "radius" ; } + if (id & TYPE_WIDTH ) { if (!ret.empty()) ret += ", "; ret += "width" ; } + if (id & TYPE_ANGLE ) { if (!ret.empty()) ret += ", "; ret += "angle" ; } + if (id & TYPE_VERTEX ) { if (!ret.empty()) ret += ", "; ret += "vertex" ; } + + if (ret.empty()) + ret = "none"; + + return ret; +} +#endif // _DEBUG diff --git a/synfig-studio/trunk/src/gtkmm/duck.h b/synfig-studio/trunk/src/gtkmm/duck.h index 8ac7dbb..9ba7b00 100644 --- a/synfig-studio/trunk/src/gtkmm/duck.h +++ b/synfig-studio/trunk/src/gtkmm/duck.h @@ -251,6 +251,15 @@ public: synfig::String get_name()const { return name; } bool operator==(const Duck &rhs)const; + +#ifdef _DEBUG + //! Returns a string containing the name of the given Type + static synfig::String type_name(Type id); + + //! Returns a string containing the name of the type + synfig::String type_name()const { return type_name(get_type()); } +#endif // _DEBUG + }; // END of class Duck //! Combine Flags