void CECTag::DebugPrint(int level, bool print_empty) const { if (m_dataLen || print_empty) { wxString space; for (int i = level; i--;) space += wxT(" "); wxString s1 = CFormat(wxT("%s%s %d = ")) % space % GetDebugNameECTagNames(m_tagName) % m_dataLen; wxString s2; switch (m_tagName) { case EC_TAG_DETAIL_LEVEL: s2 = GetDebugNameEC_DETAIL_LEVEL(GetInt()); break; case EC_TAG_SEARCH_TYPE: s2 = GetDebugNameEC_SEARCH_TYPE(GetInt()); break; case EC_TAG_STAT_VALUE_TYPE: s2 = GetDebugNameEC_STATTREE_NODE_VALUE_TYPE(GetInt()); break; default: switch (m_dataType) { case EC_TAGTYPE_UINT8: case EC_TAGTYPE_UINT16: case EC_TAGTYPE_UINT32: case EC_TAGTYPE_UINT64: s2 = CFormat(wxT("%d")) % GetInt(); break; case EC_TAGTYPE_STRING: s2 = GetStringData(); break; case EC_TAGTYPE_DOUBLE: s2 = CFormat(wxT("%.1f")) % GetDoubleData(); break; case EC_TAGTYPE_HASH16: s2 = GetMD4Data().Encode(); break; case EC_TAGTYPE_UINT128: // Using any non-inline function from UInt128.h would break linkage // of remote apps otherwise not using CUInt128. So just fall through // and display the value as a byte-stream. Since the value is sent // big-endian on the network, the visual result is correct, except // for the intervening spaces... //s2 = GetInt128Data().ToHexString(); break; case EC_TAGTYPE_CUSTOM: if (m_dataLen == 0) { s2 = wxT("empty"); } else { // Make a hex dump (limited to maxOutput) const uint32 maxOutput = 50; for (uint32 i = 0; i < m_dataLen; i++) { if (i == maxOutput) { s2 += wxT("..."); break; } s2 += CFormat(wxT("%02X ")) % (unsigned char) m_tagData[i]; } } break; default: s2 = GetDebugNameECTagTypes(m_dataType); } } DoECLogLine(s1 + s2); } for (TagList::const_iterator it = m_tagList.begin(); it != m_tagList.end(); ++it) { it->DebugPrint(level + 1, true); } }
void CECTag::DebugPrint(int level, bool print_empty) const { if (m_dataLen || print_empty) { wxString space; for (int i = level; i--;) space += wxT(" "); wxString s1 = CFormat(wxT("%s%s %d = ")) % space % GetDebugNameECTagNames(m_tagName) % m_dataLen; wxString s2; switch (m_tagName) { case EC_TAG_DETAIL_LEVEL: s2 = GetDebugNameEC_DETAIL_LEVEL(GetInt()); break; case EC_TAG_SEARCH_TYPE: s2 = GetDebugNameEC_SEARCH_TYPE(GetInt()); break; case EC_TAG_STAT_VALUE_TYPE: s2 = GetDebugNameEC_STATTREE_NODE_VALUE_TYPE(GetInt()); break; default: switch (m_dataType) { case EC_TAGTYPE_UINT8: case EC_TAGTYPE_UINT16: case EC_TAGTYPE_UINT32: case EC_TAGTYPE_UINT64: s2 = CFormat(wxT("%d")) % GetInt(); break; case EC_TAGTYPE_STRING: s2 = GetStringData(); break; case EC_TAGTYPE_DOUBLE: s2 = CFormat(wxT("%.1f")) % GetDoubleData(); break; case EC_TAGTYPE_HASH16: s2 = GetMD4Data().Encode(); break; case EC_TAGTYPE_CUSTOM: if (m_dataLen == 0) { s2 = wxT("empty"); } else { // Make a hex dump (limited to maxOutput) const uint32 maxOutput = 50; for (uint32 i = 0; i < m_dataLen; i++) { if (i == maxOutput) { s2 += wxT("..."); break; } s2 += CFormat(wxT("%02X ")) % (unsigned char) m_tagData[i]; } } break; default: s2 = GetDebugNameECTagTypes(m_dataType); } } DoECLogLine(s1 + s2); } for (TagList::const_iterator it = m_tagList.begin(); it != m_tagList.end(); ++it) { it->DebugPrint(level + 1, true); } }