答案 0 :(得分:1)
修改:我已将此文件添加到visualstudio-debugger repository on GitHub。
Edit2:此问题的另外两个答案已链接到其他github存储库(我还没有检查出来)。出于某种原因,他们被管理员删除了(我不知道为什么),所以他们在这里:
由于没有人得到答案(有些人认为这是因为某些原因这是关于stackoverflow的主题)我写了自己的,这里是。使用风险由您自己承担。
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<!-- Json::Value - basic support -->
<Type Name="Json::Value">
<DisplayString Condition="type_ == 0">null</DisplayString>
<DisplayString Condition="type_ == 1">{value_.int_}</DisplayString>
<DisplayString Condition="type_ == 2">{value_.uint_}</DisplayString>
<DisplayString Condition="type_ == 3">{value_.real_}</DisplayString>
<DisplayString Condition="type_ == 4">{value_.string_,s8}</DisplayString>
<DisplayString Condition="type_ == 5">{value_.bool_}</DisplayString>
<DisplayString Condition="type_ == 6">array ({value_.map_->_Mysize})</DisplayString>
<DisplayString Condition="type_ == 7">object ({value_.map_->_Mysize})</DisplayString>
<DisplayString >Unknown Value type!</DisplayString>
<StringView Condition="type_ == 4">value_.string_,s8</StringView>
<Expand>
<ExpandedItem Condition="type_ == 6">*(value_.map_)</ExpandedItem>
<ExpandedItem Condition="type_ == 7">*(value_.map_)</ExpandedItem>
</Expand>
</Type>
<!-- Key/value pairs - used as values for objects and arrays (in arrays the key is null so don't display it) -->
<Type Name="std::pair<Json::Value::CZString const ,Json::Value>">
<DisplayString Condition="first.cstr_ != nullptr">{first.cstr_,s8}: {second}</DisplayString>
<DisplayString>{second}</DisplayString>
<Expand>
<Item Name="key" Condition="first.cstr_ != nullptr">first.cstr_</Item>
<Item Name="value" Condition="first.cstr_ != nullptr">second</Item>
<ExpandedItem>second</ExpandedItem>
</Expand>
</Type>
</AutoVisualizer>
答案 1 :(得分:1)
基于Dmitry Yastrebkov的(已删除)答案,我做出了以下似乎对我很好的工作:
<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
<Type Name="std::map<*>" IncludeView="jsoncpp">
<Expand>
<TreeItems>
<Size>_Mypair._Myval2._Myval2._Mysize</Size>
<HeadPointer>_Mypair._Myval2._Myval2._Myhead->_Parent</HeadPointer>
<LeftPointer>_Left</LeftPointer>
<RightPointer>_Right</RightPointer>
<ValueNode Condition="_Isnil == 0 && true" Name="{_Myval,view(jsonname)}">_Myval,view(jsoncpp)</ValueNode>
</TreeItems>
</Expand>
</Type>
<Type Name="std::pair<*>" IncludeView="jsonname">
<DisplayString Condition="first.cstr_ == nullptr">[{first.index_}]</DisplayString>
<DisplayString Condition="first.cstr_ != nullptr">{first.cstr_,s8}</DisplayString>
</Type>
<Type Name="std::pair<*>" IncludeView="jsoncpp">
<DisplayString Condition="second.type_ == 0 && true">null</DisplayString>
<DisplayString Condition="second.type_ == 1 && true">{second.value_.int_}</DisplayString>
<DisplayString Condition="second.type_ == 2 && true">{second.value_.uint_}</DisplayString>
<DisplayString Condition="second.type_ == 3 && true">{second.value_.real_}</DisplayString>
<DisplayString Condition="second.type_ == 4 && true">{second.value_.string_,s8}</DisplayString>
<DisplayString Condition="second.type_ == 5 && true">{second.value_.bool_}</DisplayString>
<DisplayString Condition="second.type_ == 6 && true">array({second.value_.map_->_Mypair._Myval2._Myval2._Mysize})</DisplayString>
<DisplayString Condition="second.type_ == 7 && true">object({second.value_.map_->_Mypair._Myval2._Myval2._Mysize})</DisplayString>
<StringView Condition="second.type_ == 1 && first.cstr_ != nullptr">first.cstr_,s8</StringView>
<StringView Condition="second.type_ == 2 && first.cstr_ != nullptr">first.cstr_,s8</StringView>
<StringView Condition="second.type_ == 3 && first.cstr_ != nullptr">first.cstr_,s8</StringView>
<StringView Condition="second.type_ == 4 && true">second.value_.string_,s8</StringView>
<StringView Condition="second.type_ == 5 && first.cstr_ != nullptr">first.cstr_,s8</StringView>
<StringView Condition="second.type_ == 6 && first.cstr_ != nullptr">first.cstr_,s8</StringView>
<StringView Condition="second.type_ == 7 && first.cstr_ != nullptr">first.cstr_,s8</StringView>
<Expand>
<ExpandedItem Condition="second.type_ == 6">*(second.value_.map_),view(jsoncpp)</ExpandedItem>
<ExpandedItem Condition="second.type_ == 7">*(second.value_.map_),view(jsoncpp)</ExpandedItem>
</Expand>
</Type>
<Type Name="Json::Value">
<Expand>
<ExpandedItem Condition="type_ == 6">*(value_.map_),view(jsoncpp)</ExpandedItem>
<ExpandedItem Condition="type_ == 7">*(value_.map_),view(jsoncpp)</ExpandedItem>
</Expand>
</Type>
</AutoVisualizer>