Commit 335948fa authored by David Schulz's avatar David Schulz

CdbExt: Add dumper for C++11 std::array.

Change-Id: I1b9285e4bc3d0d9a21f0779b3e6dec1f9a4b4ee1
Reviewed-by: default avatarFriedemann Kleint <Friedemann.Kleint@digia.com>
parent 7ef028a4
......@@ -203,7 +203,18 @@ int containerSize(KnownType kt, const SymbolGroupValue &v)
if (const SymbolGroupValue deque = v[unsigned(0)])
return containerSize(KT_StdDeque, deque);
break;
case KT_StdArray: {
std::string::size_type arraySizeStart = v.type().find(',');
if (arraySizeStart != std::string::npos) {
++arraySizeStart;
std::string::size_type arraySizeEnd = v.type().find('>', arraySizeStart);
if (arraySizeEnd != std::string::npos)
return std::stoi(v.type().substr(arraySizeStart, arraySizeEnd - arraySizeStart));
}
break;
}
}
return -1;
}
......@@ -253,6 +264,22 @@ static inline AbstractSymbolGroupNodePtrVector stdListChildList(SymbolGroupNode
return AbstractSymbolGroupNodePtrVector();
}
static inline AbstractSymbolGroupNodePtrVector stdArrayChildList(SymbolGroupNode *n, int count,
const SymbolGroupValueContext &ctx)
{
AbstractSymbolGroupNodePtrVector rc;
if (SymbolGroupValue elems = SymbolGroupValue(n, ctx)["_Elems"]) {
rc.reserve(count);
for (int i = 0; i < count; ++i) {
if (const SymbolGroupValue value = elems[i])
rc.push_back(ReferenceSymbolGroupNode::createArrayNode(i, value.node()));
else
break;
}
}
return rc;
}
// QLinkedList<T>: Dummy head node and then a linked list of "n", "t".
static inline AbstractSymbolGroupNodePtrVector qLinkedListChildList(SymbolGroupNode *n, int count,
const SymbolGroupValueContext &ctx)
......@@ -1109,6 +1136,8 @@ AbstractSymbolGroupNodePtrVector containerChildren(SymbolGroupNode *node, int ty
break;
case KT_StdList:
return stdListChildList(node, size , ctx);
case KT_StdArray:
return stdArrayChildList(node, size , ctx);
case KT_StdDeque:
return stdDequeChildList(SymbolGroupValue(node, ctx), size);
case KT_StdStack:
......
......@@ -174,7 +174,8 @@ enum KnownType
KT_StdDeque = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 4,
KT_StdSet = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 5,
KT_StdMap = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 6,
KT_StdMultiMap = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 7
KT_StdMultiMap = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 7,
KT_StdArray = KT_STL_Type + KT_ContainerType + KT_HasSimpleDumper + 8
};
#endif // KNOWNTYPE_H
......@@ -1078,6 +1078,8 @@ static KnownType knownClassTypeHelper(const std::string &type,
return KT_StdStack;
if (!type.compare(hPos, 5, "deque"))
return KT_StdDeque;
if (!type.compare(hPos, 5, "array"))
return KT_StdArray;
break;
case 6:
if (!type.compare(hPos, 6, "vector"))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment