From 4b42789bdaccb89441ebd0b85fe7ab7fdea04df5 Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 25 Sep 2018 18:48:29 +0200 Subject: Debugger: Privatize GdbMi::m_children Change-Id: I6e51290c4521be40f516a452f32bdc82a4c051e6 Reviewed-by: Christian Stenger --- src/plugins/debugger/debuggerprotocol.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/plugins/debugger/debuggerprotocol.cpp') diff --git a/src/plugins/debugger/debuggerprotocol.cpp b/src/plugins/debugger/debuggerprotocol.cpp index b74770afa8..c414e08909 100644 --- a/src/plugins/debugger/debuggerprotocol.cpp +++ b/src/plugins/debugger/debuggerprotocol.cpp @@ -267,15 +267,19 @@ static QString ind(int indent) void GdbMi::dumpChildren(QString * str, bool multiline, int indent) const { - for (int i = 0; i < m_children.size(); ++i) { - if (i != 0) { + bool first = true; + for (const GdbMi &child : *this) { + if (first) { + first = false; + } else { *str += ','; if (multiline) *str += '\n'; } + if (multiline) *str += ind(indent); - *str += m_children.at(i).toString(multiline, indent); + *str += child.toString(multiline, indent); } } @@ -371,9 +375,9 @@ void GdbMi::fromStringMultiple(const QString &ba) const GdbMi &GdbMi::operator[](const char *name) const { static GdbMi empty; - for (int i = 0, n = int(m_children.size()); i < n; ++i) - if (m_children.at(i).m_name == QLatin1String(name)) - return m_children.at(i); + for (const GdbMi &child : *this) + if (child.m_name == QLatin1String(name)) + return child; return empty; } -- cgit v1.2.1