-
-
Notifications
You must be signed in to change notification settings - Fork 134
/
Copy pathPlantUmlSourceGenerator.Attributes.cs
123 lines (113 loc) · 6.11 KB
/
PlantUmlSourceGenerator.Attributes.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Text;
using System.Text;
namespace PlantUmlClassDiagramGenerator.SourceGenerator
{
public partial class PlantUmlSourceGenerator
{
public void RegisterAttributes(IncrementalGeneratorInitializationContext context)
{
context.RegisterPostInitializationOutput(context =>
{
const string source = """
#nullable enable
namespace PlantUmlClassDiagramGenerator.SourceGenerator.Attributes;
[global::System.Flags]
internal enum Accessibilities
{
NotSet = 0x8000,
None = 0,
Public = 0x01,
Protected = 0x02,
Internal = 0x04,
ProtectedInternal = 0x08,
PrivateProtected = 0x10,
Private = 0x20,
All = Public | Protected | Internal | ProtectedInternal | PrivateProtected | Private
}
[global::System.Flags]
internal enum AssociationTypes
{
NotSet = 0x8000,
None = 0,
Inheritance = 0x01,
Realization = 0x02,
Property = 0x04,
Field = 0x08,
MethodParameter = 0x10,
Nest = 0x20,
All = Inheritance | Realization | Property | Field | MethodParameter | Nest
}
[global::System.AttributeUsage(
global::System.AttributeTargets.Assembly
| global::System.AttributeTargets.Class
| global::System.AttributeTargets.Interface
| global::System.AttributeTargets.Enum
| global::System.AttributeTargets.Struct)]
internal sealed class PlantUmlDiagramAttribute : global::System.Attribute
{
public Accessibilities IncludeMemberAccessibilities { get; set; } = Accessibilities.NotSet;
public Accessibilities ExcludeMemberAccessibilities { get; set; } = Accessibilities.NotSet;
public AssociationTypes DisableAssociationTypes { get; set; } = AssociationTypes.NotSet;
}
[global::System.AttributeUsage(
global::System.AttributeTargets.Class
| global::System.AttributeTargets.Struct
| global::System.AttributeTargets.Enum
| global::System.AttributeTargets.Constructor
| global::System.AttributeTargets.Method
| global::System.AttributeTargets.Property
| global::System.AttributeTargets.Field
| global::System.AttributeTargets.Event
| global::System.AttributeTargets.Interface
| global::System.AttributeTargets.Parameter)]
internal sealed class PlantUmlIgnoreAttribute : global::System.Attribute
{ }
[global::System.AttributeUsage(
global::System.AttributeTargets.Class
| global::System.AttributeTargets.Struct
| global::System.AttributeTargets.Enum
| global::System.AttributeTargets.Constructor
| global::System.AttributeTargets.Method
| global::System.AttributeTargets.Property
| global::System.AttributeTargets.Field
| global::System.AttributeTargets.Event
| global::System.AttributeTargets.Interface
| global::System.AttributeTargets.Parameter)]
internal sealed class PlantUmlAssociationAttribute(string node) : global::System.Attribute
{
public string Node { get;} = node;
public global::System.Type? LeafType { get; set; } = null;
public string RootLabel { get; set; } = "";
public string NodeLabel { get; set; } = "";
public string LeafLabel { get; set; } = "";
}
[global::System.AttributeUsage(
global::System.AttributeTargets.Class
| global::System.AttributeTargets.Struct
| global::System.AttributeTargets.Enum
| global::System.AttributeTargets.Constructor
| global::System.AttributeTargets.Method
| global::System.AttributeTargets.Property
| global::System.AttributeTargets.Field
| global::System.AttributeTargets.Event
| global::System.AttributeTargets.Interface
| global::System.AttributeTargets.Parameter)]
internal sealed class PlantUmlIgnoreAssociationAttribute : global::System.Attribute
{ }
[global::System.AttributeUsage(
global::System.AttributeTargets.Assembly
| global::System.AttributeTargets.Class
| global::System.AttributeTargets.Interface
| global::System.AttributeTargets.Enum
| global::System.AttributeTargets.Struct)]
internal sealed class PlantUmlExtraAssociationTargetsAttribute(params global::System.Type[] types ) : global::System.Attribute
{
public global::System.Type[] Types { get; } = types;
}
""";
context.AddSource("Attributes.g", SourceText.From(source, Encoding.UTF8));
});
}
}
}