/*
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.Collections.ObjectModel;
using System.Globalization;
using dnSpy.Contracts.Debugger.DotNet.Evaluation.Formatters;
using dnSpy.Contracts.Debugger.DotNet.Text;
using dnSpy.Contracts.Debugger.Evaluation;
using dnSpy.Contracts.Debugger.Text;
using dnSpy.Debugger.DotNet.Metadata;
namespace dnSpy.Contracts.Debugger.DotNet.Evaluation.ValueNodes {
///
/// A .NET value node
///
public abstract class DbgDotNetValueNode : DbgObject {
///
/// Gets the expected type or null
///
public abstract DmdType? ExpectedType { get; }
///
/// Gets the actual type or null
///
public abstract DmdType? ActualType { get; }
///
/// Gets the error message or null
///
public abstract string? ErrorMessage { get; }
///
/// Gets the value or null
///
public abstract DbgDotNetValue? Value { get; }
///
/// Gets the name
///
public abstract DbgDotNetText Name { get; }
///
/// Gets the expression
///
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; }
///
/// Gets the format specifiers or null
///
public abstract ReadOnlyCollection? FormatSpecifiers { 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 property 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 DbgDotNetValueNode[] GetChildren(DbgEvaluationInfo evalInfo, ulong index, int count, DbgValueNodeEvaluationOptions options);
///
/// Formats the name. Returns false if nothing was written to
///
/// Evaluation info
/// Output
/// Formatter
/// Options
/// Culture or null to use invariant culture
///
public virtual bool FormatName(DbgEvaluationInfo evalInfo, IDbgTextWriter output, DbgDotNetFormatter formatter, DbgValueFormatterOptions options, CultureInfo? cultureInfo) => false;
///
/// Formats the value column. Returns false if nothing was written to
///
/// Evaluation info
/// Output
/// Formatter
/// Options
/// Culture or null to use invariant culture
///
public virtual bool FormatValue(DbgEvaluationInfo evalInfo, IDbgTextWriter output, DbgDotNetFormatter formatter, DbgValueFormatterOptions options, CultureInfo? cultureInfo) => false;
///
/// Formats the expected type. Returns false if nothing was written to
///
/// Evaluation info
/// Output
/// Formatter
/// Options
/// Value options
/// Culture or null to use invariant culture
///
public virtual bool FormatExpectedType(DbgEvaluationInfo evalInfo, IDbgTextWriter output, DbgDotNetFormatter formatter, DbgValueFormatterTypeOptions options, DbgValueFormatterOptions valueOptions, CultureInfo? cultureInfo) => false;
///
/// Formats the actual type. Returns false if nothing was written to
///
/// Evaluation info
/// Output
/// Formatter
/// Options
/// Value options
/// Culture or null to use invariant culture
///
public virtual bool FormatActualType(DbgEvaluationInfo evalInfo, IDbgTextWriter output, DbgDotNetFormatter formatter, DbgValueFormatterTypeOptions options, DbgValueFormatterOptions valueOptions, CultureInfo? cultureInfo) => false;
}
}