-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
93 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,62 @@ | ||
namespace Primitively; | ||
|
||
/// <summary> | ||
/// Data types supported by Primitively types | ||
/// </summary> | ||
public enum DataType | ||
{ | ||
/// <summary> | ||
/// Represents a Primitively type that encapsulates a <see cref="Byte"/> value | ||
/// </summary> | ||
Byte, | ||
|
||
/// <summary> | ||
/// Represents a Primitively type that encapsulates a <see cref="DateOnly"/> value | ||
/// </summary> | ||
DateOnly, | ||
|
||
/// <summary> | ||
/// Represents a Primitively type that encapsulates a <see cref="Guid"/> value | ||
/// </summary> | ||
Guid, | ||
|
||
/// <summary> | ||
/// Represents a Primitively type that encapsulates a <see cref="Int"/> value | ||
/// </summary> | ||
Int, | ||
|
||
/// <summary> | ||
/// Represents a Primitively type that encapsulates a <see cref="Long"/> value | ||
/// </summary> | ||
Long, | ||
|
||
/// <summary> | ||
/// Represents a Primitively type that encapsulates a <see cref="SByte"/> value | ||
/// </summary> | ||
SByte, | ||
|
||
/// <summary> | ||
/// Represents a Primitively type that encapsulates a <see cref="Short"/> value | ||
/// </summary> | ||
Short, | ||
|
||
/// <summary> | ||
/// Represents a Primitively type that encapsulates a <see cref="String"/> value | ||
/// </summary> | ||
String, | ||
|
||
/// <summary> | ||
/// Represents a Primitively type that encapsulates a <see cref="UInt"/> value | ||
/// </summary> | ||
UInt, | ||
|
||
/// <summary> | ||
/// Represents a Primitively type that encapsulates a <see cref="ULong"/> value | ||
/// </summary> | ||
ULong, | ||
|
||
/// <summary> | ||
/// Represents a Primitively type that encapsulates a <see cref="UShort"/> value | ||
/// </summary> | ||
UShort | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,33 @@ | ||
namespace Primitively; | ||
|
||
/// <summary> | ||
/// The interface that all source generated Primitively types implement. | ||
/// </summary> | ||
public interface IPrimitive | ||
{ | ||
/// <summary> | ||
/// Flag indicating the instance has a valid value. | ||
/// </summary> | ||
/// <remarks> | ||
/// Attempts to instantiate a Primitively type with an invalid value will result in a default instance with no value. | ||
/// </remarks> | ||
public bool HasValue { get; } | ||
|
||
/// <summary> | ||
/// The .net type of the value that the instance encapsulates. | ||
/// </summary> | ||
public Type ValueType { get; } | ||
|
||
/// <summary> | ||
/// The <see cref="DataType"/> enum representation of type that the instance encapsulates. | ||
/// </summary> | ||
public DataType DataType { get; } | ||
|
||
/// <summary> | ||
/// The value encapsulated by this instance | ||
/// </summary> | ||
/// <remarks> | ||
/// Attempts to instantiate a Primitively type with an invalid value will result in a default instance with no value. | ||
/// </remarks> | ||
public object Value { get; } | ||
} | ||
|
||
public interface IPrimitive<out T> : IPrimitive | ||
{ | ||
public new T Value { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace Primitively; | ||
|
||
/// <summary> | ||
/// The generic interface that all source generated Primitively types implement | ||
/// </summary> | ||
/// <typeparam name="T">The .net type of the encapsulated value</typeparam> | ||
public interface IPrimitive<out T> : IPrimitive | ||
{ | ||
/// <summary> | ||
/// The value of the Primitively type | ||
/// </summary> | ||
public new T Value { get; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters