| 1051 | #include "ECLog.h" |
| 1052 | |
| 1053 | void CECTag::DebugPrint(int level, bool print_empty) const |
| 1054 | { |
| 1055 | if (m_dataLen || print_empty) { |
| 1056 | wxString space; |
| 1057 | for (int i = level; i--;) space += " "; |
| 1058 | wxString s1 = CFormat("%s%s %d = ") % space % GetDebugNameECTagNames(m_tagName) % m_dataLen; |
| 1059 | wxString s2; |
| 1060 | switch (m_tagName) { |
| 1061 | case EC_TAG_DETAIL_LEVEL: |
| 1062 | s2 = GetDebugNameEC_DETAIL_LEVEL(GetInt()); break; |
| 1063 | case EC_TAG_SEARCH_TYPE: |
| 1064 | s2 = GetDebugNameEC_SEARCH_TYPE(GetInt()); break; |
| 1065 | case EC_TAG_STAT_VALUE_TYPE: |
| 1066 | s2 = GetDebugNameEC_STATTREE_NODE_VALUE_TYPE(GetInt()); break; |
| 1067 | default: |
| 1068 | switch (m_dataType) { |
| 1069 | case EC_TAGTYPE_UINT8: |
| 1070 | case EC_TAGTYPE_UINT16: |
| 1071 | case EC_TAGTYPE_UINT32: |
| 1072 | case EC_TAGTYPE_UINT64: |
| 1073 | s2 = CFormat("%d") % GetInt(); break; |
| 1074 | case EC_TAGTYPE_STRING: |
| 1075 | s2 = GetStringData(); break; |
| 1076 | case EC_TAGTYPE_DOUBLE: |
| 1077 | s2 = CFormat("%.1f") % GetDoubleData(); break; |
| 1078 | case EC_TAGTYPE_HASH16: |
| 1079 | s2 = GetMD4Data().Encode(); break; |
| 1080 | case EC_TAGTYPE_UINT128: |
| 1081 | // Using any non-inline function from UInt128.h would break linkage |
| 1082 | // of remote apps otherwise not using CUInt128. So just fall through |
| 1083 | // and display the value as a byte-stream. Since the value is sent |
| 1084 | // big-endian on the network, the visual result is correct, except |
| 1085 | // for the intervening spaces... |
| 1086 | //s2 = GetInt128Data().ToHexString(); break; |
| 1087 | case EC_TAGTYPE_CUSTOM: |
| 1088 | if (m_dataLen == 0) { |
| 1089 | s2 = "empty"; |
| 1090 | } else { |
| 1091 | // Make a hex dump (limited to maxOutput) |
| 1092 | const uint32 maxOutput = 50; |
| 1093 | for (uint32 i = 0; i < m_dataLen; i++) { |
| 1094 | if (i == maxOutput) { |
| 1095 | s2 += "..."; |
| 1096 | break; |
| 1097 | } |
| 1098 | s2 += CFormat("%02X ") % (unsigned char) m_tagData[i]; |
| 1099 | } |
| 1100 | } |
| 1101 | break; |
| 1102 | default: |
| 1103 | s2 = GetDebugNameECTagTypes(m_dataType); |
| 1104 | } |
| 1105 | } |
| 1106 | DoECLogLine(s1 + s2); |
| 1107 | } |
| 1108 | for (TagList::const_iterator it = m_tagList.begin(); it != m_tagList.end(); ++it) { |
| 1109 | it->DebugPrint(level + 1, true); |
| 1110 | } |
no test coverage detected