Debugger: Rework type handlers to allow for custom selection.
TypeHandler: - Add name field for presentation purposes. Adapt subclasses accordingly. TypeHandlerRoster: - Add methods to count and retrieve all type handlers for a given type, and adjust CreateValueNode to allow for passing in an explicit handler. Adjust callers accordingly. VariablesViewState: - Add helpers to store an explicitly chosen type handler for a node. TypeHandlerMenuItem: - ActionMenuItem subclass that takes care of reference management for its contained type handler. VariablesView: - Add context menu for choosing type handlers if applicable. Implement support for invoking said type handlers in a similar manner to explicit typecasts. - Adjust saving/restoring the view state so that hidden nodes are taken into account as well. This is necessary since it may be the case that the handler had to be applied to the hidden child rather than the visible node (i.e. the BMessage handler when applied to a pointer to a BMessage). All together, these changes allow choosing to switch between views of a type when the Debugger has multiple handlers for it. For example, for BMessages this allows switching between displaying the raw underlying structure vs the decoded message content.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||
* Copyright 2018, Rene Gollent, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef TYPE_HANDLER_H
|
||||
@@ -18,7 +19,8 @@ class TypeHandler : public BReferenceable {
|
||||
public:
|
||||
virtual ~TypeHandler();
|
||||
|
||||
virtual float SupportsType(Type* type) = 0;
|
||||
virtual const char* Name() const = 0;
|
||||
virtual float SupportsType(Type* type) const = 0;
|
||||
virtual status_t CreateValueNode(ValueNodeChild* nodeChild,
|
||||
Type* type, ValueNode*& _node) = 0;
|
||||
// returns a reference
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, [email protected].
|
||||
* Copyright 2018, Rene Gollent, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef TYPE_HANDLER_ROSTER_H
|
||||
@@ -31,11 +32,18 @@ public:
|
||||
status_t Init();
|
||||
status_t RegisterDefaultHandlers();
|
||||
|
||||
status_t FindTypeHandler(ValueNodeChild* nodeChild,
|
||||
int32 CountTypeHandlers(Type* type);
|
||||
status_t FindBestTypeHandler(ValueNodeChild* nodeChild,
|
||||
Type* type, TypeHandler*& _handler);
|
||||
// returns a reference
|
||||
status_t FindTypeHandlers(ValueNodeChild* nodeChild,
|
||||
Type* type, TypeHandlerList*& _handlers);
|
||||
// returns list of references
|
||||
status_t CreateValueNode(ValueNodeChild* nodeChild,
|
||||
Type* type, ValueNode*& _node);
|
||||
Type* type, TypeHandler* handler,
|
||||
ValueNode*& _node);
|
||||
// handler can be null if automatic
|
||||
// search is desired.
|
||||
// returns a reference
|
||||
|
||||
bool RegisterHandler(TypeHandler* handler);
|
||||
|
||||
Reference in New Issue
Block a user