Skip to content

Commit 80e0b82

Browse files
authored
Merge pull request #7 from eNeRGy164/more-examples-and-functions
More examples and functions
2 parents cc748a5 + 7b6b4c2 commit 80e0b82

33 files changed

+2235
-676
lines changed

.github/workflows/continuous-integration-workflow.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ jobs:
2929
- name: Setup .NET Core
3030
uses: actions/setup-dotnet@v1
3131
with:
32-
dotnet-version: 6.x
32+
dotnet-version: |
33+
6.x
34+
7.x
3335
3436
- name: Install dependencies
3537
run: dotnet restore

docs/commands.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ Following the PlantUML source code.
2929
| caption \<CAPTION> | no | |
3030
| legend [\<ALIGN>] | no | |
3131
| endlegend | no | |
32+
| skinparam \<NAME> \<VALUE> | yes | `SkinParam` |
33+
| skinparam \<PREFIX> { | no | |
34+
| left to right direction | yes | `Direction` |
35+
| top to bottom direction | yes | `Direction` |
3236

3337
## Activity Diagrams
3438

@@ -102,8 +106,10 @@ Following the PlantUML source code.
102106
| end box | yes | `BoxEnd` |
103107
| delay [\<LABEL>] | yes | `Delay` |
104108
| divider [\<LABEL>] | yes | `Divider` |
105-
| hide footbox | no | |
106-
| show footbox | no | |
109+
| hide footbox | yes | `HideFootBox` |
110+
| show footbox | yes | `ShowFootBox` |
111+
| hide unlinked | yes | `HideUnlinked` |
112+
| show unlinked | yes | `ShowUnlinked` |
107113
| opt [\<COLOR>] [\<COMMENT>] | no | |
108114
| end | yes | `GroupEnd` |
109115
| alt [\<COLOR>] [\<COMMENT>] | partial | `AltStart` |
@@ -127,21 +133,21 @@ Following the PlantUML source code.
127133
| ignore newpage | no | |
128134
| newpage [\<TITLE>] | yes | `NewPage` |
129135
| create [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `Create` |
130-
| participant \<NAME> [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `Participant` |
131-
| actor \<NAME> [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `Actor` |
132-
| create actor \<NAME> [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `CreateActor` |
133-
| boundary \<NAME> [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `Boundary` |
134-
| create boundary \<NAME> [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `CreateBoundary` |
135-
| collections \<NAME> [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `Collections` |
136-
| create collections \<NAME> [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `CreateCollections` |
137-
| control \<NAME> [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `Control` |
138-
| create control \<NAME> [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `CreateControl` |
139-
| entity \<NAME> [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `Entity` |
140-
| create entity \<NAME> [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `CreateEntity` |
141-
| database \<NAME> [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `Database` |
142-
| create database \<NAME> [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `CreateDatabase` |
143-
| queue \<NAME> [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `Queue` |
144-
| create queue \<NAME> [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `CreateQueue` |
136+
| participant \<NAME> [\<STEREO>] [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `Participant` |
137+
| actor \<NAME> [\<STEREO>] [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `Actor` |
138+
| create actor \<NAME> [\<STEREO>] [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `CreateActor` |
139+
| boundary \<NAME> [\<STEREO>] [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `Boundary` |
140+
| create boundary \<NAME> [\<STEREO>] [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `CreateBoundary` |
141+
| collections \<NAME> [\<STEREO>] [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `Collections` |
142+
| create collections \<NAME> [\<STEREO>] [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `CreateCollections` |
143+
| control \<NAME> [\<STEREO>] [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `Control` |
144+
| create control \<NAME> [\<STEREO>] [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `CreateControl` |
145+
| entity \<NAME> [\<STEREO>] [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `Entity` |
146+
| create entity \<NAME> [\<STEREO>] [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `CreateEntity` |
147+
| database \<NAME> [\<STEREO>] [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `Database` |
148+
| create database \<NAME> [\<STEREO>] [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `CreateDatabase` |
149+
| queue \<NAME> [\<STEREO>] [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `Queue` |
150+
| create queue \<NAME> [\<STEREO>] [order \<ORDER>] [\<URL>] [\<COLOR>] | partial | `CreateQueue` |
145151
| ref[\<COLOR>] over \<NAME>[,\<NAME>] : [\<URL>] [\<TEXT>] | partial | `Ref` |
146152
| ref[\<COLOR>] over \<NAME>[,\<NAME>] | partial | `StartRef` |
147153
| end ref | yes | `EndRef` |

src/PlantUml.Builder/Constant.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,24 @@ public static class Words
6464
public const string Alt = "alt";
6565
public const string As = "as";
6666
public const string Auto = "auto";
67+
public const string Bottom = "bottom";
6768
public const string Box = "box";
6869
public const string Create = "create";
6970
public const string Deactivate = "deactivate";
7071
public const string Destroy = "destroy";
72+
public const string Direction = "direction";
7173
public const string Else = "else";
7274
public const string Empty = "empty";
7375
public const string End = "end";
7476
public const string Extends = "extends";
77+
public const string Footbox = "footbox";
7578
public const string Footer = "footer";
7679
public const string Group = "group";
7780
public const string Header = "header";
7881
public const string Hide = "hide";
7982
public const string Implements = "implements";
8083
public const string Increase = "inc";
84+
public const string Left = "left";
8185
public const string Loop = "loop";
8286
public const string Map = "map";
8387
public const string Mixing = "mixing";
@@ -95,13 +99,18 @@ public static class Words
9599
public const string Ref = "ref";
96100
public const string Resume = "resume";
97101
public const string Return = "return";
102+
public const string Right = "right";
98103
public const string Separator = "separator";
99104
public const string Set = "set";
105+
public const string Show = "show";
100106
public const string SkinParam = "skinparam";
101107
public const string Start = "start";
102108
public const string Static = "static";
103109
public const string Stop = "stop";
104110
public const string Title = "title";
111+
public const string To = "to";
112+
public const string Top = "top";
113+
public const string Unlinked = "unlinked";
105114
public const string Uml = "uml";
106115
}
107116

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
namespace PlantUml.Builder
2+
{
3+
/// <summary>
4+
/// Represents different directions of the UML diagram.
5+
/// </summary>
6+
public enum DiagramDirection
7+
: byte
8+
{
9+
/// <summary>
10+
/// Represents a left to right direction.
11+
/// </summary>
12+
LeftToRight = 0,
13+
14+
/// <summary>
15+
/// Represents a top to bottom direction.
16+
/// </summary>
17+
TopToBottom,
18+
}
19+
}

src/PlantUml.Builder/SequenceDiagrams/ParticipantName.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
using System.Text.RegularExpressions;
2+
using static System.Text.RegularExpressions.RegexOptions;
23

34
namespace PlantUml.Builder.SequenceDiagrams;
45

56
public class ParticipantName
67
{
7-
private static readonly Regex nameAlias = new("^(?:[\"]?(?<Name>[^\"]+)(?:[\"][\\s]*|[\\s]+)as[\\s]+(?<Alias>[^\"\\s]+)|(?<Alias>[^\"\\s]+)[\\s]+as(?:[\\s]*[\"]|[\\s]+)(?<Name>[^\"]+)[\"]?|[\"]?(?<Name>[^\"]+)[\"]?)$", RegexOptions.Singleline | RegexOptions.Compiled);
8-
private const string ValidNameChars = "0123456789_@.";
8+
private static readonly Regex nameAlias = new("^(?:[\"]?(?<Name>[^\"]+)(?:[\"][\\s]*|[\\s]+)as[\\s]+(?<Alias>[^\"\\s]+)|(?<Alias>[^\"\\s]+)[\\s]+as(?:[\\s]*[\"]|[\\s]+)(?<Name>[^\"]+)[\"]?|[\"]?(?<Name>[^\"]+)[\"]?)$", Singleline | Compiled);
9+
private static readonly HashSet<char> validNameChars = new("0123456789_@.".ToCharArray());
910

1011
public string Name { get; private set; }
1112

1213
public string Alias { get; private set; } = string.Empty;
1314

14-
internal static readonly ParticipantName Outside = new(string.Empty + ArrowParts.LeftExternal + ArrowParts.RightExternal);
15-
1615
public ParticipantName(string name)
1716
: this(name, default)
1817
{
@@ -80,9 +79,11 @@ private static string FormatLongName(string name)
8079

8180
private static bool MustBeQuoted(string name)
8281
{
83-
foreach (var c in name)
82+
for (int i = 0; i < name.Length; i++)
8483
{
85-
if (char.IsLetter(c) || ValidNameChars.IndexOf(c) > -1)
84+
char c = name[i];
85+
86+
if (char.IsLetter(c) || validNameChars.Contains(c))
8687
{
8788
continue;
8889
}

src/PlantUml.Builder/SequenceDiagrams/StringBuilderExtensions/Actor.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ public static partial class StringBuilderExtensions
99
/// <param name="displayName">Optional display name of the actor.</param>
1010
/// <param name="color">Optional color of the actor.</param>
1111
/// <param name="order">Optional order of the actor.</param>
12+
/// <param name="stereotype">Optional stereotype of the actor.</param>
13+
/// <param name="customSpot">Optional custom spot of the stereotype.</param>
1214
/// <exception cref="ArgumentNullException">Thrown when <paramref name="stringBuilder"/> is <see langword="null"/>.</exception>
1315
/// <exception cref="ArgumentException">Thrown when <paramref name="name"/> is <see langword="null"/>, empty of only white space.</exception>
14-
public static void Actor(this StringBuilder stringBuilder, string name, string displayName = null, Color color = null, int? order = null)
16+
public static void Actor(this StringBuilder stringBuilder, string name, string displayName = null, Color color = null, int? order = null, string stereotype = default, CustomSpot customSpot = default)
1517
{
16-
stringBuilder.ParticipantBase(ParticipantType.Actor, new ParticipantName(name, displayName), color, order);
18+
stringBuilder.ParticipantBase(ParticipantType.Actor, new ParticipantName(name, displayName), color, order, stereotype, customSpot);
1719
}
1820

1921
/// <summary>
@@ -23,10 +25,12 @@ public static void Actor(this StringBuilder stringBuilder, string name, string d
2325
/// <param name="displayName">Optional display name of the actor.</param>
2426
/// <param name="color">Optional color of the actor.</param>
2527
/// <param name="order">Optional order of the actor.</param>
28+
/// <param name="stereotype">Optional stereotype of the actor.</param>
29+
/// <param name="customSpot">Optional custom spot of the stereotype.</param>
2630
/// <exception cref="ArgumentNullException">Thrown when <paramref name="stringBuilder"/> is <see langword="null"/>.</exception>
2731
/// <exception cref="ArgumentException">Thrown when <paramref name="name"/> is <see langword="null"/>, empty of only white space.</exception>
28-
public static void CreateActor(this StringBuilder stringBuilder, string name, string displayName = null, Color color = null, int? order = null)
32+
public static void CreateActor(this StringBuilder stringBuilder, string name, string displayName = null, Color color = null, int? order = null, string stereotype = default, CustomSpot customSpot = default)
2933
{
30-
stringBuilder.CreateParticipantBase(new ParticipantName(name, displayName), ParticipantType.Actor, color, order);
34+
stringBuilder.CreateParticipantBase(new ParticipantName(name, displayName), ParticipantType.Actor, color, order, stereotype, customSpot);
3135
}
3236
}

src/PlantUml.Builder/SequenceDiagrams/StringBuilderExtensions/Boundary.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ public static partial class StringBuilderExtensions
99
/// <param name="displayName">Optional display name of the boundary.</param>
1010
/// <param name="color">Optional color of the boundary.</param>
1111
/// <param name="order">Optional order of the boundary.</param>
12+
/// <param name="stereotype">Optional stereotype of the boundary.</param>
13+
/// <param name="customSpot">Optional custom spot of the stereotype.</param>
1214
/// <exception cref="ArgumentNullException">Thrown when <paramref name="stringBuilder"/> is <see langword="null"/>.</exception>
1315
/// <exception cref="ArgumentException">Thrown when <paramref name="name"/> is <see langword="null"/>, empty of only white space.</exception>
14-
public static void Boundary(this StringBuilder stringBuilder, string name, string displayName = null, Color color = null, int? order = null)
16+
public static void Boundary(this StringBuilder stringBuilder, string name, string displayName = null, Color color = null, int? order = null, string stereotype = default, CustomSpot customSpot = default)
1517
{
16-
stringBuilder.ParticipantBase(ParticipantType.Boundary, new ParticipantName(name, displayName), color, order);
18+
stringBuilder.ParticipantBase(ParticipantType.Boundary, new ParticipantName(name, displayName), color, order, stereotype, customSpot);
1719
}
1820

1921
/// <summary>
@@ -23,10 +25,12 @@ public static void Boundary(this StringBuilder stringBuilder, string name, strin
2325
/// <param name="displayName">Optional display name of the boundary.</param>
2426
/// <param name="color">Optional color of the boundary.</param>
2527
/// <param name="order">Optional order of the boundary.</param>
28+
/// <param name="stereotype">Optional stereotype of the boundary.</param>
29+
/// <param name="customSpot">Optional custom spot of the stereotype.</param>
2630
/// <exception cref="ArgumentNullException">Thrown when <paramref name="stringBuilder"/> is <see langword="null"/>.</exception>
2731
/// <exception cref="ArgumentException">Thrown when <paramref name="name"/> is <see langword="null"/>, empty of only white space.</exception>
28-
public static void CreateBoundary(this StringBuilder stringBuilder, string name, string displayName = null, Color color = null, int? order = null)
32+
public static void CreateBoundary(this StringBuilder stringBuilder, string name, string displayName = null, Color color = null, int? order = null, string stereotype = default, CustomSpot customSpot = default)
2933
{
30-
stringBuilder.CreateParticipantBase(new ParticipantName(name, displayName), ParticipantType.Boundary, color, order);
34+
stringBuilder.CreateParticipantBase(new ParticipantName(name, displayName), ParticipantType.Boundary, color, order, stereotype, customSpot);
3135
}
3236
}

src/PlantUml.Builder/SequenceDiagrams/StringBuilderExtensions/Collections.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ public static partial class StringBuilderExtensions
99
/// <param name="displayName">Optional display name of the collections.</param>
1010
/// <param name="color">Optional color of the collections.</param>
1111
/// <param name="order">Optional order of the collections.</param>
12+
/// <param name="stereotype">Optional stereotype of the collections.</param>
13+
/// <param name="customSpot">Optional custom spot of the stereotype.</param>
1214
/// <exception cref="ArgumentNullException">Thrown when <paramref name="stringBuilder"/> is <see langword="null"/>.</exception>
1315
/// <exception cref="ArgumentException">Thrown when <paramref name="name"/> is <see langword="null"/>, empty of only white space.</exception>
14-
public static void Collections(this StringBuilder stringBuilder, string name, string displayName = null, Color color = null, int? order = null)
16+
public static void Collections(this StringBuilder stringBuilder, string name, string displayName = null, Color color = null, int? order = null, string stereotype = default, CustomSpot customSpot = default)
1517
{
16-
stringBuilder.ParticipantBase(ParticipantType.Collections, new ParticipantName(name, displayName), color, order);
18+
stringBuilder.ParticipantBase(ParticipantType.Collections, new ParticipantName(name, displayName), color, order, stereotype, customSpot);
1719
}
1820

1921
/// <summary>
@@ -23,10 +25,12 @@ public static void Collections(this StringBuilder stringBuilder, string name, st
2325
/// <param name="displayName">Optional display name of the collections.</param>
2426
/// <param name="color">Optional color of the collections.</param>
2527
/// <param name="order">Optional order of the collections.</param>
28+
/// <param name="stereotype">Optional stereotype of the collections.</param>
29+
/// <param name="customSpot">Optional custom spot of the stereotype.</param>
2630
/// <exception cref="ArgumentNullException">Thrown when <paramref name="stringBuilder"/> is <see langword="null"/>.</exception>
2731
/// <exception cref="ArgumentException">Thrown when <paramref name="name"/> is <see langword="null"/>, empty of only white space.</exception>
28-
public static void CreateCollections(this StringBuilder stringBuilder, string name, string displayName = null, Color color = null, int? order = null)
32+
public static void CreateCollections(this StringBuilder stringBuilder, string name, string displayName = null, Color color = null, int? order = null, string stereotype = default, CustomSpot customSpot = default)
2933
{
30-
stringBuilder.CreateParticipantBase(new ParticipantName(name, displayName), ParticipantType.Collections, color, order);
34+
stringBuilder.CreateParticipantBase(new ParticipantName(name, displayName), ParticipantType.Collections, color, order, stereotype, customSpot);
3135
}
3236
}

0 commit comments

Comments
 (0)