#ifndef OUTPUTOPERATORS_H #define OUTPUTOPERATORS_H #include "won.h" #include "LIST" #include // RawBuffer // Outputs "[val val ... (ascii)]" inline ostream& operator<<(ostream& os, const WONCommon::RawBuffer& theBuffer) { string aPrint; os << '[' << std::hex; for (int i=0; i < theBuffer.size(); i++) { if (i > 0) os << ' '; os << static_cast(theBuffer[i]); if (isprint(theBuffer[i])) aPrint += static_cast(theBuffer[i]); } if (! aPrint.empty()) os << " (" << aPrint << ')'; os << std::dec << ']'; return os; } // std::list // Outputs "[elt1,elt2,...,eltN]" inline ostream& operator<<(ostream& os, const std::list& theList) { os << "["; bool bFirstElement = true; std::list::const_iterator itr = theList.begin(); for (; itr != theList.end(); itr++) { if (!bFirstElement) os << ","; os << *itr; bFirstElement = false; } os << "]"; return os; } #endif // OUTPUTOPERATORS_H