├── .gitignore ├── QtCreator3 ├── README.md ├── dh-boost-array.py ├── dh-boost-container.py ├── dh-boost-geometry.py ├── dh-boost-rational.py ├── dh-boost-tuple.py └── dh-boost-variant.py ├── QtCreator4plus ├── README.md ├── awulkiew.py ├── boost-array.py ├── boost-container.py ├── boost-geometry.py ├── boost-math.py ├── boost-qvm.py ├── boost-rational.py ├── boost-tuple.py ├── boost-variant.py ├── boost-variant2.py └── boost.py ├── README.md ├── example.cpp └── example.png /.gitignore: -------------------------------------------------------------------------------- 1 | __pycache__/ 2 | *.pyc 3 | -------------------------------------------------------------------------------- /QtCreator3/README.md: -------------------------------------------------------------------------------- 1 | # Debugging Helpers for QtCreator3 2 | 3 | Left here for historical purposes. -------------------------------------------------------------------------------- /QtCreator3/dh-boost-array.py: -------------------------------------------------------------------------------- 1 | # Boost.Array debugging helpers 2 | 3 | # Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. 4 | 5 | # Use, modification and distribution is subject to the Boost Software License, 6 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | def qdump__boost__array(d, value): 10 | size = d.numericTemplateArgument(value.type, 1) 11 | d.putItemCount(size) 12 | d.putNumChild(size) 13 | if d.isExpanded(): 14 | T = d.templateArgument(value.type, 0) 15 | d.putArrayData(T, d.addressOf(value["elems"]), size) 16 | 17 | -------------------------------------------------------------------------------- /QtCreator3/dh-boost-container.py: -------------------------------------------------------------------------------- 1 | # Boost.Container debugging helpers 2 | 3 | # Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. 4 | 5 | # Use, modification and distribution is subject to the Boost Software License, 6 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | def qdump__boost__container__vector(d, value): 10 | holder = value["m_holder"] 11 | size = holder["m_size"] 12 | d.putItemCount(size) 13 | # d.putNumChild(size) 14 | if d.isExpanded(): 15 | T = d.templateArgument(value.type, 0) 16 | try: 17 | d.putArrayData(T, holder["m_start"], size) 18 | except: 19 | try: 20 | d.putArrayData(T, d.addressOf(holder["storage"]), size) 21 | except: 22 | with Children(d, 1): 23 | d.putSubItem("m_holder", holder) 24 | 25 | def qdump__boost__container__static_vector(d, value): 26 | qdump__boost__container__vector(d, value) 27 | -------------------------------------------------------------------------------- /QtCreator3/dh-boost-geometry.py: -------------------------------------------------------------------------------- 1 | # Boost.Geometry debugging helpers 2 | 3 | # Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. 4 | 5 | # Use, modification and distribution is subject to the Boost Software License, 6 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | ################################################################# 10 | # geometries 11 | ################################################################# 12 | 13 | def boost__geometry__point_array_to_text(array, size): 14 | res = '{' 15 | if size > 0: 16 | res += "%s" % (array[0]) 17 | if size > 1: 18 | res += ", %s" % (array[1]) 19 | if size > 2: 20 | res += ", %s" % (array[2]) 21 | if size > 3: 22 | res += " ..." 23 | res += '}' 24 | return res; 25 | 26 | def qdump__boost__geometry__model__point(d, value): 27 | size = d.numericTemplateArgument(value.type, 1) 28 | array = value["m_values"] 29 | d.putValue(boost__geometry__point_array_to_text(array, size)) 30 | d.putNumChild(size) 31 | if d.isExpanded(): 32 | with Children(d, size): 33 | for i in range(0, int(size)): 34 | d.putSubItem("<%s>"%i, array[i]) 35 | 36 | def qdump__boost__geometry__model__d2__point_xy(d, value): 37 | array = value["m_values"] 38 | d.putValue(boost__geometry__point_array_to_text(array, 2)) 39 | d.putNumChild(2) 40 | if d.isExpanded(): 41 | with Children(d, 2): 42 | d.putSubItem("<0>", array[0]) 43 | d.putSubItem("<1>", array[1]) 44 | 45 | def boost__geometry__point_dimension(d, point_type): 46 | point_str = str(point_type) 47 | if point_str.startswith("boost::geometry::model::point"): 48 | return int(d.numericTemplateArgument(point_type, 1)) 49 | elif point_str.startswith("boost::geometry::model::d2::point_xy"): 50 | return 2 51 | return 0 52 | 53 | def boost__geometry__dump_indexed(d, value, i0, i1, n0, n1): 54 | P = d.templateArgument(value.type, 0) 55 | Dim = boost__geometry__point_dimension(d, P) 56 | 57 | if Dim > 0: 58 | min_array = i0["m_values"] 59 | max_array = i1["m_values"] 60 | val = '{' + boost__geometry__point_array_to_text(min_array, Dim) + ", " 61 | val += boost__geometry__point_array_to_text(max_array, Dim) + '}' 62 | d.putValue(val); 63 | else: 64 | d.putValue("@0x%x" % value.address) 65 | 66 | d.putNumChild(2) 67 | if d.isExpanded(): 68 | with Children(d, 2): 69 | d.putSubItem("<%s>" % n0, i0) 70 | d.putSubItem("<%s>" % n1, i1) 71 | 72 | def qdump__boost__geometry__model__box(d, value): 73 | boost__geometry__dump_indexed(d, value, value["m_min_corner"], value["m_max_corner"], "0:min_corner", "1:max_corner") 74 | 75 | def qdump__boost__geometry__model__segment(d, value): 76 | boost__geometry__dump_indexed(d, value, value["first"], value["second"], "0", "1") 77 | 78 | def qdump__boost__geometry__model__referring_segment(d, value): 79 | boost__geometry__dump_indexed(d, value, value["first"], value["second"], "0", "1") 80 | 81 | 82 | def boost__geometry__dump_derived_from_vector(d, value, container_tparam_id): 83 | Cont_str = str(value.type) 84 | if container_tparam_id >= 0: 85 | Cont_str = d.extractTemplateArgument(str(value.type), container_tparam_id) 86 | if Cont_str.startswith("std::vector"): 87 | qdump__std__vector(d, value) 88 | else: 89 | d.putPlainChildren(value) 90 | 91 | def qdump__boost__geometry__model__linestring(d, value): 92 | boost__geometry__dump_derived_from_vector(d, value, 1) 93 | 94 | def qdump__boost__geometry__model__ring(d, value): 95 | boost__geometry__dump_derived_from_vector(d, value, 3) 96 | 97 | def qdump__boost__geometry__model__multi_point(d, value): 98 | boost__geometry__dump_derived_from_vector(d, value, 1) 99 | 100 | def qdump__boost__geometry__model__multi_linestring(d, value): 101 | boost__geometry__dump_derived_from_vector(d, value, 1) 102 | 103 | def qdump__boost__geometry__model__multi_polygon(d, value): 104 | boost__geometry__dump_derived_from_vector(d, value, 1) 105 | 106 | 107 | def qdump__boost__geometry__model__polygon(d, value): 108 | d.putValue("@0x%x" % value.address) 109 | d.putNumChild(2) 110 | if d.isExpanded(): 111 | with Children(d, 2): 112 | outer = value["m_outer"] 113 | inners = value["m_inners"] 114 | with SubItem(d, "external"): 115 | boost__geometry__dump_derived_from_vector(d, outer, 3) 116 | d.putBetterType(str(d.templateArgument(inners.type, 0))) 117 | with SubItem(d, "internal"): 118 | boost__geometry__dump_derived_from_vector(d, inners, -1) 119 | d.putBetterType("RingList") 120 | 121 | ################################################################# 122 | # index 123 | ################################################################# 124 | 125 | def qdump__boost__geometry__index__detail__varray(d, value): 126 | size = value["m_size"] 127 | storage = value["m_storage"]["data_"]["buf"] 128 | T = d.templateArgument(value.type, 0) 129 | d.putItemCount(size) 130 | d.putNumChild(1) 131 | if d.isExpanded(): 132 | d.putArrayData(T, storage.cast(T.pointer()), size) 133 | 134 | def qdump__boost__geometry__index__rtree(d, value): 135 | members = value["m_members"] 136 | size = members["values_count"] 137 | d.putItemCount(size) 138 | d.putNumChild(2) 139 | if d.isExpanded(): 140 | with Children(d, 2): 141 | d.putSubItem("m_members", members) 142 | d.putSubItem("root", members["root"]) 143 | 144 | def qdump__boost__geometry__index__detail__rtree__variant_internal_node(d, value): 145 | d.putItem(value["elements"]) 146 | 147 | def qdump__boost__geometry__index__detail__rtree__variant_leaf(d, value): 148 | d.putItem(value["elements"]) 149 | 150 | ################################################################# 151 | # policies 152 | ################################################################# 153 | 154 | def qdump__boost__geometry__segment_ratio(d, value): 155 | numerator = value["m_numerator"] 156 | denominator = value["m_denominator"] 157 | approximation = value["m_approximation"] 158 | if denominator == 0: 159 | d.putValue("%s/%s" % (numerator, denominator)) 160 | elif numerator == 0: 161 | d.putValue(0) 162 | else: 163 | approx = approximation / 1000000.0 164 | d.putValue("%s/%s ~ %s" % (numerator, denominator, approx)) 165 | d.putNumChild(3) 166 | if d.isExpanded(): 167 | with Children(d, 3): 168 | d.putSubItem("m_numerator", numerator) 169 | d.putSubItem("m_denominator", denominator) 170 | d.putSubItem("m_approximation", approximation) 171 | 172 | ################################################################# 173 | # algorithms 174 | ################################################################# 175 | 176 | def boost__geometry__segment_identifier_to_str(value): 177 | source_index = value["source_index"] 178 | multi_index = value["multi_index"] 179 | ring_index = value["ring_index"] 180 | segment_index = value["segment_index"] 181 | return "{%s, %s, %s, %s}" % (source_index, multi_index, ring_index, segment_index); 182 | 183 | def qdump__boost__geometry__segment_identifier(d, value): 184 | d.putValue(boost__geometry__segment_identifier_to_str(value)) 185 | d.putNumChild(4) 186 | if d.isExpanded(): 187 | with Children(d, 4): 188 | d.putSubItem("source_index", value["source_index"]) 189 | d.putSubItem("multi_index", value["multi_index"]) 190 | d.putSubItem("ring_index", value["ring_index"]) 191 | d.putSubItem("segment_index", value["segment_index"]) 192 | 193 | def qdump__boost__geometry__detail__overlay__turn_operation(d, value): 194 | operation = value["operation"] 195 | simple_op = str(operation)[44:] 196 | d.putValue(simple_op) 197 | d.putNumChild(3) 198 | if d.isExpanded(): 199 | with Children(d, 3): 200 | with SubItem(d, "operation"): 201 | d.putValue(simple_op) 202 | d.putType(operation.type) 203 | d.putNumChild(0) 204 | d.putSubItem("seg_id", value["seg_id"]) 205 | d.putSubItem("fraction", value["fraction"]) 206 | 207 | def qdump__boost__geometry__detail__overlay__turn_operation_linear(d, value): 208 | operation = value["operation"] 209 | simple_op = str(operation)[44:] 210 | d.putValue(simple_op) 211 | d.putNumChild(5) 212 | if d.isExpanded(): 213 | with Children(d, 5): 214 | with SubItem(d, "operation"): 215 | d.putValue(simple_op) 216 | d.putType(operation.type) 217 | d.putNumChild(0) 218 | d.putSubItem("seg_id", value["seg_id"]) 219 | d.putSubItem("fraction", value["fraction"]) 220 | d.putSubItem("is_collinear", value["is_collinear"]) 221 | with SubItem(d, "position"): 222 | position = value["position"] 223 | simple_pos = str(position)[43:] 224 | d.putValue(simple_pos) 225 | d.putType(position.type) 226 | d.putNumChild(0) 227 | 228 | def qdump__boost__geometry__detail__overlay__turn_info(d, value): 229 | point = value["point"] 230 | operations = value["operations"] 231 | method = value["method"] 232 | simple_method = str(method)[41:] 233 | op0 = operations["elems"][0]; 234 | op1 = operations["elems"][1]; 235 | simple_op0 = str(op0["operation"])[44:] 236 | simple_op1 = str(op1["operation"])[44:] 237 | simple_operations = simple_op0 + ", " + simple_op1; 238 | 239 | val_str = simple_method + " (" + simple_operations + ")" 240 | dim = boost__geometry__point_dimension(d, point.type) 241 | if dim > 0: 242 | val_str += " " + boost__geometry__point_array_to_text(point["m_values"], dim) 243 | d.putValue(val_str) 244 | 245 | d.putNumChild(5) 246 | if d.isExpanded(): 247 | with Children(d, 5): 248 | d.putSubItem("point", point) 249 | with SubItem(d, "method"): 250 | d.putValue(simple_method) 251 | d.putType(method.type) 252 | d.putNumChild(0) 253 | d.putSubItem("discarded", value["discarded"]) 254 | d.putSubItem("selectable_start", value["selectable_start"]) 255 | with SubItem(d, "operations"): 256 | d.putValue(simple_operations) 257 | d.putType(operations.type) 258 | d.putNumChild(2) 259 | if d.isExpanded(): 260 | with Children(d, 2): 261 | d.putSubItem("[0]", op0) 262 | d.putSubItem("[1]", op1) 263 | 264 | def qdump__boost__geometry__side_info(d, value): 265 | sides = value["sides"] 266 | side0 = sides[0] 267 | side1 = sides[1] 268 | side00 = side0["first"] 269 | side01 = side0["second"] 270 | side10 = side1["first"] 271 | side11 = side1["second"] 272 | d.putValue("{{%s, %s},{%s, %s}}" % (side00, side01, side10, side11)) 273 | d.putType(value.type) 274 | d.putNumChild(2) 275 | if d.isExpanded(): 276 | with Children(d, 2): 277 | d.putSubItem("[0]", side0) 278 | d.putSubItem("[1]", side1) 279 | -------------------------------------------------------------------------------- /QtCreator3/dh-boost-rational.py: -------------------------------------------------------------------------------- 1 | # Boost.Rational debugging helpers 2 | 3 | # Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. 4 | 5 | # Use, modification and distribution is subject to the Boost Software License, 6 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | def qdump__boost__rational(d, value): 10 | num = value["num"] 11 | den = value["den"] 12 | if den == 0: 13 | d.putValue("%s/%s" % (num, den)) 14 | elif num == 0: 15 | d.putValue(0) 16 | else: 17 | f = float(int(num)) / float(int(den)) 18 | d.putValue("%s/%s (%s)" % (num, den, f)) 19 | d.putNumChild(2) 20 | if d.isExpanded(): 21 | with Children(d, 2): 22 | d.putSubItem("num", num) 23 | d.putSubItem("den", den) 24 | -------------------------------------------------------------------------------- /QtCreator3/dh-boost-tuple.py: -------------------------------------------------------------------------------- 1 | # Boost.Tuple debugging helpers 2 | 3 | # Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. 4 | 5 | # Use, modification and distribution is subject to the Boost Software License, 6 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | def boost__tuple__put_children(d, value, current, i, count): 10 | if i < count: 11 | val = current["head"] 12 | with SubItem(d, "<%s>" % i): 13 | d.putItem(val) 14 | d.putBetterType(str(d.templateArgument(value.type, i))) 15 | next_i = i + 1 16 | if next_i < count: 17 | boost__tuple__put_children(d, value, current["tail"], next_i, count) 18 | 19 | def qdump__boost__tuples__tuple(d, value): 20 | count = 0 21 | while (count < 10): 22 | type = d.templateArgument(value.type, count) 23 | if str(type) == "boost::tuples::null_type": 24 | break 25 | count = count + 1 26 | #d.putValue("" % count) 27 | d.putItemCount(count) 28 | d.putNumChild(count) 29 | if d.isExpanded(): 30 | with Children(d, count): 31 | boost__tuple__put_children(d, value, value, 0, count) 32 | -------------------------------------------------------------------------------- /QtCreator3/dh-boost-variant.py: -------------------------------------------------------------------------------- 1 | # Boost.Variant debugging helpers 2 | 3 | # Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. 4 | 5 | # Use, modification and distribution is subject to the Boost Software License, 6 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | def qdump__boost__variant(d, value): 10 | which = int(value["which_"]) 11 | type = d.templateArgument(value.type, which) 12 | if d.isReferenceType(type): 13 | type = type.target() 14 | 15 | type_name = str(type.unqualified()) 16 | 17 | type_name = type_name[:type_name.find('<')] 18 | type_name = type_name[type_name.rfind("::")+2:] 19 | d.putValue("<%s:%s>" % (which, type_name)) 20 | 21 | d.putNumChild(1) 22 | if d.isExpanded(): 23 | storage = value["storage_"]["data_"]["buf"] 24 | with Children(d, 1): 25 | d.putSubItem("value", storage.cast(type.pointer()).dereference()) 26 | -------------------------------------------------------------------------------- /QtCreator4plus/README.md: -------------------------------------------------------------------------------- 1 | # Debugging Helpers for QtCreator4 and above 2 | 3 | * **awulkiew.py** - file containing utilities used by **boost.py**, **boost-geometry.py**, **boost-math.py** and **boost-qvm.py**, if you use any of these you have to put this file in the same directory 4 | * **boost-array.py** - helpers for Boost.Array 5 | * **boost-container.py** - helpers for Boost.Container 6 | * **boost-geometry.py** - helpers for Boost.Geometry 7 | * **boost-math.py** - helpers for Boost.Math 8 | * **boost-qvm.py** - helpers for Boost.QVM 9 | * **boost-rational.py** - helpers for Boost.Rational 10 | * **boost-tuple.py** - helpers for Boost.Tuple 11 | * **boost-variant.py** - helpers for Boost.Variant 12 | * **boost-variant2.py** - helpers for Boost.Variant2 13 | * **boost.py** - file containing helpers for all of the supported Boost libraries -------------------------------------------------------------------------------- /QtCreator4plus/awulkiew.py: -------------------------------------------------------------------------------- 1 | # Utilities for debugging helpers 2 | 3 | # Copyright (c) 2021 Adam Wulkiewicz, Lodz, Poland. 4 | 5 | # Use, modification and distribution is subject to the Boost Software License, 6 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | def is_float(type): 10 | # TypeCode.Float 11 | return type.code == 4 and type.size() == 4 12 | 13 | def float_to_str(value): 14 | return "{:.6g}".format(float(value.floatingPoint())) 15 | 16 | def array_to_str(array, size, maxsize = 3): 17 | res = '{' 18 | if size > 0: 19 | if is_float(array[0].type): 20 | res += float_to_str(array[0]) 21 | for i in range(1, min(size, maxsize)): 22 | res += ", " + float_to_str(array[i]) 23 | else: 24 | res += array[0].display() 25 | for i in range(1, min(size, maxsize)): 26 | res += ", " + array[i].display() 27 | if size > maxsize: 28 | res += ", ..." 29 | res += '}' 30 | return res 31 | -------------------------------------------------------------------------------- /QtCreator4plus/boost-array.py: -------------------------------------------------------------------------------- 1 | # Boost.Array debugging helpers 2 | 3 | # Copyright (c) 2015-2021 Adam Wulkiewicz, Lodz, Poland. 4 | 5 | # Use, modification and distribution is subject to the Boost Software License, 6 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | def qdump__boost__array(d, value): 10 | size = int(value.type[1]) 11 | d.putItemCount(size) 12 | if d.isExpanded(): 13 | d.putArrayData(value["elems"].address(), size, value.type[0]) 14 | -------------------------------------------------------------------------------- /QtCreator4plus/boost-container.py: -------------------------------------------------------------------------------- 1 | # Boost.Container debugging helpers 2 | 3 | # Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. 4 | # Copyright (c) 2021 Ihor Dutchak, Kyiv, Ukraine. 5 | 6 | # Use, modification and distribution is subject to the Boost Software License, 7 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 8 | # http://www.boost.org/LICENSE_1_0.txt) 9 | 10 | def qform__boost__container__vector(): 11 | return [DisplayFormat.ArrayPlot] 12 | 13 | def qdump__boost__container__vector(d, value): 14 | holder = value["m_holder"] 15 | size = holder["m_size"].integer() 16 | d.putItemCount(size) 17 | 18 | if d.isExpanded(): 19 | T = value.type[0] 20 | try: 21 | start = holder["m_start"].pointer() 22 | except: 23 | start = holder["storage"].address() 24 | d.putPlotData(start, size, T) 25 | 26 | def qform__boost__container__static_vector(): 27 | return [DisplayFormat.ArrayPlot] 28 | 29 | def qdump__boost__container__static_vector(d, value): 30 | qdump__boost__container__vector(d, value) 31 | -------------------------------------------------------------------------------- /QtCreator4plus/boost-geometry.py: -------------------------------------------------------------------------------- 1 | # Boost.Geometry debugging helpers 2 | 3 | # Copyright (c) 2015-2021 Adam Wulkiewicz, Lodz, Poland. 4 | 5 | # Use, modification and distribution is subject to the Boost Software License, 6 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | ################################################################# 10 | # geometries 11 | ################################################################# 12 | 13 | from awulkiew import array_to_str 14 | from dumper import Children 15 | 16 | def boost__geometry__model__point(d, value, size): 17 | array = value["m_values"] 18 | d.putValue(array_to_str(array, size, 3)) 19 | d.putNumChild(size) 20 | if d.isExpanded(): 21 | with Children(d, size): 22 | for i in range(0, int(size)): 23 | d.putSubItem("<%s>" % i, array[i]) 24 | 25 | def qdump__boost__geometry__model__point(d, value): 26 | boost__geometry__model__point(d, value, int(value.type[1])) 27 | 28 | def qdump__boost__geometry__model__d2__point_xy(d, value): 29 | boost__geometry__model__point(d, value, 2) 30 | 31 | def qdump__boost__geometry__model__d3__point_xyz(d, value): 32 | boost__geometry__model__point(d, value, 3) 33 | 34 | 35 | def boost__geometry__point_dimension(point_t): 36 | if point_t.name.startswith("boost::geometry::model::point"): 37 | return int(point_t[1]) 38 | elif point_t.name.startswith("boost::geometry::model::d2::point_xy"): 39 | return 2 40 | elif point_t.name.startswith("boost::geometry::model::d3::point_xyz"): 41 | return 3 42 | return 0 43 | 44 | def boost__geometry__model_indexed(d, value, i0, i1, n0, n1): 45 | point_t = value.type[0] 46 | dim = boost__geometry__point_dimension(point_t) 47 | if dim > 0: 48 | array0 = i0["m_values"] 49 | array1 = i1["m_values"] 50 | val = '{' + array_to_str(array0, dim, 3) + ", " 51 | val += array_to_str(array1, dim, 3) + '}' 52 | d.putValue(val) 53 | d.putNumChild(2) 54 | if d.isExpanded(): 55 | with Children(d, 2): 56 | d.putSubItem("<%s>" % n0, i0) 57 | d.putSubItem("<%s>" % n1, i1) 58 | 59 | def qdump__boost__geometry__model__box(d, value): 60 | boost__geometry__model_indexed(d, value, value["m_min_corner"], value["m_max_corner"], "0:min_corner", "1:max_corner") 61 | 62 | def qdump__boost__geometry__model__segment(d, value): 63 | boost__geometry__model_indexed(d, value, value["first"], value["second"], "0", "1") 64 | 65 | def qdump__boost__geometry__model__referring_segment(d, value): 66 | boost__geometry__model_indexed(d, value, value["first"].dereference(), value["second"].dereference(), "0", "1") 67 | 68 | 69 | def boost__geometry__model__container(d, value): 70 | d.putItem(value.members(True)[0]) 71 | d.putBetterType(value.type) 72 | 73 | def qdump__boost__geometry__model__linestring(d, value): 74 | boost__geometry__model__container(d, value) 75 | 76 | def qdump__boost__geometry__model__ring(d, value): 77 | boost__geometry__model__container(d, value) 78 | 79 | def qdump__boost__geometry__model__multi_point(d, value): 80 | boost__geometry__model__container(d, value) 81 | 82 | def qdump__boost__geometry__model__multi_linestring(d, value): 83 | boost__geometry__model__container(d, value) 84 | 85 | def qdump__boost__geometry__model__multi_polygon(d, value): 86 | boost__geometry__model__container(d, value) 87 | 88 | def qdump__boost__geometry__model__geometry_collection(d, value): 89 | boost__geometry__model__container(d, value) 90 | 91 | 92 | def qdump__boost__geometry__model__polygon(d, value): 93 | outer = value["m_outer"] 94 | d.putNumChild(2) 95 | if d.isExpanded(): 96 | inners = value["m_inners"] 97 | with Children(d, 2): 98 | d.putSubItem("outer", outer) 99 | d.putSubItem("inners", inners) 100 | d.putItem(outer) # Only for putValue, children are set before 101 | 102 | ################################################################# 103 | # index 104 | ################################################################# 105 | 106 | def qdump__boost__geometry__index__detail__varray(d, value): 107 | size = int(value["m_size"]) 108 | d.putItemCount(size) 109 | if d.isExpanded(): 110 | d.putArrayData(value["m_storage"]["data_"]["buf"].address(), size, value.type[0]) 111 | 112 | def qdump__boost__geometry__index__rtree(d, value): 113 | members = value["m_members"] 114 | size = int(members["values_count"]) 115 | d.putItemCount(size) 116 | if d.isExpanded(): 117 | with Children(d, 2): 118 | d.putSubItem("m_members", members) 119 | d.putSubItem("root", members["root"]) 120 | 121 | def qdump__boost__geometry__index__detail__rtree__variant_internal_node(d, value): 122 | d.putItem(value["elements"]) 123 | 124 | def qdump__boost__geometry__index__detail__rtree__variant_leaf(d, value): 125 | d.putItem(value["elements"]) 126 | 127 | ################################################################# 128 | # policies 129 | ################################################################# 130 | 131 | def qdump__boost__geometry__segment_ratio(d, value): 132 | numerator = value["m_numerator"] 133 | denominator = value["m_denominator"] 134 | approximation = value["m_approximation"] 135 | num = numerator.integer() 136 | den = denominator.integer() 137 | app = approximation.floatingPoint() 138 | if den == 0: 139 | d.putValue("%s/%s" % (num, den)) 140 | elif num == 0: 141 | d.putValue(0) 142 | else: 143 | a = float(app) / 1000000.0 144 | d.putValue("%s/%s ~ %s" % (num, den, a)) 145 | d.putNumChild(3) 146 | if d.isExpanded(): 147 | with Children(d, 3): 148 | d.putSubItem("m_numerator", numerator) 149 | d.putSubItem("m_denominator", denominator) 150 | d.putSubItem("m_approximation", approximation) 151 | 152 | ################################################################# 153 | # algorithms 154 | ################################################################# 155 | 156 | def qdump__boost__geometry__segment_identifier(d, value): 157 | so = value["source_index"] 158 | mu = value["multi_index"] 159 | ri = value["ring_index"] 160 | se = value["segment_index"] 161 | d.putValue(array_to_str([so, mu, ri, se], 4, 4)) 162 | d.putNumChild(4) 163 | if d.isExpanded(): 164 | with Children(d, 4): 165 | d.putSubItem("source_index", so) 166 | d.putSubItem("multi_index", mu) 167 | d.putSubItem("ring_index", ri) 168 | d.putSubItem("segment_index", se) 169 | 170 | def qdump__boost__geometry__ring_identifier(d, value): 171 | so = value["source_index"] 172 | mu = value["multi_index"] 173 | ri = value["ring_index"] 174 | d.putValue(array_to_str([so, mu, ri], 3, 3)) 175 | d.putNumChild(3) 176 | if d.isExpanded(): 177 | with Children(d, 3): 178 | d.putSubItem("source_index", so) 179 | d.putSubItem("multi_index", mu) 180 | d.putSubItem("ring_index", ri) 181 | 182 | ################################################################# 183 | # srs 184 | ################################################################# 185 | 186 | def qdump__boost__geometry__srs__sphere(d, value): 187 | r = value["m_r"] 188 | d.putValue(array_to_str([r], 1, 1)) 189 | d.putNumChild(1) 190 | if d.isExpanded(): 191 | with Children(d, 1): 192 | d.putSubItem("radius", r) 193 | 194 | def qdump__boost__geometry__srs__spheroid(d, value): 195 | a = value["m_a"] 196 | b = value["m_b"] 197 | d.putValue(array_to_str([a, b], 2, 2)) 198 | d.putNumChild(2) 199 | if d.isExpanded(): 200 | with Children(d, 2): 201 | d.putSubItem("a", a) 202 | d.putSubItem("b", b) -------------------------------------------------------------------------------- /QtCreator4plus/boost-math.py: -------------------------------------------------------------------------------- 1 | # Boost.Math debugging helpers 2 | 3 | # Copyright (c) 2021 Adam Wulkiewicz, Lodz, Poland. 4 | 5 | # Use, modification and distribution is subject to the Boost Software License, 6 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | from awulkiew import array_to_str 10 | from dumper import Children 11 | 12 | def qdump__boost__math__octonion(d, value): 13 | aa = value["a"] 14 | bb = value["b"] 15 | cc = value["c"] 16 | dd = value["d"] 17 | d.putValue(array_to_str([aa, bb, cc, dd, 0], 5, 4)) # 0 is dummy value 18 | d.putNumChild(8) 19 | if d.isExpanded(): 20 | with Children(d, 8): 21 | d.putSubItem("a", aa) 22 | d.putSubItem("b", bb) 23 | d.putSubItem("c", cc) 24 | d.putSubItem("d", dd) 25 | d.putSubItem("e", value["e"]) 26 | d.putSubItem("f", value["f"]) 27 | d.putSubItem("g", value["g"]) 28 | d.putSubItem("h", value["h"]) 29 | 30 | def qdump__boost__math__quaternion(d, value): 31 | aa = value["a"] 32 | bb = value["b"] 33 | cc = value["c"] 34 | dd = value["d"] 35 | d.putValue(array_to_str([aa, bb, cc, dd], 4, 4)) 36 | d.putNumChild(4) 37 | if d.isExpanded(): 38 | with Children(d, 4): 39 | d.putSubItem("a", aa) 40 | d.putSubItem("b", bb) 41 | d.putSubItem("c", cc) 42 | d.putSubItem("d", dd) 43 | -------------------------------------------------------------------------------- /QtCreator4plus/boost-qvm.py: -------------------------------------------------------------------------------- 1 | # Boost.QVM debugging helpers 2 | 3 | # Copyright (c) 2021 Adam Wulkiewicz, Lodz, Poland. 4 | 5 | # Use, modification and distribution is subject to the Boost Software License, 6 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | from awulkiew import array_to_str 10 | from dumper import Children, SubItem 11 | 12 | def qdump__boost__qvm__mat(d, value): 13 | array = value["a"] 14 | rows = int(value.type[1]) 15 | cols = int(value.type[2]) 16 | d.putItemCount(rows) 17 | if d.isExpanded(): 18 | with Children(d, rows): 19 | for r in range(0, rows): 20 | with SubItem(d, "[%s]" % r): 21 | d.putItem(array[r]) 22 | d.putValue(array_to_str(array[r], cols, 4)) 23 | 24 | def qdump__boost__qvm__quat(d, value): 25 | array = value["a"] 26 | d.putValue(array_to_str(array, 4, 4)) 27 | d.putNumChild(4) 28 | if d.isExpanded(): 29 | d.putArrayData(array.address(), 4, value.type[0]) 30 | 31 | def qdump__boost__qvm__vec(d, value): 32 | array = value["a"] 33 | size = int(value.type[1]) 34 | d.putValue(array_to_str(array, size, 4)) 35 | d.putNumChild(size) 36 | if d.isExpanded(): 37 | d.putArrayData(array.address(), size, value.type[0]) 38 | -------------------------------------------------------------------------------- /QtCreator4plus/boost-rational.py: -------------------------------------------------------------------------------- 1 | # Boost.Rational debugging helpers 2 | 3 | # Copyright (c) 2015-2021 Adam Wulkiewicz, Lodz, Poland. 4 | 5 | # Use, modification and distribution is subject to the Boost Software License, 6 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | from dumper import Children 10 | 11 | def qdump__boost__rational(d, value): 12 | numerator = value["num"] 13 | denominator = value["den"] 14 | num = numerator.integer() 15 | den = denominator.integer() 16 | if den == 0: 17 | d.putValue("%s/%s" % (num, den)) 18 | elif num == 0: 19 | d.putValue(0) 20 | else: 21 | f = float(int(num)) / float(int(den)) 22 | d.putValue("%s/%s ~ %s" % (num, den, f)) 23 | d.putNumChild(2) 24 | if d.isExpanded(): 25 | with Children(d, 2): 26 | d.putSubItem("num", numerator) 27 | d.putSubItem("den", denominator) 28 | -------------------------------------------------------------------------------- /QtCreator4plus/boost-tuple.py: -------------------------------------------------------------------------------- 1 | # Boost.Tuple debugging helpers 2 | 3 | # Copyright (c) 2015-2021 Adam Wulkiewicz, Lodz, Poland. 4 | 5 | # Use, modification and distribution is subject to the Boost Software License, 6 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | from dumper import Children, SubItem 10 | 11 | def boost__tuple__put_children(d, value, current, i, count): 12 | if i < count: 13 | val = current["head"] 14 | with SubItem(d, "<%s>" % i): 15 | d.putItem(val) 16 | next_i = i + 1 17 | if next_i < count: 18 | boost__tuple__put_children(d, value, current["tail"], next_i, count) 19 | 20 | def qdump__boost__tuples__tuple(d, value): 21 | count = 0 22 | while (count < 10): 23 | type = value.type[count] 24 | if type.name == "boost::tuples::null_type": 25 | break 26 | count = count + 1 27 | d.putItemCount(count) 28 | if d.isExpanded(): 29 | with Children(d, count): 30 | boost__tuple__put_children(d, value, value, 0, count) 31 | -------------------------------------------------------------------------------- /QtCreator4plus/boost-variant.py: -------------------------------------------------------------------------------- 1 | # Boost.Variant debugging helpers 2 | 3 | # Copyright (c) 2015-2021 Adam Wulkiewicz, Lodz, Poland. 4 | 5 | # Use, modification and distribution is subject to the Boost Software License, 6 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | from dumper import Children 10 | 11 | def qdump__boost__variant(d, value): 12 | which = int(value["which_"].integer()) 13 | type = value.type[which] 14 | type_name = str(type.unqualified()) 15 | type_name = type_name[:type_name.find('<')] 16 | type_name = type_name[type_name.rfind("::")+2:] 17 | d.putValue("<%s:%s>" % (which, type_name)) 18 | d.putNumChild(1) 19 | if d.isExpanded(): 20 | storage = value["storage_"]["data_"]["buf"] 21 | with Children(d, 1): 22 | d.putSubItem("value", storage.cast(type)) 23 | -------------------------------------------------------------------------------- /QtCreator4plus/boost-variant2.py: -------------------------------------------------------------------------------- 1 | # Boost.Variant2 debugging helpers 2 | 3 | # Copyright (c) 2021 Adam Wulkiewicz, Lodz, Poland. 4 | 5 | # Use, modification and distribution is subject to the Boost Software License, 6 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | from dumper import Children 10 | 11 | def boost__variant2__variant_put(d, value, current, i, ix, count): 12 | if i > count: 13 | return 14 | if i == ix: 15 | d.putSubItem("value", current["first_"]) 16 | else: 17 | boost__variant2__variant_put(d, value, current["rest_"], i + 1, ix, count) 18 | 19 | def qdump__boost__variant2__variant(d, value): 20 | ix = int(value["ix_"].integer()) 21 | if ix < 0: 22 | return # TODO: handle double-buffered 23 | if ix > 0: 24 | which = ix - 1 25 | type = value.type[which] 26 | type_name = str(type.unqualified()) 27 | type_name = type_name[:type_name.find('<')] 28 | type_name = type_name[type_name.rfind("::")+2:] 29 | d.putValue("<%s:%s>" % (which, type_name)) 30 | else: 31 | d.putValue("") 32 | d.putNumChild(1) 33 | if d.isExpanded(): 34 | with Children(d, 1): 35 | count = len(value.type.templateArguments()) 36 | boost__variant2__variant_put(d, value, value["st1_"], 0, ix, count) 37 | -------------------------------------------------------------------------------- /QtCreator4plus/boost.py: -------------------------------------------------------------------------------- 1 | # Boost.Array debugging helpers 2 | 3 | # Copyright (c) 2015-2021 Adam Wulkiewicz, Lodz, Poland. 4 | 5 | # Use, modification and distribution is subject to the Boost Software License, 6 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 | # http://www.boost.org/LICENSE_1_0.txt) 8 | 9 | def qdump__boost__array(d, value): 10 | size = int(value.type[1]) 11 | d.putItemCount(size) 12 | if d.isExpanded(): 13 | d.putArrayData(value["elems"].address(), size, value.type[0]) 14 | # Boost.Container debugging helpers 15 | 16 | # Copyright (c) 2015 Adam Wulkiewicz, Lodz, Poland. 17 | # Copyright (c) 2021 Ihor Dutchak, Kyiv, Ukraine. 18 | 19 | # Use, modification and distribution is subject to the Boost Software License, 20 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 21 | # http://www.boost.org/LICENSE_1_0.txt) 22 | 23 | def qform__boost__container__vector(): 24 | return [DisplayFormat.ArrayPlot] 25 | 26 | def qdump__boost__container__vector(d, value): 27 | holder = value["m_holder"] 28 | size = holder["m_size"].integer() 29 | d.putItemCount(size) 30 | 31 | if d.isExpanded(): 32 | T = value.type[0] 33 | try: 34 | start = holder["m_start"].pointer() 35 | except: 36 | start = holder["storage"].address() 37 | d.putPlotData(start, size, T) 38 | 39 | def qform__boost__container__static_vector(): 40 | return [DisplayFormat.ArrayPlot] 41 | 42 | def qdump__boost__container__static_vector(d, value): 43 | qdump__boost__container__vector(d, value) 44 | # Boost.Geometry debugging helpers 45 | 46 | # Copyright (c) 2015-2021 Adam Wulkiewicz, Lodz, Poland. 47 | 48 | # Use, modification and distribution is subject to the Boost Software License, 49 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 50 | # http://www.boost.org/LICENSE_1_0.txt) 51 | 52 | ################################################################# 53 | # geometries 54 | ################################################################# 55 | 56 | from awulkiew import array_to_str 57 | from dumper import Children 58 | 59 | def boost__geometry__model__point(d, value, size): 60 | array = value["m_values"] 61 | d.putValue(array_to_str(array, size, 3)) 62 | d.putNumChild(size) 63 | if d.isExpanded(): 64 | with Children(d, size): 65 | for i in range(0, int(size)): 66 | d.putSubItem("<%s>" % i, array[i]) 67 | 68 | def qdump__boost__geometry__model__point(d, value): 69 | boost__geometry__model__point(d, value, int(value.type[1])) 70 | 71 | def qdump__boost__geometry__model__d2__point_xy(d, value): 72 | boost__geometry__model__point(d, value, 2) 73 | 74 | def qdump__boost__geometry__model__d3__point_xyz(d, value): 75 | boost__geometry__model__point(d, value, 3) 76 | 77 | 78 | def boost__geometry__point_dimension(point_t): 79 | if point_t.name.startswith("boost::geometry::model::point"): 80 | return int(point_t[1]) 81 | elif point_t.name.startswith("boost::geometry::model::d2::point_xy"): 82 | return 2 83 | elif point_t.name.startswith("boost::geometry::model::d3::point_xyz"): 84 | return 3 85 | return 0 86 | 87 | def boost__geometry__model_indexed(d, value, i0, i1, n0, n1): 88 | point_t = value.type[0] 89 | dim = boost__geometry__point_dimension(point_t) 90 | if dim > 0: 91 | array0 = i0["m_values"] 92 | array1 = i1["m_values"] 93 | val = '{' + array_to_str(array0, dim, 3) + ", " 94 | val += array_to_str(array1, dim, 3) + '}' 95 | d.putValue(val) 96 | d.putNumChild(2) 97 | if d.isExpanded(): 98 | with Children(d, 2): 99 | d.putSubItem("<%s>" % n0, i0) 100 | d.putSubItem("<%s>" % n1, i1) 101 | 102 | def qdump__boost__geometry__model__box(d, value): 103 | boost__geometry__model_indexed(d, value, value["m_min_corner"], value["m_max_corner"], "0:min_corner", "1:max_corner") 104 | 105 | def qdump__boost__geometry__model__segment(d, value): 106 | boost__geometry__model_indexed(d, value, value["first"], value["second"], "0", "1") 107 | 108 | def qdump__boost__geometry__model__referring_segment(d, value): 109 | boost__geometry__model_indexed(d, value, value["first"].dereference(), value["second"].dereference(), "0", "1") 110 | 111 | 112 | def boost__geometry__model__container(d, value): 113 | d.putItem(value.members(True)[0]) 114 | d.putBetterType(value.type) 115 | 116 | def qdump__boost__geometry__model__linestring(d, value): 117 | boost__geometry__model__container(d, value) 118 | 119 | def qdump__boost__geometry__model__ring(d, value): 120 | boost__geometry__model__container(d, value) 121 | 122 | def qdump__boost__geometry__model__multi_point(d, value): 123 | boost__geometry__model__container(d, value) 124 | 125 | def qdump__boost__geometry__model__multi_linestring(d, value): 126 | boost__geometry__model__container(d, value) 127 | 128 | def qdump__boost__geometry__model__multi_polygon(d, value): 129 | boost__geometry__model__container(d, value) 130 | 131 | def qdump__boost__geometry__model__geometry_collection(d, value): 132 | boost__geometry__model__container(d, value) 133 | 134 | 135 | def qdump__boost__geometry__model__polygon(d, value): 136 | outer = value["m_outer"] 137 | d.putNumChild(2) 138 | if d.isExpanded(): 139 | inners = value["m_inners"] 140 | with Children(d, 2): 141 | d.putSubItem("outer", outer) 142 | d.putSubItem("inners", inners) 143 | d.putItem(outer) # Only for putValue, children are set before 144 | 145 | ################################################################# 146 | # index 147 | ################################################################# 148 | 149 | def qdump__boost__geometry__index__detail__varray(d, value): 150 | size = int(value["m_size"]) 151 | d.putItemCount(size) 152 | if d.isExpanded(): 153 | d.putArrayData(value["m_storage"]["data_"]["buf"].address(), size, value.type[0]) 154 | 155 | def qdump__boost__geometry__index__rtree(d, value): 156 | members = value["m_members"] 157 | size = int(members["values_count"]) 158 | d.putItemCount(size) 159 | if d.isExpanded(): 160 | with Children(d, 2): 161 | d.putSubItem("m_members", members) 162 | d.putSubItem("root", members["root"]) 163 | 164 | def qdump__boost__geometry__index__detail__rtree__variant_internal_node(d, value): 165 | d.putItem(value["elements"]) 166 | 167 | def qdump__boost__geometry__index__detail__rtree__variant_leaf(d, value): 168 | d.putItem(value["elements"]) 169 | 170 | ################################################################# 171 | # policies 172 | ################################################################# 173 | 174 | def qdump__boost__geometry__segment_ratio(d, value): 175 | numerator = value["m_numerator"] 176 | denominator = value["m_denominator"] 177 | approximation = value["m_approximation"] 178 | num = numerator.integer() 179 | den = denominator.integer() 180 | app = approximation.floatingPoint() 181 | if den == 0: 182 | d.putValue("%s/%s" % (num, den)) 183 | elif num == 0: 184 | d.putValue(0) 185 | else: 186 | a = float(app) / 1000000.0 187 | d.putValue("%s/%s ~ %s" % (num, den, a)) 188 | d.putNumChild(3) 189 | if d.isExpanded(): 190 | with Children(d, 3): 191 | d.putSubItem("m_numerator", numerator) 192 | d.putSubItem("m_denominator", denominator) 193 | d.putSubItem("m_approximation", approximation) 194 | 195 | ################################################################# 196 | # algorithms 197 | ################################################################# 198 | 199 | def qdump__boost__geometry__segment_identifier(d, value): 200 | so = value["source_index"] 201 | mu = value["multi_index"] 202 | ri = value["ring_index"] 203 | se = value["segment_index"] 204 | d.putValue(array_to_str([so, mu, ri, se], 4, 4)) 205 | d.putNumChild(4) 206 | if d.isExpanded(): 207 | with Children(d, 4): 208 | d.putSubItem("source_index", so) 209 | d.putSubItem("multi_index", mu) 210 | d.putSubItem("ring_index", ri) 211 | d.putSubItem("segment_index", se) 212 | 213 | def qdump__boost__geometry__ring_identifier(d, value): 214 | so = value["source_index"] 215 | mu = value["multi_index"] 216 | ri = value["ring_index"] 217 | d.putValue(array_to_str([so, mu, ri], 3, 3)) 218 | d.putNumChild(3) 219 | if d.isExpanded(): 220 | with Children(d, 3): 221 | d.putSubItem("source_index", so) 222 | d.putSubItem("multi_index", mu) 223 | d.putSubItem("ring_index", ri) 224 | 225 | ################################################################# 226 | # srs 227 | ################################################################# 228 | 229 | def qdump__boost__geometry__srs__sphere(d, value): 230 | r = value["m_r"] 231 | d.putValue(array_to_str([r], 1, 1)) 232 | d.putNumChild(1) 233 | if d.isExpanded(): 234 | with Children(d, 1): 235 | d.putSubItem("radius", r) 236 | 237 | def qdump__boost__geometry__srs__spheroid(d, value): 238 | a = value["m_a"] 239 | b = value["m_b"] 240 | d.putValue(array_to_str([a, b], 2, 2)) 241 | d.putNumChild(2) 242 | if d.isExpanded(): 243 | with Children(d, 2): 244 | d.putSubItem("a", a) 245 | d.putSubItem("b", b)# Boost.Math debugging helpers 246 | 247 | # Copyright (c) 2021 Adam Wulkiewicz, Lodz, Poland. 248 | 249 | # Use, modification and distribution is subject to the Boost Software License, 250 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 251 | # http://www.boost.org/LICENSE_1_0.txt) 252 | 253 | from awulkiew import array_to_str 254 | from dumper import Children 255 | 256 | def qdump__boost__math__octonion(d, value): 257 | aa = value["a"] 258 | bb = value["b"] 259 | cc = value["c"] 260 | dd = value["d"] 261 | d.putValue(array_to_str([aa, bb, cc, dd, 0], 5, 4)) # 0 is dummy value 262 | d.putNumChild(8) 263 | if d.isExpanded(): 264 | with Children(d, 8): 265 | d.putSubItem("a", aa) 266 | d.putSubItem("b", bb) 267 | d.putSubItem("c", cc) 268 | d.putSubItem("d", dd) 269 | d.putSubItem("e", value["e"]) 270 | d.putSubItem("f", value["f"]) 271 | d.putSubItem("g", value["g"]) 272 | d.putSubItem("h", value["h"]) 273 | 274 | def qdump__boost__math__quaternion(d, value): 275 | aa = value["a"] 276 | bb = value["b"] 277 | cc = value["c"] 278 | dd = value["d"] 279 | d.putValue(array_to_str([aa, bb, cc, dd], 4, 4)) 280 | d.putNumChild(4) 281 | if d.isExpanded(): 282 | with Children(d, 4): 283 | d.putSubItem("a", aa) 284 | d.putSubItem("b", bb) 285 | d.putSubItem("c", cc) 286 | d.putSubItem("d", dd) 287 | # Boost.QVM debugging helpers 288 | 289 | # Copyright (c) 2021 Adam Wulkiewicz, Lodz, Poland. 290 | 291 | # Use, modification and distribution is subject to the Boost Software License, 292 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 293 | # http://www.boost.org/LICENSE_1_0.txt) 294 | 295 | from awulkiew import array_to_str 296 | from dumper import Children, SubItem 297 | 298 | def qdump__boost__qvm__mat(d, value): 299 | array = value["a"] 300 | rows = int(value.type[1]) 301 | cols = int(value.type[2]) 302 | d.putItemCount(rows) 303 | if d.isExpanded(): 304 | with Children(d, rows): 305 | for r in range(0, rows): 306 | with SubItem(d, "[%s]" % r): 307 | d.putItem(array[r]) 308 | d.putValue(array_to_str(array[r], cols, 4)) 309 | 310 | def qdump__boost__qvm__quat(d, value): 311 | array = value["a"] 312 | d.putValue(array_to_str(array, 4, 4)) 313 | d.putNumChild(4) 314 | if d.isExpanded(): 315 | d.putArrayData(array.address(), 4, value.type[0]) 316 | 317 | def qdump__boost__qvm__vec(d, value): 318 | array = value["a"] 319 | size = int(value.type[1]) 320 | d.putValue(array_to_str(array, size, 4)) 321 | d.putNumChild(size) 322 | if d.isExpanded(): 323 | d.putArrayData(array.address(), size, value.type[0]) 324 | # Boost.Rational debugging helpers 325 | 326 | # Copyright (c) 2015-2021 Adam Wulkiewicz, Lodz, Poland. 327 | 328 | # Use, modification and distribution is subject to the Boost Software License, 329 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 330 | # http://www.boost.org/LICENSE_1_0.txt) 331 | 332 | from dumper import Children 333 | 334 | def qdump__boost__rational(d, value): 335 | numerator = value["num"] 336 | denominator = value["den"] 337 | num = numerator.integer() 338 | den = denominator.integer() 339 | if den == 0: 340 | d.putValue("%s/%s" % (num, den)) 341 | elif num == 0: 342 | d.putValue(0) 343 | else: 344 | f = float(int(num)) / float(int(den)) 345 | d.putValue("%s/%s ~ %s" % (num, den, f)) 346 | d.putNumChild(2) 347 | if d.isExpanded(): 348 | with Children(d, 2): 349 | d.putSubItem("num", numerator) 350 | d.putSubItem("den", denominator) 351 | # Boost.Tuple debugging helpers 352 | 353 | # Copyright (c) 2015-2021 Adam Wulkiewicz, Lodz, Poland. 354 | 355 | # Use, modification and distribution is subject to the Boost Software License, 356 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 357 | # http://www.boost.org/LICENSE_1_0.txt) 358 | 359 | from dumper import Children, SubItem 360 | 361 | def boost__tuple__put_children(d, value, current, i, count): 362 | if i < count: 363 | val = current["head"] 364 | with SubItem(d, "<%s>" % i): 365 | d.putItem(val) 366 | next_i = i + 1 367 | if next_i < count: 368 | boost__tuple__put_children(d, value, current["tail"], next_i, count) 369 | 370 | def qdump__boost__tuples__tuple(d, value): 371 | count = 0 372 | while (count < 10): 373 | type = value.type[count] 374 | if type.name == "boost::tuples::null_type": 375 | break 376 | count = count + 1 377 | d.putItemCount(count) 378 | if d.isExpanded(): 379 | with Children(d, count): 380 | boost__tuple__put_children(d, value, value, 0, count) 381 | # Boost.Variant debugging helpers 382 | 383 | # Copyright (c) 2015-2021 Adam Wulkiewicz, Lodz, Poland. 384 | 385 | # Use, modification and distribution is subject to the Boost Software License, 386 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 387 | # http://www.boost.org/LICENSE_1_0.txt) 388 | 389 | from dumper import Children 390 | 391 | def qdump__boost__variant(d, value): 392 | which = int(value["which_"].integer()) 393 | type = value.type[which] 394 | type_name = str(type.unqualified()) 395 | type_name = type_name[:type_name.find('<')] 396 | type_name = type_name[type_name.rfind("::")+2:] 397 | d.putValue("<%s:%s>" % (which, type_name)) 398 | d.putNumChild(1) 399 | if d.isExpanded(): 400 | storage = value["storage_"]["data_"]["buf"] 401 | with Children(d, 1): 402 | d.putSubItem("value", storage.cast(type)) 403 | # Boost.Variant2 debugging helpers 404 | 405 | # Copyright (c) 2021 Adam Wulkiewicz, Lodz, Poland. 406 | 407 | # Use, modification and distribution is subject to the Boost Software License, 408 | # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 409 | # http://www.boost.org/LICENSE_1_0.txt) 410 | 411 | from dumper import Children 412 | 413 | def boost__variant2__variant_put(d, value, current, i, ix, count): 414 | if i > count: 415 | return 416 | if i == ix: 417 | d.putSubItem("value", current["first_"]) 418 | else: 419 | boost__variant2__variant_put(d, value, current["rest_"], i + 1, ix, count) 420 | 421 | def qdump__boost__variant2__variant(d, value): 422 | ix = int(value["ix_"].integer()) 423 | if ix < 0: 424 | return # TODO: handle double-buffered 425 | if ix > 0: 426 | which = ix - 1 427 | type = value.type[which] 428 | type_name = str(type.unqualified()) 429 | type_name = type_name[:type_name.find('<')] 430 | type_name = type_name[type_name.rfind("::")+2:] 431 | d.putValue("<%s:%s>" % (which, type_name)) 432 | else: 433 | d.putValue("") 434 | d.putNumChild(1) 435 | if d.isExpanded(): 436 | with Children(d, 1): 437 | count = len(value.type.templateArguments()) 438 | boost__variant2__variant_put(d, value, value["st1_"], 0, ix, count) 439 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Debugging Helpers for QtCreator 2 | 3 | ![example](example.png) 4 | 5 | To use, specify the location of custom helpers in **Tools > Options > Debugger > Locals & Expressions > Extra Debugging Helpers** 6 | 7 | Additional information: https://doc.qt.io/qtcreator/creator-debugging-helpers.html 8 | 9 | ### Currently supported: 10 | 11 | * Boost.Array 12 | * boost::array 13 | * Boost.Container 14 | * boost::container::static_vector 15 | * boost::container::vector 16 | * Boost.Geometry 17 | * boost::geometry::index::rtree 18 | * boost::geometry::model::box 19 | * boost::geometry::model::d2::point_xy 20 | * boost::geometry::model::d3::point_xyz 21 | * boost::geometry::model::geometry_collection 22 | * boost::geometry::model::linestring 23 | * boost::geometry::model::multi_point 24 | * boost::geometry::model::multi_linestring 25 | * boost::geometry::model::multi_polygon 26 | * boost::geometry::model::point 27 | * boost::geometry::model::polygon 28 | * boost::geometry::model::referring_segment 29 | * boost::geometry::model::ring 30 | * boost::geometry::model::segment 31 | * boost::geometry::ring_identifier 32 | * boost::geometry::segment_identifier 33 | * boost::geometry::segment_ratio 34 | * boost::geometry::srs::sphere 35 | * boost::geometry::srs::spheroid 36 | * Boost.Math 37 | * boost::math::octonion 38 | * boost::math::quaternion 39 | * Boost.QVM 40 | * boost::qvm::mat 41 | * boost::qvm::quat 42 | * boost::qvm::vec 43 | * Boost.Rational 44 | * boost::rational 45 | * Boost.Tuple 46 | * boost::tuple 47 | * Boost.Variant 48 | * boost::variant 49 | * Boost.Variant2 50 | * boost::variant2::variant 51 | -------------------------------------------------------------------------------- /example.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | #include 17 | 18 | #include 19 | 20 | #include 21 | #include 22 | 23 | int main() 24 | { 25 | namespace bg = boost::geometry; 26 | namespace bgi = boost::geometry::index; 27 | 28 | typedef bg::model::point point_t; 29 | typedef bg::model::polygon polygon_t; 30 | typedef bg::model::multi_polygon mpolygon_t; 31 | typedef bg::model::box box_t; 32 | typedef bg::model::segment segment_t; 33 | typedef bg::model::linestring linestring_t; 34 | typedef bg::model::ring ring_t; 35 | 36 | typedef boost::tuple tuple_t; 37 | typedef boost::variant variant_t; 38 | typedef boost::variant2::variant variant2_t; 39 | 40 | typedef bg::model::geometry_collection geometry_collection_t; 41 | 42 | point_t point; 43 | box_t box; 44 | segment_t segment; 45 | linestring_t linestring; 46 | ring_t ring; 47 | polygon_t polygon; 48 | mpolygon_t mpolygon; 49 | geometry_collection_t gcollection; 50 | 51 | bg::read_wkt("POINT(0 0)", point); 52 | bg::read_wkt("BOX(0 0, 1 1)", box); 53 | bg::read_wkt("SEGMENT(0 0, 1 1)", segment); 54 | bg::read_wkt("LINESTRING(0 0, 1 1, 2 2)", linestring); 55 | bg::read_wkt("POLYGON((0 0,0 5,5 0,0 0))", ring); 56 | bg::read_wkt("POLYGON((0 0,0 5,5 0,0 0),(1 1,2 1,1 2,1 1),(3 3,4 3,3 4,3 3))", polygon); 57 | bg::read_wkt("MULTIPOLYGON(((0 0,0 1,1 0,0 0)),((4 4,4 5,5 4,4 4)))", mpolygon); 58 | bg::read_wkt("GEOMETRYCOLLECTION(POINT(0 0), BOX(0 0, 1 1), LINESTRING(0 0, 1 1, 2 2))", gcollection); 59 | 60 | bg::model::referring_segment ref_segment(point, point); 61 | 62 | bg::segment_ratio sratio1; 63 | bg::segment_ratio sratio2(5, 6); 64 | 65 | bg::segment_identifier seg_id(0, -1, 0, 1); 66 | bg::ring_identifier ring_id(0, -1, 0); 67 | 68 | bg::srs::sphere sphere; 69 | bg::srs::spheroid spheroid; 70 | 71 | bgi::detail::varray varray(5, point); 72 | 73 | bgi::rtree > rtree; 74 | rtree.insert(point_t(0, 0)); 75 | rtree.insert(point_t(1, 1)); 76 | rtree.insert(point_t(2, 2)); 77 | rtree.insert(point_t(3, 3)); 78 | rtree.insert(point_t(4, 4)); 79 | 80 | boost::array arr; 81 | 82 | boost::container::static_vector svec(5, 0); 83 | boost::container::vector vec(5, 0); 84 | 85 | for ( int i = 0 ; i < 5 ; ++i ) 86 | { 87 | arr[i] = svec[i] = vec[i] = i; 88 | } 89 | 90 | boost::math::octonion math_o{1, 2, 3, 4, 5, 6, 7, 8}; 91 | boost::math::quaternion math_q{1, 2, 3, 4}; 92 | 93 | boost::qvm::mat qvm_m = boost::qvm::rotx_mat<3>(3.14159f); 94 | boost::qvm::quat qvm_q = boost::qvm::rotx_quat(3.14159f); 95 | boost::qvm::vec qvm_v = {0, 0, 7}; 96 | 97 | boost::rational r1; 98 | boost::rational r2(1); 99 | boost::rational r3(2,3); 100 | 101 | tuple_t tuple = boost::make_tuple(point, box, linestring); 102 | 103 | variant_t variant_; 104 | variant_t variant0 = point; 105 | variant_t variant1 = box; 106 | variant_t variant2 = linestring; 107 | 108 | variant2_t variant2_; 109 | variant2_t variant20 = point; 110 | variant2_t variant21 = box; 111 | variant2_t variant22 = linestring; 112 | 113 | return 0; 114 | } 115 | -------------------------------------------------------------------------------- /example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/awulkiew/debugging-helpers/e8f6820a56ed221e492693cd7d0f5012f319695b/example.png --------------------------------------------------------------------------------