This thread reminded me of something I've been doing that seems to make
things easier with RG_DEBUG. I figured I'd share it in case it makes
anyone else's life easier.
When I write a new class, I write a print member function and forward
operator<< to it. I always call it printOn. Writing printOn is easier as
a member function, and then I can just print the object with RG_DEBUG.
Made my life easier.
So the header file just contains:
class QDebug;
...
namespace Rosegarden
{
...
class TempoPoint
{
...
QDebug &printOn(QDebug & dbg) const;
...
};
inline QDebug &operator<<(QDebug &dbg, const TempoPoint &that)
{ return that.printOn(dbg); }
...
}
and the body file contains a definition like:
QDebug &
TempoPoint::
printOn(QDebug & dbg) const
{
dbg << "At" << m_time
<< double(m_tempo) / 100000 << "qpm";
return dbg;
}
I tried the operator<< as a template but then non-structures confused it
(integers, pointers, etc)
Hope that saves somebody a little time and effort.
Tom Breton (Tehom)
------------------------------------------------------------------------------
Infragistics Professional
Build stunning WinForms apps today!
Reboot your WinForms applications with our WinForms controls.
Build a bridge from your legacy apps to the future.
http://pubads.g.doubleclick.net/gampad/clk?id=153845071&iu=/4140/ostg.clktrk
_______________________________________________
Rosegarden-devel mailing list
[email protected] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel