From 003ad31ed5275fd3654c5726c44220a04ffe4fe1 Mon Sep 17 00:00:00 2001 From: Joshua Quinones Date: Sun, 10 Apr 2022 22:26:17 -0400 Subject: Added documentation comments to the .NET library Comments have been added for the following: modules/mono/glue/GodotSharp/GodotSharp/Core/GodotTaskScheduler.cs modules/mono/glue/GodotSharp/GodotSharp/Core/GodotSynchronizationContext.cs modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/AssemblyHasScriptsAttribute.cs modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/DisableGodotGeneratorsAttribute.cs modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ExportAttribute.cs modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/GodotMethodAttribute.cs modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ScriptPathAttribute.cs --- .../Core/Attributes/AssemblyHasScriptsAttribute.cs | 10 ++++++++++ .../Attributes/DisableGodotGeneratorsAttribute.cs | 3 +++ .../GodotSharp/Core/Attributes/ExportAttribute.cs | 8 ++++++++ .../Core/Attributes/GodotMethodAttribute.cs | 7 +++++++ .../GodotSharp/Core/Attributes/RPCAttributes.cs | 6 ++++++ .../Core/Attributes/ScriptPathAttribute.cs | 7 +++++++ .../glue/GodotSharp/GodotSharp/Core/Dispatcher.cs | 7 +++++++ .../GodotSharp/Core/GodotSynchronizationContext.cs | 3 +++ .../GodotSharp/Core/GodotTaskScheduler.cs | 21 +++++++++++++++++++++ .../GodotSharp/Core/Interfaces/IAwaitable.cs | 7 +++++++ .../GodotSharp/Core/Interfaces/IAwaiter.cs | 7 +++++++ .../Core/Interfaces/ISerializationListener.cs | 3 +++ 12 files changed, 89 insertions(+) (limited to 'modules/mono') diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/AssemblyHasScriptsAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/AssemblyHasScriptsAttribute.cs index ef135da51a..2febf37f05 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/AssemblyHasScriptsAttribute.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/AssemblyHasScriptsAttribute.cs @@ -2,17 +2,27 @@ using System; namespace Godot { + /// + /// An attribute that determines if an assembly has scripts. If so, what types of scripts the assembly has. + /// [AttributeUsage(AttributeTargets.Assembly)] public class AssemblyHasScriptsAttribute : Attribute { private readonly bool requiresLookup; private readonly System.Type[] scriptTypes; + /// + /// Constructs a new AssemblyHasScriptsAttribute instance. + /// public AssemblyHasScriptsAttribute() { requiresLookup = true; } + /// + /// Constructs a new AssemblyHasScriptsAttribute instance. + /// + /// The specified type(s) of scripts. public AssemblyHasScriptsAttribute(System.Type[] scriptTypes) { requiresLookup = false; diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/DisableGodotGeneratorsAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/DisableGodotGeneratorsAttribute.cs index e93bc89811..0b00878e8c 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/DisableGodotGeneratorsAttribute.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/DisableGodotGeneratorsAttribute.cs @@ -2,6 +2,9 @@ using System; namespace Godot { + /// + /// An attribute that disables Godot Generators. + /// [AttributeUsage(AttributeTargets.Class)] public class DisableGodotGeneratorsAttribute : Attribute { } } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ExportAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ExportAttribute.cs index 6adf044886..46eb128d37 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ExportAttribute.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ExportAttribute.cs @@ -2,12 +2,20 @@ using System; namespace Godot { + /// + /// An attribute used to export objects. + /// [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)] public class ExportAttribute : Attribute { private PropertyHint hint; private string hintString; + /// + /// Constructs a new ExportAttribute Instance. + /// + /// A hint to the exported object. + /// A string representing the exported object. public ExportAttribute(PropertyHint hint = PropertyHint.None, string hintString = "") { this.hint = hint; diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/GodotMethodAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/GodotMethodAttribute.cs index 55848769d5..8d4ff0fdb7 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/GodotMethodAttribute.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/GodotMethodAttribute.cs @@ -2,6 +2,9 @@ using System; namespace Godot { + /// + /// An attribute for a method. + /// [AttributeUsage(AttributeTargets.Method)] internal class GodotMethodAttribute : Attribute { @@ -9,6 +12,10 @@ namespace Godot public string MethodName { get { return methodName; } } + /// + /// Constructs a new GodotMethodAttribute instance. + /// + /// The name of the method. public GodotMethodAttribute(string methodName) { this.methodName = methodName; diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/RPCAttributes.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/RPCAttributes.cs index b8b9bc660c..f0d37c344d 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/RPCAttributes.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/RPCAttributes.cs @@ -2,9 +2,15 @@ using System; namespace Godot { + /// + /// Constructs a new AnyPeerAttribute instance. Members with the AnyPeerAttribute are given authority over their own player. + /// [AttributeUsage(AttributeTargets.Method)] public class AnyPeerAttribute : Attribute { } + /// + /// Constructs a new AuthorityAttribute instance. Members with the AuthorityAttribute are given authority over the game. + /// [AttributeUsage(AttributeTargets.Method)] public class AuthorityAttribute : Attribute { } } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ScriptPathAttribute.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ScriptPathAttribute.cs index 12eb1035c3..3ebb6612de 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ScriptPathAttribute.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Attributes/ScriptPathAttribute.cs @@ -2,11 +2,18 @@ using System; namespace Godot { + /// + /// An attribute that contains the path to the object's script. + /// [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)] public class ScriptPathAttribute : Attribute { private string path; + /// + /// Constructs a new ScriptPathAttribute instance. + /// + /// The file path to the script public ScriptPathAttribute(string path) { this.path = path; diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Dispatcher.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dispatcher.cs index 072e0f20ff..6475237002 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Dispatcher.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Dispatcher.cs @@ -4,9 +4,16 @@ namespace Godot { public static class Dispatcher { + /// + /// Implements an external instance of GodotTaskScheduler. + /// + /// A GodotTaskScheduler instance. [MethodImpl(MethodImplOptions.InternalCall)] private static extern GodotTaskScheduler godot_icall_DefaultGodotTaskScheduler(); + /// + /// Initializes the synchronization context as the context of the GodotTaskScheduler. + /// public static GodotSynchronizationContext SynchronizationContext => godot_icall_DefaultGodotTaskScheduler().Context; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotSynchronizationContext.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotSynchronizationContext.cs index c01c926e82..1b599beab5 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotSynchronizationContext.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotSynchronizationContext.cs @@ -14,6 +14,9 @@ namespace Godot _queue.Add(new KeyValuePair(d, state)); } + /// + /// Calls the Key method on each workItem object in the _queue to activate their callbacks. + /// public void ExecutePendingContinuations() { while (_queue.TryTake(out var workItem)) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotTaskScheduler.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotTaskScheduler.cs index 8eaeea50dc..408bed71b2 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotTaskScheduler.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/GodotTaskScheduler.cs @@ -6,11 +6,25 @@ using System.Threading.Tasks; namespace Godot { + /// + /// GodotTaskScheduler contains a linked list of tasks to perform as a queue. Methods + /// within the class are used to control the queue and perform the contained tasks. + /// public class GodotTaskScheduler : TaskScheduler { + /// + /// The current synchronization context. + /// internal GodotSynchronizationContext Context { get; } + + /// + /// The queue of tasks for the task scheduler. + /// private readonly LinkedList _tasks = new LinkedList(); + /// + /// Constructs a new GodotTaskScheduler instance. + /// public GodotTaskScheduler() { Context = new GodotSynchronizationContext(); @@ -53,12 +67,19 @@ namespace Godot } } + /// + /// Executes all queued tasks and pending tasks from the current context. + /// public void Activate() { ExecuteQueuedTasks(); Context.ExecutePendingContinuations(); } + /// + /// Loops through and attempts to execute each task in _tasks. + /// + /// private void ExecuteQueuedTasks() { while (true) diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/IAwaitable.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/IAwaitable.cs index 0397957d00..e747e03c1e 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/IAwaitable.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/IAwaitable.cs @@ -1,10 +1,17 @@ namespace Godot { + /// + /// An interface that requires a GetAwaiter() method to get a reference to the Awaiter. + /// public interface IAwaitable { IAwaiter GetAwaiter(); } + /// + /// A templated interface that requires a GetAwaiter() method to get a reference to the Awaiter. + /// + /// A reference to the result to be passed out. public interface IAwaitable { IAwaiter GetAwaiter(); diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/IAwaiter.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/IAwaiter.cs index d3be9d781c..dec225eb29 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/IAwaiter.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/IAwaiter.cs @@ -2,6 +2,9 @@ using System.Runtime.CompilerServices; namespace Godot { + /// + /// An interface that requires a boolean for completion status and a method that gets the result of completion. + /// public interface IAwaiter : INotifyCompletion { bool IsCompleted { get; } @@ -9,6 +12,10 @@ namespace Godot void GetResult(); } + /// + /// A templated interface that requires a boolean for completion status and a method that gets the result of completion and returns it. + /// + /// A reference to the result to be passed out. public interface IAwaiter : INotifyCompletion { bool IsCompleted { get; } diff --git a/modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/ISerializationListener.cs b/modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/ISerializationListener.cs index c3fa2f3e82..90b4d1b8d3 100644 --- a/modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/ISerializationListener.cs +++ b/modules/mono/glue/GodotSharp/GodotSharp/Core/Interfaces/ISerializationListener.cs @@ -1,5 +1,8 @@ namespace Godot { + /// + /// An interface that requires methods for before and after serialization. + /// public interface ISerializationListener { void OnBeforeSerialize(); -- cgit v1.2.3