forked from qt-creator/qt-creator
debugger: add dumper for QHash::{const_}iterator
Change-Id: I05eaa1f3defdcb00102288737bd7686fa0281953 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -434,6 +434,27 @@ def qdump__QHashNode(d, value):
|
|||||||
d.putSubItem("value", val)
|
d.putSubItem("value", val)
|
||||||
|
|
||||||
|
|
||||||
|
def qHashIteratorHelper(d, value):
|
||||||
|
typeName = str(value.type)
|
||||||
|
hashType = lookupType(typeName[0:typeName.rfind("::")])
|
||||||
|
keyType = templateArgument(hashType, 0)
|
||||||
|
valueType = templateArgument(hashType, 1)
|
||||||
|
d.putNumChild(1)
|
||||||
|
d.putValue(" ")
|
||||||
|
if d.isExpanded():
|
||||||
|
with Children(d):
|
||||||
|
typeName = "%sQHash<%s,%s>::Node" % (d.ns, keyType, valueType)
|
||||||
|
node = value["i"].cast(lookupType(typeName).pointer())
|
||||||
|
d.putSubItem("key", node["key"])
|
||||||
|
d.putSubItem("value", node["value"])
|
||||||
|
|
||||||
|
def qdump__QHash__const_iterator(d, value):
|
||||||
|
qHashIteratorHelper(d, value)
|
||||||
|
|
||||||
|
def qdump__QHash__iterator(d, value):
|
||||||
|
qHashIteratorHelper(d, value)
|
||||||
|
|
||||||
|
|
||||||
def qdump__QHostAddress(d, value):
|
def qdump__QHostAddress(d, value):
|
||||||
data = value["d"]["d"].dereference()
|
data = value["d"]["d"].dereference()
|
||||||
if int(data["ipString"]["d"]["size"]):
|
if int(data["ipString"]["d"]["size"]):
|
||||||
|
@@ -913,6 +913,36 @@ namespace qhash {
|
|||||||
dummyStatement(&hash, &ob);
|
dummyStatement(&hash, &ob);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void testQHashIntFloatIterator()
|
||||||
|
{
|
||||||
|
typedef QHash<int, float> Hash;
|
||||||
|
Hash hash;
|
||||||
|
hash[11] = 11.0;
|
||||||
|
hash[22] = 22.0;
|
||||||
|
hash[33] = 33.0;
|
||||||
|
hash[44] = 44.0;
|
||||||
|
hash[55] = 55.0;
|
||||||
|
hash[66] = 66.0;
|
||||||
|
|
||||||
|
Hash::iterator it1 = hash.begin();
|
||||||
|
Hash::iterator it2 = it1; ++it2;
|
||||||
|
Hash::iterator it3 = it2; ++it2;
|
||||||
|
Hash::iterator it4 = it3; ++it3;
|
||||||
|
Hash::iterator it5 = it4; ++it4;
|
||||||
|
Hash::iterator it6 = it5; ++it5;
|
||||||
|
|
||||||
|
BREAK_HERE;
|
||||||
|
// Expand hash.
|
||||||
|
// Check hash <6 items> Hash.
|
||||||
|
// Check hash.11 11 float.
|
||||||
|
// Check it1.first 11 int.
|
||||||
|
// Check it1.second 11 float.
|
||||||
|
// Check it1.first 55 int.
|
||||||
|
// Check it1.second 55 float.
|
||||||
|
// Continue.
|
||||||
|
dummyStatement(&hash, &it1, &it2, &it3, &it4, &it5, &it6);
|
||||||
|
}
|
||||||
|
|
||||||
void testQHash()
|
void testQHash()
|
||||||
{
|
{
|
||||||
testQHash1();
|
testQHash1();
|
||||||
@@ -922,6 +952,7 @@ namespace qhash {
|
|||||||
testQHash5();
|
testQHash5();
|
||||||
testQHash6();
|
testQHash6();
|
||||||
testQHash7();
|
testQHash7();
|
||||||
|
testQHashIntFloatIterator();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace qhash
|
} // namespace qhash
|
||||||
|
Reference in New Issue
Block a user