/*
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;
using System.ComponentModel;
using dnSpy.Contracts.Debugger.Text;
namespace dnSpy.Contracts.Debugger.Breakpoints.Code {
///
/// Formats some columns in the code breakpoints window
///
public abstract class DbgBreakpointLocationFormatter : INotifyPropertyChanged, IDisposable {
///
/// Name of the Name property
///
public const string NameProperty = nameof(NameProperty);
///
/// Name of the Module property
///
public const string ModuleProperty = nameof(ModuleProperty);
///
/// Raised when a property is changed
///
public event PropertyChangedEventHandler? PropertyChanged;
void OnPropertyChanged(string propName) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));
///
/// Called when the name needs to be reformatted
///
protected void RaiseNameChanged() => OnPropertyChanged(NameProperty);
///
/// Called when the module needs to be reformatted
///
protected void RaiseModuleChanged() => OnPropertyChanged(ModuleProperty);
///
/// Writes the name shown in the Name column
///
/// Output
/// Options
public abstract void WriteName(IDbgTextWriter output, DbgBreakpointLocationFormatterOptions options);
///
/// Writes the module shown in the Module column
///
/// Output
public abstract void WriteModule(IDbgTextWriter output);
///
/// Called when this instance isn't needed anymore
///
public abstract void Dispose();
}
///
/// Formatter options
///
[Flags]
public enum DbgBreakpointLocationFormatterOptions {
///
/// No bit is set
///
None = 0,
///
/// Show metadata tokens
///
Tokens = 0x00000001,
///
/// Show module names
///
ModuleNames = 0x00000002,
///
/// Show parameter types
///
ParameterTypes = 0x00000004,
///
/// Show parameter names
///
ParameterNames = 0x00000008,
///
/// Show declaring types
///
DeclaringTypes = 0x00000010,
///
/// Show return types
///
ReturnTypes = 0x00000020,
///
/// Show namespaces
///
Namespaces = 0x00000040,
///
/// Show intrinsic type keywords (eg. int instead of Int32)
///
IntrinsicTypeKeywords = 0x00000080,
///
/// Use digit separators
///
DigitSeparators = 0x00000100,
///
/// Use decimal instead of hexadecimal
///
Decimal = 0x00000200,
}
}