/* Rosegarden A sequencer and musical notation editor. This program is Copyright 2000-2008 Guillaume Laurent , Chris Cannam , Richard Bown The moral right of the authors to claim authorship of this work has been asserted. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See the file COPYING included with this distribution for more information. */ #include "Strings.h" #include "misc/Debug.h" #include "Debug.h" #include "base/Event.h" #include "base/Segment.h" #include "base/RealTime.h" #include "base/Colour.h" #include "gui/editors/guitar/Chord.h" #include "gui/editors/guitar/Fingering.h" #ifndef NDEBUG kdbgstream& operator<<(kdbgstream &dbg, const std::string &s) { dbg << strtoqstr(s); return dbg; } kdbgstream& operator<<(kdbgstream &dbg, const Rosegarden::Event &e) { dbg << "Event type : " << e.getType() << endl; dbg << "\tDuration : " << e.getDuration() << "\n\tAbsolute Time : " << e.getAbsoluteTime() << endl; // for (Event::PropertyMap::const_iterator i = e.properties().begin(); // i != e.properties().end(); ++i) { // dbg << "\t\t" << (*i).first << " : " // << ((*i).second)->unparse() << '\n'; // } // e.dump(std::cerr); return dbg; } kdbgstream& operator<<(kdbgstream &dbg, const Rosegarden::Segment &t) { dbg << "Segment for instrument " << t.getTrack() << " starting at " << t.getStartTime() << endl; for (Rosegarden::Segment::const_iterator i = t.begin(); i != t.end(); ++i) { if (!(*i)) { dbg << "WARNING : skipping null event ptr\n"; continue; } dbg << "Dumping Event : \n"; dbg << *(*i) << endl; } return dbg; } kdbgstream& operator<<(kdbgstream &dbg, const Rosegarden::RealTime &t) { dbg << t.toString(); return dbg; } kdbgstream& operator<<(kdbgstream &dbg, const Rosegarden::Colour &c) { dbg << "Colour : rgb = " << c.getRed() << "," << c.getGreen() << "," << c.getBlue(); return dbg; } kdbgstream& operator<<(kdbgstream &dbg, const Rosegarden::Guitar::Chord &c) { dbg << "Chord root = " << c.getRoot() << ", ext = '" << c.getExt() << "'"; // for(unsigned int i = 0; i < c.getNbFingerings(); ++i) { // dbg << "\nFingering " << i << " : " << c.getFingering(i).toString().c_str(); // } Rosegarden::Guitar::Fingering f = c.getFingering(); dbg << ", fingering : "; for(unsigned int j = 0; j < 6; ++j) { int pos = f[j]; if (pos >= 0) dbg << pos << ' '; else dbg << "x "; } return dbg; } #ifdef NOT_DEFINED ostream& kdbgostreamAdapter::operator<<(bool i) { m_kdbgStream << i; return *this; } ostream& kdbgostreamAdapter::operator<<(short i) { m_kdbgStream << i; return *this; } ostream& kdbgostreamAdapter::operator<<(unsigned short i) { m_kdbgStream << i; return *this; } ostream& kdbgostreamAdapter::operator<<(char i) { m_kdbgStream << i; return *this; } ostream& kdbgostreamAdapter::operator<<(unsigned char i) { m_kdbgStream << i; return *this; } ostream& kdbgostreamAdapter::operator<<(int i) { m_kdbgStream << i; return *this; } ostream& kdbgostreamAdapter::operator<<(unsigned int i) { m_kdbgStream << i; return *this; } ostream& kdbgostreamAdapter::operator<<(long i) { m_kdbgStream << i; return *this; } ostream& kdbgostreamAdapter::operator<<(unsigned long i) { m_kdbgStream << i; return *this; } ostream& kdbgostreamAdapter::operator<<(const TQString& string) { m_kdbgStream << string; return *this; } ostream& kdbgostreamAdapter::operator<<(const char *string) { m_kdbgStream << string; return *this; } ostream& kdbgostreamAdapter::operator<<(const TQCString& string) { m_kdbgStream << string; return *this; } ostream& kdbgostreamAdapter::operator<<(void * p) { m_kdbgStream << p; return *this; } ostream& kdbgostreamAdapter::operator<<(KDBGFUNC f) { (*f)(m_kdbgStream); return *this; } ostream& kdbgostreamAdapter::operator<<(double d) { m_kdbgStream << d; return *this; } #endif // ostream& endl( ostream &s) // { // s << "\n"; return s; // } // void DBCheckThrow() // { // using Rosegarden::Int; // Rosegarden::Event ev; // try { // int pitch = ev.get("BLAH"); // } catch (Rosegarden::Event::NoData) { // RG_DEBUG << "DBCheckThrow()" << endl; // } // } #endif