Skip to content

Commit 043d48f

Browse files
committed
Update readme and UD C++ examples.
1 parent 6258c48 commit 043d48f

File tree

2 files changed

+80
-24
lines changed

2 files changed

+80
-24
lines changed

README.md

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,17 @@ Options for each Watch can be found under **Tools**->**Options**->**Graphical De
183183

184184
##### User-defined types
185185

186-
The extension offers basic support for user-defined point types. You can define points in XML file based on type identifier and X and Y members and set path to this file in options under **Tools**->**Options**->**Graphical Debugging**->**General**. An example XML file defining C++ type `MyPoint` in global namespace looks like this:
186+
The extension offers support for the following user-defined geometries for both C++ and C# types:
187+
188+
* Point
189+
* MultiPoint
190+
* Linestring
191+
* MultiLinestring
192+
* Ring (polygon without holes)
193+
* Polygon (polygon with holes)
194+
* MultiPolygon
195+
196+
They can be defined in XML file similar to *.natvis file. Path to this file can be set in options under **Tools**->**Options**->**Graphical Debugging**->**General**. An example XML file defining C++ types `MyPoint`, `MyRing` and `MyPolygon` in global namespace might look like this:
187197

188198
```
189199
<?xml version="1.0" encoding="utf-8"?>
@@ -196,15 +206,35 @@ The extension offers basic support for user-defined point types. You can define
196206
</Coordinates>
197207
</Point>
198208
209+
<Ring Id="MyRing">
210+
<Points>
211+
<Array>
212+
<Pointer>points_ptr</Pointer>
213+
<Size>points_size</Size>
214+
</Array>
215+
</Points>
216+
</Ring>
217+
218+
<Polygon Id="MyPolygon">
219+
<ExteriorRing>
220+
<Name>outer</Name>
221+
</ExteriorRing>
222+
<InteriorRings>
223+
<Container>
224+
<Name>inners</Name>
225+
</Container>
226+
</InteriorRings>
227+
</Polygon>
228+
199229
</GraphicalDebugging>
200230
```
201231

202-
Basic support has limitations:
232+
Current limitations:
203233

204-
* based on identifier so no template parameters, no specializations
234+
* only one entry per type
235+
* based on identifier, no template specializations
205236
* no support for user-defined coordinate system, cartesian is used by default
206-
207-
Let me know if you need something more advanced.
237+
* non-contigeous containers can be used only if this extension natively supports them
208238

209239
See more [examples at GitHub](https://github.com/awulkiew/graphical-debugging/tree/master/examples).
210240

examples/cpp.xml

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,27 +44,28 @@
4444
</Point>
4545

4646
<!--
47-
struct MyLinestring : std::vector<MyPoint>
48-
{ };
47+
struct MyLinestring
48+
{
49+
std::vector<MyPoint> points;
50+
};
4951
-->
5052
<Linestring Id="MyLinestring">
5153
<Points>
5254
<Container>
53-
<Name>(std::vector&lt;MyPoint,std::allocator&lt;MyPoint&gt; &gt;&amp;)(*this)</Name>
55+
<Name>points</Name>
5456
</Container>
5557
</Points>
5658
</Linestring>
5759

5860
<!--
59-
struct MyLinestring2
60-
{
61-
std::vector<MyPoint> points;
62-
};
61+
template <typename Point>
62+
struct MyLinestring2 : std::vector<Point>
63+
{ };
6364
-->
6465
<Linestring Id="MyLinestring2">
6566
<Points>
6667
<Container>
67-
<Name>points</Name>
68+
<Name>(std::vector&lt;$T0,std::allocator&lt;$T0&gt; &gt;&amp;)(*this)</Name>
6869
</Container>
6970
</Points>
7071
</Linestring>
@@ -98,10 +99,29 @@
9899
</Ring>
99100

100101
<!--
101-
struct MyPolygon : std::vector<MyRing>
102-
{ };
102+
struct MyPolygon
103+
{
104+
MyRing outer;
105+
std::vector<MyRing> inners;
106+
};
103107
-->
104108
<Polygon Id="MyPolygon">
109+
<ExteriorRing>
110+
<Name>outer</Name>
111+
</ExteriorRing>
112+
<InteriorRings>
113+
<Container>
114+
<Name>inners</Name>
115+
</Container>
116+
<!--Offset>0</Offset-->
117+
</InteriorRings>
118+
</Polygon>
119+
120+
<!--
121+
struct MyPolygon2 : std::vector<MyRing>
122+
{ };
123+
-->
124+
<Polygon Id="MyPolygon2">
105125
<ExteriorRing>
106126
<Name>(*_Mypair._Myval2._Myfirst)</Name>
107127
</ExteriorRing>
@@ -114,37 +134,43 @@
114134
</Polygon>
115135

116136
<!--
117-
struct MyMultiPoint : std::vector<MyPoint>
118-
{ };
137+
struct MyMultiPoint
138+
{
139+
std::vector<MyPoint> points;
140+
};
119141
-->
120142
<MultiPoint Id="MyMultiPoint">
121143
<Points>
122144
<Container>
123-
<Name>(std::vector&lt;MyPoint,std::allocator&lt;MyPoint&gt; &gt;&amp;)(*this)</Name>
145+
<Name>points</Name>
124146
</Container>
125147
</Points>
126148
</MultiPoint>
127149

128150
<!--
129-
struct MyMultiLinestring : std::vector<MyLinestring>
130-
{ };
151+
struct MyMultiLinestring
152+
{
153+
std::vector<MyLinestring> linestrings;
154+
};
131155
-->
132156
<MultiLinestring Id="MyMultiLinestring">
133157
<Linestrings>
134158
<Container>
135-
<Name>(std::vector&lt;MyLinestring,std::allocator&lt;MyLinestring&gt; &gt;&amp;)(*this)</Name>
159+
<Name>linestrings</Name>
136160
</Container>
137161
</Linestrings>
138162
</MultiLinestring>
139163

140164
<!--
141-
struct MyMultiPolygon : std::vector<MyPolygon>
142-
{ };
165+
struct MyMultiPolygon
166+
{
167+
std::vector<MyPolygon> polygons;
168+
};
143169
-->
144170
<MultiPolygon Id="MyMultiPolygon">
145171
<Polygons>
146172
<Container>
147-
<Name>(std::vector&lt;MyPolygon,std::allocator&lt;MyPolygon&gt; &gt;&amp;)(*this)</Name>
173+
<Name>polygons</Name>
148174
</Container>
149175
</Polygons>
150176
</MultiPolygon>

0 commit comments

Comments
 (0)