Skip to content

Commit

Permalink
task: removed unnecessary info props/interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
dtanglr committed Jul 10, 2024
1 parent 60faba8 commit 27b1308
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 62 deletions.
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<PackageOutputPath>$(MSBuildThisFileDirectory)..\artifacts</PackageOutputPath>
<version>1.5.0-alpha.36</version>
<version>1.5.0-alpha.37</version>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 0 additions & 6 deletions src/Primitively.Abstractions/IPrimitiveInfo.cs

This file was deleted.

6 changes: 0 additions & 6 deletions src/Primitively.Abstractions/IPrimitiveInfo`1.cs

This file was deleted.

10 changes: 1 addition & 9 deletions src/Primitively/EmbeddedResources/DateOnly/Base.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
readonly partial record struct PRIMITIVE_TYPE :
global::Primitively.IDateOnly,
global::Primitively.IPrimitiveInfo<global::PRIMITIVE_INFO_TYPE>,
global::System.IEquatable<PRIMITIVE_TYPE>,
global::System.IComparable<PRIMITIVE_TYPE>PRIMITIVE_IVALIDATABLEOBJECT
{
public const string Example = "PRIMITIVE_EXAMPLE";
public const string Format = "PRIMITIVE_FORMAT";
public const int Length = PRIMITIVE_LENGTH;

private static readonly global::PRIMITIVE_INFO_TYPE _info = new
public static readonly global::PRIMITIVE_INFO_TYPE Info = new
(
Type: typeof(PRIMITIVE_TYPE),
Example: Example,
Expand Down Expand Up @@ -42,17 +41,12 @@ private PRIMITIVE_TYPE(string value)

global::System.DateTime global::Primitively.IPrimitive<global::System.DateTime>.Value => _value;

global::Primitively.PrimitiveInfo global::Primitively.IPrimitiveInfo.Info => _info;

[global::System.Text.Json.Serialization.JsonIgnore]
public global::Primitively.DataType DataType => global::Primitively.DataType.PRIMITIVE_DATA_TYPE;

[global::System.Text.Json.Serialization.JsonIgnore]
public bool HasValue => _value != default;

[global::System.Text.Json.Serialization.JsonIgnore]
public global::PRIMITIVE_INFO_TYPE Info => _info;

[global::System.Text.Json.Serialization.JsonIgnore]
public global::System.Type ValueType => typeof(global::System.DateTime);

Expand All @@ -70,7 +64,5 @@ private PRIMITIVE_TYPE(string value)
public static explicit operator PRIMITIVE_TYPE(global::System.DateTime value) => new(value);
public static explicit operator PRIMITIVE_TYPE(string value) => new(value);

public static global::PRIMITIVE_INFO_TYPE TypeInfo => _info;

public static PRIMITIVE_TYPE Parse(string value) => new(value);
public static bool TryParse(string value, out PRIMITIVE_TYPE result) => (result = new(value)).HasValue;
13 changes: 2 additions & 11 deletions src/Primitively/EmbeddedResources/Guid/Base.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
readonly partial record struct PRIMITIVE_TYPE :
global::Primitively.IGuid,
global::Primitively.IPrimitiveInfo<global::PRIMITIVE_INFO_TYPE>,
global::System.IEquatable<PRIMITIVE_TYPE>,
global::System.IComparable<PRIMITIVE_TYPE>PRIMITIVE_IVALIDATABLEOBJECT
{
public const string Example = "PRIMITIVE_EXAMPLE";
public const string Format = "PRIMITIVE_FORMAT"; // "N", "D", "B", "P", or "X"
public const int Length = PRIMITIVE_LENGTH;

private static readonly global::PRIMITIVE_INFO_TYPE _info = new
public static readonly PRIMITIVE_TYPE Empty = new PRIMITIVE_TYPE(global::System.Guid.Empty);
public static readonly global::PRIMITIVE_INFO_TYPE Info = new
(
Type: typeof(PRIMITIVE_TYPE),
Example: Example,
Expand All @@ -35,17 +35,12 @@ private PRIMITIVE_TYPE(string value)

global::System.Guid global::Primitively.IPrimitive<global::System.Guid>.Value => _value;

global::Primitively.PrimitiveInfo global::Primitively.IPrimitiveInfo.Info => _info;

[global::System.Text.Json.Serialization.JsonIgnore]
public global::Primitively.DataType DataType => global::Primitively.DataType.PRIMITIVE_DATA_TYPE;

[global::System.Text.Json.Serialization.JsonIgnore]
public bool HasValue => _value != default;

[global::System.Text.Json.Serialization.JsonIgnore]
public global::PRIMITIVE_INFO_TYPE Info => _info;

[global::System.Text.Json.Serialization.JsonIgnore]
public global::System.Type ValueType => typeof(global::System.Guid);

Expand All @@ -59,10 +54,6 @@ private PRIMITIVE_TYPE(string value)
public static explicit operator PRIMITIVE_TYPE(global::System.Guid value) => new(value);
public static explicit operator PRIMITIVE_TYPE(string value) => new(value);

public static global::PRIMITIVE_INFO_TYPE TypeInfo => _info;

public static PRIMITIVE_TYPE New() => new PRIMITIVE_TYPE(global::System.Guid.NewGuid());
public static readonly PRIMITIVE_TYPE Empty = new PRIMITIVE_TYPE(global::System.Guid.Empty);

public static PRIMITIVE_TYPE Parse(string value) => new(value);
public static bool TryParse(string value, out PRIMITIVE_TYPE result) => (result = new(value)).HasValue;
10 changes: 1 addition & 9 deletions src/Primitively/EmbeddedResources/Numeric/FloatingPoint/Base.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
readonly partial record struct PRIMITIVE_TYPE :
global::PRIMITIVE_INTERFACE,
global::Primitively.IPrimitiveInfo<global::PRIMITIVE_INFO_TYPE>,
global::System.IEquatable<PRIMITIVE_TYPE>,
global::System.IComparable<PRIMITIVE_TYPE>PRIMITIVE_IVALIDATABLEOBJECT
{
Expand All @@ -10,7 +9,7 @@
public const global::PRIMITIVE_VALUE_TYPE Minimum = PRIMITIVE_MINIMUM;
public const global::System.MidpointRounding Mode = global::System.MidpointRounding.PRIMITIVE_MIDPOINTROUNDINGMODE;

private static readonly global::PRIMITIVE_INFO_TYPE _info = new
public static readonly global::PRIMITIVE_INFO_TYPE Info = new
(
Type: typeof(PRIMITIVE_TYPE),
Example: Example,
Expand Down Expand Up @@ -49,17 +48,12 @@ private PRIMITIVE_TYPE(string value)

global::PRIMITIVE_VALUE_TYPE global::Primitively.IPrimitive<global::PRIMITIVE_VALUE_TYPE>.Value => _value;

global::Primitively.PrimitiveInfo global::Primitively.IPrimitiveInfo.Info => _info;

[global::System.Text.Json.Serialization.JsonIgnore]
public global::Primitively.DataType DataType => global::Primitively.DataType.PRIMITIVE_DATA_TYPE;

[global::System.Text.Json.Serialization.JsonIgnore]
public bool HasValue { get; } = false;

[global::System.Text.Json.Serialization.JsonIgnore]
public global::PRIMITIVE_INFO_TYPE Info => _info;

[global::System.Text.Json.Serialization.JsonIgnore]
public global::System.Type ValueType => typeof(global::PRIMITIVE_VALUE_TYPE);

Expand All @@ -68,8 +62,6 @@ private PRIMITIVE_TYPE(string value)
public override int GetHashCode() => _value.GetHashCode();
public override string ToString() => _value.ToString();

public static global::PRIMITIVE_INFO_TYPE TypeInfo => _info;

public static implicit operator string(PRIMITIVE_TYPE value) => value.ToString();
public static implicit operator global::PRIMITIVE_VALUE_TYPE(PRIMITIVE_TYPE value) => value._value;
public static explicit operator PRIMITIVE_TYPE(global::PRIMITIVE_VALUE_TYPE value) => new(value);
Expand Down
10 changes: 1 addition & 9 deletions src/Primitively/EmbeddedResources/Numeric/Integer/Base.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
readonly partial record struct PRIMITIVE_TYPE :
global::PRIMITIVE_INTERFACE,
global::Primitively.IPrimitiveInfo<global::PRIMITIVE_INFO_TYPE>,
global::System.IEquatable<PRIMITIVE_TYPE>,
global::System.IComparable<PRIMITIVE_TYPE>PRIMITIVE_IVALIDATABLEOBJECT
{
public const string Example = "PRIMITIVE_EXAMPLE";
public const global::PRIMITIVE_VALUE_TYPE Maximum = PRIMITIVE_MAXIMUM;
public const global::PRIMITIVE_VALUE_TYPE Minimum = PRIMITIVE_MINIMUM;

private static readonly global::PRIMITIVE_INFO_TYPE _info = new
public static readonly global::PRIMITIVE_INFO_TYPE Info = new
(
Type: typeof(PRIMITIVE_TYPE),
Example: Example,
Expand Down Expand Up @@ -40,17 +39,12 @@ private PRIMITIVE_TYPE(string value)

global::PRIMITIVE_VALUE_TYPE global::Primitively.IPrimitive<global::PRIMITIVE_VALUE_TYPE>.Value => _value;

global::Primitively.PrimitiveInfo global::Primitively.IPrimitiveInfo.Info => _info;

[global::System.Text.Json.Serialization.JsonIgnore]
public global::Primitively.DataType DataType => global::Primitively.DataType.PRIMITIVE_DATA_TYPE;

[global::System.Text.Json.Serialization.JsonIgnore]
public bool HasValue { get; } = false;

[global::System.Text.Json.Serialization.JsonIgnore]
public global::PRIMITIVE_INFO_TYPE Info => _info;

[global::System.Text.Json.Serialization.JsonIgnore]
public global::System.Type ValueType => typeof(global::PRIMITIVE_VALUE_TYPE);

Expand All @@ -59,8 +53,6 @@ private PRIMITIVE_TYPE(string value)
public override int GetHashCode() => _value.GetHashCode();
public override string ToString() => _value.ToString();

public static global::PRIMITIVE_INFO_TYPE TypeInfo => _info;

public static implicit operator string(PRIMITIVE_TYPE value) => value.ToString();
public static implicit operator global::PRIMITIVE_VALUE_TYPE(PRIMITIVE_TYPE value) => value._value;
public static explicit operator PRIMITIVE_TYPE(global::PRIMITIVE_VALUE_TYPE value) => new(value);
Expand Down
12 changes: 2 additions & 10 deletions src/Primitively/EmbeddedResources/String/Base.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
readonly partial record struct PRIMITIVE_TYPE :
global::Primitively.IString,
global::Primitively.IPrimitiveInfo<global::PRIMITIVE_INFO_TYPE>,
global::System.IEquatable<PRIMITIVE_TYPE>,
global::System.IComparable<PRIMITIVE_TYPE>PRIMITIVE_IVALIDATABLEOBJECT
{
Expand All @@ -10,7 +9,7 @@
public const string Format = @"PRIMITIVE_FORMAT";
public const string Pattern = @"PRIMITIVE_PATTERN";

private static readonly global::PRIMITIVE_INFO_TYPE _info = new
public static readonly global::PRIMITIVE_INFO_TYPE Info = new
(
Type: typeof(PRIMITIVE_TYPE),
Example: Example,
Expand Down Expand Up @@ -43,17 +42,12 @@ public PRIMITIVE_TYPE(string value)

string global::Primitively.IPrimitive<string>.Value => _value;

global::Primitively.PrimitiveInfo global::Primitively.IPrimitiveInfo.Info => _info;

[global::System.Text.Json.Serialization.JsonIgnore]
public global::Primitively.DataType DataType => global::Primitively.DataType.PRIMITIVE_DATA_TYPE;

[global::System.Text.Json.Serialization.JsonIgnore]
public bool HasValue => _value != default;

[global::System.Text.Json.Serialization.JsonIgnore]
public global::PRIMITIVE_INFO_TYPE Info => _info;

[global::System.Text.Json.Serialization.JsonIgnore]
public global::System.Type ValueType => typeof(string);

Expand All @@ -65,12 +59,10 @@ public PRIMITIVE_TYPE(string value)
public static implicit operator string(PRIMITIVE_TYPE value) => value.ToString();
public static explicit operator PRIMITIVE_TYPE(string value) => new(value);

public static global::PRIMITIVE_INFO_TYPE TypeInfo => _info;

public static PRIMITIVE_TYPE Parse(string value) => new(value);
public static bool TryParse(string value, out PRIMITIVE_TYPE result) => (result = new(value)).HasValue;

static bool IsMatch(string value) =>
private static bool IsMatch(string value) =>
!string.IsNullOrWhiteSpace(value) &&
!(value.Length < MinLength) &&
!(value.Length > MaxLength) &&
Expand Down
2 changes: 1 addition & 1 deletion src/Primitively/Structs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ private static void GenerateRepositoryFile(SourceProductionContext context, List
var items = recordStructs
.Where(rs => rs.DataType == dataType)
.OrderBy(rs => rs.Name)
.Select(rs => $"{Padding}yield return {rs.NameSpace}.{rs.Name}.TypeInfo;");
.Select(rs => $"{Padding}yield return {rs.NameSpace}.{rs.Name}.Info;");

yieldStatements.Add($"{Padding}// {dataType}");
yieldStatements.AddRange(items);
Expand Down

0 comments on commit 27b1308

Please sign in to comment.