Skip to content

Commit d630551

Browse files
authored
Merge pull request Tencent#1030 from bmuzzin/issue1028_natvis
Issue Tencent#1028: Visual Studio natvis file.
2 parents c34e3df + 707fd36 commit d630551

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed

contrib/natvis/LICENSE

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2017 Bart Muzzin
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+
23+
Derived from:
24+
25+
The MIT License (MIT)
26+
27+
Copyright (c) 2015 mojmir svoboda
28+
29+
Permission is hereby granted, free of charge, to any person obtaining a copy
30+
of this software and associated documentation files (the "Software"), to deal
31+
in the Software without restriction, including without limitation the rights
32+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
33+
copies of the Software, and to permit persons to whom the Software is
34+
furnished to do so, subject to the following conditions:
35+
36+
The above copyright notice and this permission notice shall be included in all
37+
copies or substantial portions of the Software.
38+
39+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
40+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
41+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
42+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
43+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
44+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
45+
SOFTWARE.

contrib/natvis/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# rapidjson.natvis
2+
3+
This file can be used as a [Visual Studio Visualizer](https://docs.microsoft.com/en-gb/visualstudio/debugger/create-custom-views-of-native-objects) to aid in visualizing rapidjson structures within the Visual Studio debugger. Natvis visualizers are supported in Visual Studio 2012 and later. To install, copy the file into this directory:
4+
5+
`%USERPROFILE%\Documents\Visual Studio 2012\Visualizers`
6+
7+
Each version of Visual Studio has a similar directory, it must be copied into each directory to be used with that particular version. In Visual Studio 2015 and later, this can be done without restarting Visual Studio (a new debugging session must be started).

contrib/natvis/rapidjson.natvis

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
3+
<!-- rapidjson::GenericValue - basic support -->
4+
<Type Name="rapidjson::GenericValue&lt;*,*&gt;">
5+
<DisplayString Condition="(data_.f.flags &amp; kTypeMask) == kNullType">null</DisplayString>
6+
<DisplayString Condition="data_.f.flags == kTrueFlag">true</DisplayString>
7+
<DisplayString Condition="data_.f.flags == kFalseFlag">false</DisplayString>
8+
<DisplayString Condition="data_.f.flags == kShortStringFlag">{data_.ss.str}</DisplayString>
9+
<DisplayString Condition="(data_.f.flags &amp; kTypeMask) == kStringType">{(const char*)((size_t)data_.s.str &amp; 0x0000FFFFFFFFFFFF)}</DisplayString>
10+
<DisplayString Condition="(data_.f.flags &amp; kNumberIntFlag) == kNumberIntFlag">{data_.n.i.i}</DisplayString>
11+
<DisplayString Condition="(data_.f.flags &amp; kNumberUintFlag) == kNumberUintFlag">{data_.n.u.u}</DisplayString>
12+
<DisplayString Condition="(data_.f.flags &amp; kNumberInt64Flag) == kNumberInt64Flag">{data_.n.i64}</DisplayString>
13+
<DisplayString Condition="(data_.f.flags &amp; kNumberUint64Flag) == kNumberUint64Flag">{data_.n.u64}</DisplayString>
14+
<DisplayString Condition="(data_.f.flags &amp; kNumberDoubleFlag) == kNumberDoubleFlag">{data_.n.d}</DisplayString>
15+
<DisplayString Condition="data_.f.flags == kObjectType">Object members={data_.o.size}</DisplayString>
16+
<DisplayString Condition="data_.f.flags == kArrayType">Array members={data_.a.size}</DisplayString>
17+
<Expand>
18+
<Item Condition="data_.f.flags == kObjectType" Name="[size]">data_.o.size</Item>
19+
<Item Condition="data_.f.flags == kObjectType" Name="[capacity]">data_.o.capacity</Item>
20+
<ArrayItems Condition="data_.f.flags == kObjectType">
21+
<Size>data_.o.size</Size>
22+
<!-- NOTE: Rapidjson stores some extra data in the high bits of pointers, which is why the mask -->
23+
<ValuePointer>(rapidjson::GenericMember&lt;$T1,$T2&gt;*)(((size_t)data_.o.members) &amp; 0x0000FFFFFFFFFFFF)</ValuePointer>
24+
</ArrayItems>
25+
26+
<Item Condition="data_.f.flags == kArrayType" Name="[size]">data_.a.size</Item>
27+
<Item Condition="data_.f.flags == kArrayType" Name="[capacity]">data_.a.capacity</Item>
28+
<ArrayItems Condition="data_.f.flags == kArrayType">
29+
<Size>data_.a.size</Size>
30+
<!-- NOTE: Rapidjson stores some extra data in the high bits of pointers, which is why the mask -->
31+
<ValuePointer>(rapidjson::GenericValue&lt;$T1,$T2&gt;*)(((size_t)data_.a.elements) &amp; 0x0000FFFFFFFFFFFF)</ValuePointer>
32+
</ArrayItems>
33+
34+
</Expand>
35+
</Type>
36+
37+
</AutoVisualizer>
38+

0 commit comments

Comments
 (0)