From df7158c0ee9cd6fde0183b2841d1c918f5c8ab7b Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Mon, 6 Sep 2010 14:59:13 +0000 Subject: COMMON: Add a debugPrint function to Rational svn-id: r52593 --- common/rational.cpp | 5 +++++ common/rational.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/common/rational.cpp b/common/rational.cpp index 163044f349..38aae94def 100644 --- a/common/rational.cpp +++ b/common/rational.cpp @@ -22,6 +22,7 @@ * $Id$ */ +#include "common/debug.h" #include "common/rational.h" #include "common/util.h" #include "common/algorithm.h" @@ -289,6 +290,10 @@ const Rational operator/(int left, const Rational &right) { return tmp; } +void Rational::debugPrint(int debuglevel, const char *caption) const { + debug(debuglevel, "%s %d/%d", caption, _num, _denom); +} + bool operator==(int left, const Rational &right) { return right == left; } diff --git a/common/rational.h b/common/rational.h index 5ceac36209..5826839ac6 100644 --- a/common/rational.h +++ b/common/rational.h @@ -86,6 +86,8 @@ public: double toDouble() const; frac_t toFrac() const; + void debugPrint(int debuglevel = 0, const char *caption = "Rational:") const; + private: int _num; int _denom; -- cgit v1.2.3