Debugger: Cleanups.

VariablesView:
- Remove unused member variable.
- Add optional presentation name field to ModelNode, which allows
  overriding the name of its underlying ValueNode for display purposes.
  Used to ensure that a top-level node for an expression always shows
  the expression string itself, even when the returned result is a value
  node with a different name.
This commit is contained in:
Rene Gollent
2014-11-23 09:13:06 -05:00
parent 0690178786
commit 6136e4303c
@@ -267,7 +267,8 @@ public:
fComponentPath(NULL), fComponentPath(NULL),
fIsPresentationNode(isPresentationNode), fIsPresentationNode(isPresentationNode),
fHidden(false), fHidden(false),
fValueChanged(false) fValueChanged(false),
fPresentationName()
{ {
fVariable->AcquireReference(); fVariable->AcquireReference();
fNodeChild->AcquireReference(); fNodeChild->AcquireReference();
@@ -324,7 +325,13 @@ public:
const BString& Name() const const BString& Name() const
{ {
return fNodeChild->Name(); return fPresentationName.IsEmpty()
? fNodeChild->Name() : fPresentationName;
}
void SetPresentationName(const BString& name)
{
fPresentationName = name;
} }
Type* GetType() const Type* GetType() const
@@ -530,7 +537,7 @@ private:
bool fIsPresentationNode; bool fIsPresentationNode;
bool fHidden; bool fHidden;
bool fValueChanged; bool fValueChanged;
bool fIsExpression; BString fPresentationName;
public: public:
ModelNode* fNext; ModelNode* fNext;
@@ -638,7 +645,8 @@ public:
int32 columnIndex, BToolTip** _tip); int32 columnIndex, BToolTip** _tip);
status_t AddSyntheticNode(Variable* variable, status_t AddSyntheticNode(Variable* variable,
ValueNodeChild*& _child); ValueNodeChild*& _child,
const char* presentationName = NULL);
void RemoveSyntheticNode(ModelNode* node); void RemoveSyntheticNode(ModelNode* node);
private: private:
@@ -1513,7 +1521,7 @@ VariablesView::VariableTableModel::GetToolTipForTablePath(
status_t status_t
VariablesView::VariableTableModel::AddSyntheticNode(Variable* variable, VariablesView::VariableTableModel::AddSyntheticNode(Variable* variable,
ValueNodeChild*& _child) ValueNodeChild*& _child, const char* presentationName)
{ {
ValueNodeContainer* container = fNodeManager->GetContainer(); ValueNodeContainer* container = fNodeManager->GetContainer();
AutoLocker<ValueNodeContainer> containerLocker(container); AutoLocker<ValueNodeContainer> containerLocker(container);
@@ -1557,6 +1565,9 @@ VariablesView::VariableTableModel::AddSyntheticNode(Variable* variable,
ModelNode* childNode = fNodeTable.Lookup(_child); ModelNode* childNode = fNodeTable.Lookup(_child);
if (childNode != NULL) { if (childNode != NULL) {
if (presentationName != NULL)
childNode->SetPresentationName(presentationName);
ValueNode* valueNode = _child->Node(); ValueNode* valueNode = _child->Node();
if (valueNode->LocationAndValueResolutionState() if (valueNode->LocationAndValueResolutionState()
== VALUE_NODE_UNRESOLVED) { == VALUE_NODE_UNRESOLVED) {
@@ -2936,7 +2947,8 @@ VariablesView::_AddExpressionNode(ExpressionInfo* info, status_t result,
return; return;
variableReference.SetTo(variable, true); variableReference.SetTo(variable, true);
status_t error = fVariableTableModel->AddSyntheticNode(variable, child); status_t error = fVariableTableModel->AddSyntheticNode(variable, child,
info->Expression());
if (error != B_OK) if (error != B_OK)
return; return;