浏览代码

add diagnosticable mixin

/siyaoH-1.17-PlatformMessage
xingweizhu 4 年前
当前提交
c122c592
共有 3 个文件被更改,包括 92 次插入3 次删除
  1. 18
      com.unity.uiwidgets/Runtime/foundation/diagnostics.cs
  2. 37
      com.unity.uiwidgets/Runtime/foundation/diagnosticable.mixin.gen.cs
  3. 40
      com.unity.uiwidgets/Runtime/foundation/diagnosticable.mixin.njk

18
com.unity.uiwidgets/Runtime/foundation/diagnostics.cs


}
}
public class DiagnosticableNode<T> : DiagnosticsNode where T : Diagnosticable {
public class DiagnosticableNode<T> : DiagnosticsNode where T : IDiagnosticable {
T value = null,
T value = default,
DiagnosticsTreeStyle? style = null
) : base(name: name, style: style) {
D.assert(value != null);

public string emptyBodyDescription;
}
public abstract class Diagnosticable {
public interface IDiagnosticable {
string toStringShort();
string toString(DiagnosticLevel minLevel = DiagnosticLevel.debug);
DiagnosticsNode toDiagnosticsNode(
string name = null,
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.sparse);
void debugFillProperties(DiagnosticPropertiesBuilder properties);
}
public abstract class Diagnosticable : IDiagnosticable {
protected Diagnosticable() {
}

37
com.unity.uiwidgets/Runtime/foundation/diagnosticable.mixin.gen.cs


namespace Unity.UIWidgets.foundation {
public class DiagnosticableMixinChangeNotifier : ChangeNotifier, IDiagnosticable {
protected DiagnosticableMixinChangeNotifier() {
}
public virtual string toStringShort() {
return foundation_.describeIdentity(this);
}
public override string ToString() {
return toString();
}
public virtual string toString(DiagnosticLevel minLevel = DiagnosticLevel.debug) {
string fullString = null;
D.assert(() => {
fullString = toDiagnosticsNode(style: DiagnosticsTreeStyle.singleLine)
.toString(minLevel: minLevel);
return true;
});
return fullString ?? toStringShort();
}
public virtual DiagnosticsNode toDiagnosticsNode(
string name = null,
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.sparse) {
return new DiagnosticableNode<DiagnosticableMixinChangeNotifier>(
name: name, value: this, style: style
);
}
public virtual void debugFillProperties(DiagnosticPropertiesBuilder properties) {
}
}
}

40
com.unity.uiwidgets/Runtime/foundation/diagnosticable.mixin.njk


namespace Unity.UIWidgets.foundation {
{% macro DiagnosticableMixin(with) %}
{% set className = 'DiagnosticableMixin' + with %}
public class {{className}} : {{with}}, IDiagnosticable {
protected {{className}}() {
}
public virtual string toStringShort() {
return foundation_.describeIdentity(this);
}
public override string ToString() {
return toString();
}
public virtual string toString(DiagnosticLevel minLevel = DiagnosticLevel.debug) {
string fullString = null;
D.assert(() => {
fullString = toDiagnosticsNode(style: DiagnosticsTreeStyle.singleLine)
.toString(minLevel: minLevel);
return true;
});
return fullString ?? toStringShort();
}
public virtual DiagnosticsNode toDiagnosticsNode(
string name = null,
DiagnosticsTreeStyle style = DiagnosticsTreeStyle.sparse) {
return new DiagnosticableNode<{{className}}>(
name: name, value: this, style: style
);
}
public virtual void debugFillProperties(DiagnosticPropertiesBuilder properties) {
}
}
{% endmacro %}
{{ DiagnosticableMixin('ChangeNotifier') }}
}
正在加载...
取消
保存