Show "boolean:", "int64:" and "uint64:" in front of the value, like the other node kinds, so a bare number is not ambiguous. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
139 lines
9.2 KiB
Django/Jinja
139 lines
9.2 KiB
Django/Jinja
<?xml version="1.0" encoding="utf-8"?>
|
|
|
|
<!-- * * * * * * * * AUTO-GENERATED FILE * * * * * * * * -->
|
|
<!-- Edit ./tools/generate_natvis/nlohmann_json.natvis.j2 -->
|
|
<!-- * * * * * * * * AUTO-GENERATED FILE * * * * * * * * -->
|
|
|
|
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
|
|
{# The children of the container node `node` (a pointer expression) of the document `doc` (a document_data pointer
|
|
expression). A node is only an index into the source text: strings are read from `doc`, so the strings of the
|
|
direct children are readable here, but the children of a nested container are shown as nodes (see the node
|
|
visualizer below). Containers with edits (flag 8, "moved") are not expanded. The node kinds are the numbers of
|
|
node_kind: 1 object, 2 array, 3 string; the float token is shown only by the node visualizer. #}
|
|
{% macro children(node, doc=none) %}
|
|
<CustomListItems MaxItemsPerView="1000">
|
|
<Variable Name="nd" InitialValue="{{ node }}" />
|
|
<Variable Name="obj" InitialValue="nd != 0 && (int)nd->kind == 1" />
|
|
<Variable Name="n" InitialValue="(nd != 0 && ((int)nd->kind == 1 || (int)nd->kind == 2) && (nd->flags & 8) == 0) ? (int)nd->len : 0" />
|
|
<Variable Name="p" InitialValue="nd + 1" />
|
|
<Variable Name="i" InitialValue="0" />
|
|
<Size>obj ? 2 * n : n</Size>
|
|
<Loop Condition="i < n">
|
|
{% if doc %}
|
|
<Item Name="key" Condition="obj">{{ doc }}->base._Elems[p->flags & 3] + p->off,[p->len]s8</Item>
|
|
{% else %}
|
|
<Item Name="key" Condition="obj">*p</Item>
|
|
{% endif %}
|
|
<Exec Condition="obj">p = p + 1</Exec>
|
|
{% if doc %}
|
|
<Item Name="value" Condition="obj && (int)p->kind == 3">{{ doc }}->base._Elems[p->flags & 3] + p->off,[p->len]s8</Item>
|
|
{% endif %}
|
|
<Item Name="value" Condition="obj{% if doc %} && (int)p->kind != 3{% endif %}">*p</Item>
|
|
{% if doc %}
|
|
<Item Condition="!obj && (int)p->kind == 3">{{ doc }}->base._Elems[p->flags & 3] + p->off,[p->len]s8</Item>
|
|
{% endif %}
|
|
<Item Condition="!obj{% if doc %} && (int)p->kind != 3{% endif %}">*p</Item>
|
|
<Exec>p = p + (((int)p->kind == 1 || (int)p->kind == 2) ? p->next : 1)</Exec>
|
|
<Exec>i = i + 1</Exec>
|
|
</Loop>
|
|
</CustomListItems>
|
|
{%- endmacro %}
|
|
{% for ns in namespaces %}
|
|
<!-- Namespace {{ ns }} -->
|
|
<Type Name="{{ ns }}::basic_json<*>">
|
|
<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_data.m_type == {{ ns }}::detail::value_t::object">
|
|
*(m_data.m_value.object),view(simple)
|
|
</ExpandedItem>
|
|
<ExpandedItem Condition="m_data.m_type == {{ ns }}::detail::value_t::array">
|
|
*(m_data.m_value.array),view(simple)
|
|
</ExpandedItem>
|
|
</Expand>
|
|
</Type>
|
|
|
|
<!-- Skip the pair first/second members in the treeview while traversing a map.
|
|
Only works in VS 2015 Update 2 and beyond using the new visualization -->
|
|
<Type Name="std::pair<*, {{ ns }}::basic_json<*>>" IncludeView="MapHelper">
|
|
<DisplayString>{second}</DisplayString>
|
|
<Expand>
|
|
<ExpandedItem>second</ExpandedItem>
|
|
</Expand>
|
|
</Type>
|
|
|
|
<!-- Fallback for when the basic_json entry above does not match: json_default_base is the (empty) default
|
|
base class of basic_json, and base class visualizers are inherited by derived types and evaluated
|
|
against the derived object, so m_data is accessible here. The class lives in {{ ns }} after
|
|
3.12.0 (#5238) and in {{ ns }}::detail up to 3.12.0, so both names are listed. -->
|
|
{% for default_base in ['json_default_base', 'detail::json_default_base'] %}
|
|
<Type Name="{{ ns }}::{{ default_base }}">
|
|
<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_data.m_type == {{ ns }}::detail::value_t::object">
|
|
*(m_data.m_value.object),view(simple)
|
|
</ExpandedItem>
|
|
<ExpandedItem Condition="m_data.m_type == {{ ns }}::detail::value_t::array">
|
|
*(m_data.m_value.array),view(simple)
|
|
</ExpandedItem>
|
|
</Expand>
|
|
</Type>
|
|
|
|
{% endfor %}
|
|
|
|
<!-- json_view / json_document (include/nlohmann/json_view.hpp). They live in the same inline namespaces as
|
|
basic_json, so the ABI tags need no extra entries; the view_mode is a template argument that the wildcard
|
|
covers. A view is a pointer to the document's data and a pointer to a node of its flat index; the
|
|
strings of the source are found through document_data::base (std::array of the MSVC STL: _Elems). -->
|
|
<Type Name="{{ ns }}::detail::view::node">
|
|
<DisplayString Condition="(int)kind == 0">null</DisplayString>
|
|
<DisplayString Condition="(int)kind == 1">object, size={len}</DisplayString>
|
|
<DisplayString Condition="(int)kind == 2">array, size={len}</DisplayString>
|
|
<DisplayString Condition="(int)kind == 3">string, length={len}</DisplayString>
|
|
<DisplayString Condition="(int)kind == 4">boolean: {(flags & 4) != 0}</DisplayString>
|
|
<DisplayString Condition="(int)kind == 5">int64: {(__int64)((unsigned __int64)len | ((unsigned __int64)next << 32))}</DisplayString>
|
|
<DisplayString Condition="(int)kind == 6">uint64: {(unsigned __int64)len | ((unsigned __int64)next << 32)}</DisplayString>
|
|
<DisplayString Condition="(int)kind == 7">float, length={len}</DisplayString>
|
|
<DisplayString>link</DisplayString>
|
|
<Expand>
|
|
{{ children('this') }}
|
|
</Expand>
|
|
</Type>
|
|
|
|
<Type Name="{{ ns }}::basic_json_view<*,*>">
|
|
<DisplayString Condition="m_node == 0">discarded</DisplayString>
|
|
<DisplayString Condition="(int)m_node->kind == 3">{m_doc->base._Elems[m_node->flags & 3] + m_node->off,[m_node->len]s8}</DisplayString>
|
|
<DisplayString Condition="(int)m_node->kind == 7">{m_doc->base._Elems[m_node->flags & 3] + m_node->off,[m_node->len]s8b}</DisplayString>
|
|
<DisplayString>{*m_node}</DisplayString>
|
|
<Expand>
|
|
{{ children('m_node', 'm_doc') }}
|
|
</Expand>
|
|
</Type>
|
|
|
|
<Type Name="{{ ns }}::basic_json_document<*,*>">
|
|
<DisplayString Condition="m_data._Mypair._Myval2 == 0 || m_data._Mypair._Myval2->discarded">discarded</DisplayString>
|
|
<DisplayString>{*m_data._Mypair._Myval2->nodes}</DisplayString>
|
|
<Expand>
|
|
<Item Name="[source]" Condition="m_data._Mypair._Myval2 != 0">m_data._Mypair._Myval2->src,[m_data._Mypair._Myval2->size]s8b</Item>
|
|
<Item Name="[nodes]" Condition="m_data._Mypair._Myval2 != 0">m_data._Mypair._Myval2->node_count</Item>
|
|
{{ children('m_data._Mypair._Myval2->nodes', 'm_data._Mypair._Myval2') }}
|
|
</Expand>
|
|
</Type>
|
|
{% endfor %}
|
|
</AutoVisualizer>
|