mirror of
https://github.com/nlohmann/json.git
synced 2026-09-16 13:17:59 +00:00
🔀 merge develop
This commit is contained in:
@@ -17,16 +17,16 @@ def json_lookup_function(val):
|
||||
if m := ns_pattern.fullmatch(str(val.type.strip_typedefs().name)):
|
||||
name = m.group('name')
|
||||
if name and name.startswith('basic_json<') and name.endswith('>'):
|
||||
m = ns_pattern.fullmatch(str(val['m_type']))
|
||||
m = ns_pattern.fullmatch(str(val["m_data"]['m_type']))
|
||||
t = m.group('name')
|
||||
if t and t.startswith('detail::value_t::'):
|
||||
try:
|
||||
union_val = val['m_value'][t.removeprefix('detail::value_t::')]
|
||||
union_val = val["m_data"]['m_value'][t.removeprefix('detail::value_t::')]
|
||||
if union_val.type.code == gdb.TYPE_CODE_PTR:
|
||||
return gdb.default_visualizer(union_val.dereference())
|
||||
else:
|
||||
return JsonValuePrinter(union_val)
|
||||
except Exception:
|
||||
return JsonValuePrinter(val['m_type'])
|
||||
return JsonValuePrinter(val["m_data"]['m_type'])
|
||||
|
||||
gdb.pretty_printers.append(json_lookup_function)
|
||||
|
||||
@@ -8,21 +8,21 @@
|
||||
{% for ns in namespaces %}
|
||||
<!-- Namespace {{ ns }} -->
|
||||
<Type Name="{{ ns }}::basic_json<*>">
|
||||
<DisplayString Condition="m_type == {{ ns }}::detail::value_t::null">null</DisplayString>
|
||||
<DisplayString Condition="m_type == {{ ns }}::detail::value_t::object">{*(m_value.object)}</DisplayString>
|
||||
<DisplayString Condition="m_type == {{ ns }}::detail::value_t::array">{*(m_value.array)}</DisplayString>
|
||||
<DisplayString Condition="m_type == {{ ns }}::detail::value_t::string">{*(m_value.string)}</DisplayString>
|
||||
<DisplayString Condition="m_type == {{ ns }}::detail::value_t::boolean">{m_value.boolean}</DisplayString>
|
||||
<DisplayString Condition="m_type == {{ ns }}::detail::value_t::number_integer">{m_value.number_integer}</DisplayString>
|
||||
<DisplayString Condition="m_type == {{ ns }}::detail::value_t::number_unsigned">{m_value.number_unsigned}</DisplayString>
|
||||
<DisplayString Condition="m_type == {{ ns }}::detail::value_t::number_float">{m_value.number_float}</DisplayString>
|
||||
<DisplayString Condition="m_type == {{ ns }}::detail::value_t::discarded">discarded</DisplayString>
|
||||
<DisplayString Condition="m_data.m_type == {{ ns }}::detail::value_t::null">null</DisplayString>
|
||||
<DisplayString Condition="m_data.m_type == {{ ns }}::detail::value_t::object">{*(m_data.m_value.object)}</DisplayString>
|
||||
<DisplayString Condition="m_data.m_type == {{ ns }}::detail::value_t::array">{*(m_data.m_value.array)}</DisplayString>
|
||||
<DisplayString Condition="m_data.m_type == {{ ns }}::detail::value_t::string">{*(m_data.m_value.string)}</DisplayString>
|
||||
<DisplayString Condition="m_data.m_type == {{ ns }}::detail::value_t::boolean">{m_data.m_value.boolean}</DisplayString>
|
||||
<DisplayString Condition="m_data.m_type == {{ ns }}::detail::value_t::number_integer">{m_data.m_value.number_integer}</DisplayString>
|
||||
<DisplayString Condition="m_data.m_type == {{ ns }}::detail::value_t::number_unsigned">{m_data.m_value.number_unsigned}</DisplayString>
|
||||
<DisplayString Condition="m_data.m_type == {{ ns }}::detail::value_t::number_float">{m_data.m_value.number_float}</DisplayString>
|
||||
<DisplayString Condition="m_data.m_type == {{ ns }}::detail::value_t::discarded">discarded</DisplayString>
|
||||
<Expand>
|
||||
<ExpandedItem Condition="m_type == {{ ns }}::detail::value_t::object">
|
||||
*(m_value.object),view(simple)
|
||||
<ExpandedItem Condition="m_data.m_type == {{ ns }}::detail::value_t::object">
|
||||
*(m_data.m_value.object),view(simple)
|
||||
</ExpandedItem>
|
||||
<ExpandedItem Condition="m_type == {{ ns }}::detail::value_t::array">
|
||||
*(m_value.array),view(simple)
|
||||
<ExpandedItem Condition="m_data.m_type == {{ ns }}::detail::value_t::array">
|
||||
*(m_data.m_value.array),view(simple)
|
||||
</ExpandedItem>
|
||||
</Expand>
|
||||
</Type>
|
||||
|
||||
Reference in New Issue
Block a user