From 84b9c9d8b21799c14df884abefbf684973466668 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Tue, 28 Nov 2006 23:19:05 +0100 Subject: [PATCH] Clean up constructors of the value display items (class VarTree). There is now a dedicated constructor for each of the two places where such an item is allocated. --- kdbg/exprwnd.cpp | 26 ++++++++++++++++++-------- kdbg/exprwnd.h | 4 +++- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/kdbg/exprwnd.cpp b/kdbg/exprwnd.cpp index 570b1e9..7637c87 100644 --- a/kdbg/exprwnd.cpp +++ b/kdbg/exprwnd.cpp @@ -16,10 +16,24 @@ #endif #include "mydebug.h" -VarTree::VarTree(const QString& name, NameKind aKind) : +VarTree::VarTree(ExprValue* v) : + KTreeViewItem(v->m_name), + m_varKind(v->m_varKind), + m_nameKind(v->m_nameKind), + m_value(v->m_value), + m_valueChanged(false), + m_type(0), + m_exprIndex(0), + m_exprIndexUseGuard(false) +{ + setDelayedExpanding(m_varKind == VKpointer); + setExpanded(v->m_initiallyExpanded); +} + +VarTree::VarTree(const QString& name) : KTreeViewItem(name), m_varKind(VKsimple), - m_nameKind(aKind), + m_nameKind(VarTree::NKplain), m_valueChanged(false), m_type(0), m_exprIndex(0), @@ -331,7 +345,7 @@ void ExprWnd::exprList(QStrList& exprs) VarTree* ExprWnd::insertExpr(ExprValue* expr, ProgramTypeTable& typeTable) { // append a new dummy expression - VarTree* display = new VarTree(expr->m_name, VarTree::NKplain); + VarTree* display = new VarTree(expr->m_name); insertItem(display); // replace it right away @@ -559,11 +573,7 @@ void ExprWnd::replaceChildren(VarTree* display, ExprValue* newValues) // insert copies of the newValues for (ExprValue* v = newValues->m_child; v != 0; v = v->m_next) { - VarTree* vNew = new VarTree(v->m_name, v->m_nameKind); - vNew->m_varKind = v->m_varKind; - vNew->m_value = v->m_value; - vNew->setDelayedExpanding(vNew->m_varKind == VarTree::VKpointer); - vNew->setExpanded(v->m_initiallyExpanded); + VarTree* vNew = new VarTree(v); display->appendChild(vNew); // recurse replaceChildren(vNew, v); diff --git a/kdbg/exprwnd.h b/kdbg/exprwnd.h index 2a81f01..47824e6 100644 --- a/kdbg/exprwnd.h +++ b/kdbg/exprwnd.h @@ -13,6 +13,7 @@ class ProgramTypeTable; class TypeInfo; +struct ExprValue; /* a variable's value is the tree of sub-variables */ @@ -34,7 +35,8 @@ public: bool m_exprIndexUseGuard; /* ditto; if guard expr should be used */ QString m_partialValue; /* while struct value update is in progress */ - VarTree(const QString& name, NameKind kind); + VarTree(ExprValue* v); + VarTree(const QString& name); virtual ~VarTree(); public: void paintValue(QPainter* painter); -- 2.11.4.GIT