/* Copyright (C) 2014-2019 de4dot@gmail.com This file is part of dnSpy dnSpy is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. dnSpy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with dnSpy. If not, see . */ using System.Globalization; using dnSpy.Contracts.Debugger.Evaluation; namespace dnSpy.Contracts.Debugger.Engine.Evaluation { /// /// A value shown in a treeview (eg. in locals window) /// public abstract class DbgEngineValueNode : DbgObject { /// /// Gets the error message or null /// public abstract string? ErrorMessage { get; } /// /// Gets the value or null if none /// public abstract DbgEngineValue? Value { get; } /// /// Gets the expression that is used when adding an expression to the watch window or /// when assigning a new value to the source. /// public abstract string Expression { get; } /// /// Image name, see /// public abstract string ImageName { get; } /// /// true if this is a read-only value /// public abstract bool IsReadOnly { get; } /// /// true if the expression causes side effects /// public abstract bool CausesSideEffects { get; } /// /// Returns true if it has children, false if it has no children and null if it's unknown (eg. it's too expensive to calculate it now). /// UI code can use this property to decide if it shows the treeview node expander ("|>"). /// public abstract bool? HasChildren { get; } /// /// Number of children. This method is called as late as possible and can be lazily initialized. /// It's assumed to be 0 if is false. /// /// Evaluation info /// public abstract ulong GetChildCount(DbgEvaluationInfo evalInfo); /// /// Creates new children /// /// Evaluation info /// Index of first child /// Max number of children to return /// Options /// public abstract DbgEngineValueNode[] GetChildren(DbgEvaluationInfo evalInfo, ulong index, int count, DbgValueNodeEvaluationOptions options); /// /// Formats the name, value, and type /// /// Evaluation info /// Options /// Culture or null to use invariant culture public abstract void Format(DbgEvaluationInfo evalInfo, IDbgValueNodeFormatParameters options, CultureInfo? cultureInfo); /// /// Writes a new value /// /// Evaluation info /// Source expression (rhs) /// Options /// public abstract DbgEngineValueNodeAssignmentResult Assign(DbgEvaluationInfo evalInfo, string expression, DbgEvaluationOptions options); } /// /// Assignment result /// public readonly struct DbgEngineValueNodeAssignmentResult { /// /// Gets the error message (also see ) or null if none /// public string? Error { get; } /// /// Gets the flags /// public DbgEEAssignmentResultFlags Flags { get; } /// /// Constructor /// /// Result flags /// Error message or one of the errors in public DbgEngineValueNodeAssignmentResult(DbgEEAssignmentResultFlags flags, string? error) { Flags = flags; Error = error; } } }