Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ExampleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
Console.WriteLine("Reading a temporal float instant from \"25.0@2024-12-06\"");
Temporal tfi = TFloat.In("25.0@2024-12-06")!;
Console.WriteLine($" class : {tfi.GetType().Name}");
Console.WriteLine($" text : {Meos.TfloatOut(tfi.Ptr, 15)}");
Console.WriteLine($" text : {tfi}");
Console.WriteLine($" start timestamp : {tfi.StartTimestamptz():u}");
Console.WriteLine($" MF-JSON : {tfi.AsMFJSON(false, 0, 6, string.Empty)}");
Console.WriteLine($" always 25.0? : {Meos.AlwaysEqTfloatFloat(tfi.Ptr, 25.0) == 1}\n");

Console.WriteLine("Making one from a value and a moment");
Temporal made = TFloatInst.Make(26.0, DateTime.UtcNow)!;
Console.WriteLine($" text : {Meos.TfloatOut(made.Ptr, 15)}");
Console.WriteLine($" text : {made}");
Console.WriteLine(" adding 34 to its value");
Temporal sum = MEOSFactory.WrapTemporal(Meos.AddTfloatFloat(made.Ptr, 34.0))!;
Console.WriteLine($" text : {Meos.TfloatOut(sum.Ptr, 15)}");
Expand All @@ -29,7 +29,7 @@
Console.WriteLine($" spans : {spanset.NumSpans()}");
foreach (Span? span in spanset.Spanarr())
{
Console.WriteLine($" {((FloatSpan)span!).Out(15)}");
Console.WriteLine($" {span}");
}

Console.WriteLine($" contains 9.0? : {Meos.ContainsSpansetFloat(spanset.Ptr, 9.0)}");
Expand Down
50 changes: 50 additions & 0 deletions MEOS.NET.Tests/TextOutputTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using MEOS.NET.Types;

namespace MEOS.NET.Tests
{
/// <summary>
/// A value prints as the text MEOS writes it as. MEOS publishes that text per
/// concrete type, so a class carries <c>ToString</c> exactly where MEOS
/// publishes an output for its own type.
/// </summary>
[TestClass]
public class TextOutputTests : MeosTest
{
[TestMethod]
public void ATemporalFloatPrintsAsMeosWritesIt()
{
Temporal temp = TFloat.In("[25.5@2024-12-06, 27.5@2024-12-07]")!;

Assert.AreEqual(
"[25.5@2024-12-06 00:00:00+00, 27.5@2024-12-07 00:00:00+00]",
temp.ToString());
}

[TestMethod]
public void ASpanPrintsAsMeosWritesIt()
{
SpanSet spanset = FloatSpanSet.In("{[8, 10], [11, 12]}")!;

Assert.AreEqual("[8, 10]", spanset.StartSpan()!.ToString());
Assert.AreEqual("{[8, 10], [11, 12]}", spanset.ToString());
}

[TestMethod]
public void ABoxPrintsAsMeosWritesIt()
{
STBox box = STBox.In("STBOX X((1,1),(2,2))")!;

Assert.AreEqual("STBOX X((1,1),(2,2))", box.ToString());
}

[TestMethod]
public void TheTextComesFromTheClassOfTheValue()
{
// Wrapping answers the concrete class, so the text is that class's.
Temporal instant = TFloat.In("25.5@2024-12-06")!;

Assert.IsInstanceOfType(instant, typeof(TFloatInst));
Assert.AreEqual("25.5@2024-12-06 00:00:00+00", instant.ToString());
}
}
}
4 changes: 4 additions & 0 deletions MEOS.NET/Types/BigIntSet.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class BigIntSet : Set
{
internal BigIntSet(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out();

public long EndValue()
=> Meos.BigintsetEndValue(this.Ptr);

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/BigIntSpan.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class BigIntSpan : Span
{
internal BigIntSpan(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out();

public Span? Expand(long value)
=> MEOSFactory.WrapSpan(Meos.BigintspanExpand(this.Ptr, value));

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/BigIntSpanSet.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class BigIntSpanSet : SpanSet
{
internal BigIntSpanSet(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out();

public long Lower()
=> Meos.BigintspansetLower(this.Ptr);

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/CbufferSet.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class CbufferSet : Set
{
internal CbufferSet(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out(15);

public string Out(int maxdd)
=> Meos.CbuffersetOut(this.Ptr, maxdd);

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/DateSet.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class DateSet : Set
{
internal DateSet(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out();

public DateOnly EndValue()
=> MEOSConvert.ToDateOnly(Meos.DatesetEndValue(this.Ptr));

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/DateSpan.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class DateSpan : Span
{
internal DateSpan(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out();

public DateOnly Lower()
=> MEOSConvert.ToDateOnly(Meos.DatespanLower(this.Ptr));

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/DateSpanSet.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class DateSpanSet : SpanSet
{
internal DateSpanSet(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out();

public Set? Dates()
=> MEOSFactory.WrapSet(Meos.DatespansetDates(this.Ptr));

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/FloatSet.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class FloatSet : Set
{
internal FloatSet(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out(15);

public Set? Ceil()
=> MEOSFactory.WrapSet(Meos.FloatsetCeil(this.Ptr));

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/FloatSpan.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class FloatSpan : Span
{
internal FloatSpan(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out(15);

public Span? Ceil()
=> MEOSFactory.WrapSpan(Meos.FloatspanCeil(this.Ptr));

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/FloatSpanSet.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class FloatSpanSet : SpanSet
{
internal FloatSpanSet(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out(15);

public SpanSet? Ceil()
=> MEOSFactory.WrapSpanSet(Meos.FloatspansetCeil(this.Ptr));

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/IntSet.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class IntSet : Set
{
internal IntSet(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out();

public int EndValue()
=> Meos.IntsetEndValue(this.Ptr);

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/IntSpan.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class IntSpan : Span
{
internal IntSpan(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out();

public Span? Expand(int value)
=> MEOSFactory.WrapSpan(Meos.IntspanExpand(this.Ptr, value));

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/IntSpanSet.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class IntSpanSet : SpanSet
{
internal IntSpanSet(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out();

public int Lower()
=> Meos.IntspansetLower(this.Ptr);

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/NpointSet.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class NpointSet : Set
{
internal NpointSet(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out(15);

public string Out(int maxdd)
=> Meos.NpointsetOut(this.Ptr, maxdd);

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/PoseSet.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class PoseSet : Set
{
internal PoseSet(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out(15);

public string Out(int maxdd)
=> Meos.PosesetOut(this.Ptr, maxdd);

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/STBox.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class STBox : Box
{
internal STBox(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out(15);

public double Area(bool spheroid)
=> Meos.StboxArea(this.Ptr, spheroid);

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/TBigint.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class TBigint : TNumber
{
internal TBigint(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out();

public long EndValue()
=> Meos.TbigintEndValue(this.Ptr);

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/TBool.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class TBool : TAlpha
{
internal TBool(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out();

public Temporal? AtValue(bool b)
=> MEOSFactory.WrapTemporal(Meos.TboolAtValue(this.Ptr, b));

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/TBox.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class TBox : Box
{
internal TBox(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out(15);

public int Cmp(TBox box2)
=> Meos.TboxCmp(this.Ptr, box2.Ptr);

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/TFloat.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class TFloat : TNumber
{
internal TFloat(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out(15);

public Temporal? AtValue(double d)
=> MEOSFactory.WrapTemporal(Meos.TfloatAtValue(this.Ptr, d));

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/TInt.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class TInt : TNumber
{
internal TInt(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out();

public Temporal? AtValue(int i)
=> MEOSFactory.WrapTemporal(Meos.TintAtValue(this.Ptr, i));

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/TJsonb.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class TJsonb : TAlpha
{
internal TJsonb(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out();

public Temporal? ArrayLength()
=> MEOSFactory.WrapTemporal(Meos.TjsonbArrayLength(this.Ptr));

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/TNpoint.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class TNpoint : TSpatial
{
internal TNpoint(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out(15);

public Temporal? AtNpointset(Set s)
=> MEOSFactory.WrapTemporal(Meos.TnpointAtNpointset(this.Ptr, s.Ptr));

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/TRGeometry.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class TRGeometry : TSpatial
{
internal TRGeometry(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out();

public new Temporal? AfterTimestamptz(DateTime t, bool strict)
=> MEOSFactory.WrapTemporal(Meos.TrgeometryAfterTimestamptz(this.Ptr, MEOSConvert.ToTimestampTz(t), strict));

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/TSpatial.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class TSpatial : Temporal
{
internal TSpatial(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out(15);

public string AsEWKT(int maxdd)
=> Meos.TspatialAsEwkt(this.Ptr, maxdd);

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/TText.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class TText : TAlpha
{
internal TText(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out();

public Temporal? Initcap()
=> MEOSFactory.WrapTemporal(Meos.TtextInitcap(this.Ptr));

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/TextSet.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class TextSet : Set
{
internal TextSet(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out();

public Set? Initcap()
=> MEOSFactory.WrapSet(Meos.TextsetInitcap(this.Ptr));

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/TsTzSet.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class TsTzSet : Set
{
internal TsTzSet(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out();

public DateTime EndValue()
=> MEOSConvert.ToDateTime(Meos.TstzsetEndValue(this.Ptr));

Expand Down
4 changes: 4 additions & 0 deletions MEOS.NET/Types/TsTzSpan.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ public class TsTzSpan : Span
{
internal TsTzSpan(IntPtr ptr) : base(ptr) { }

/// <summary>The text MEOS writes this value as.</summary>
public override string ToString()
=> this.Out();

public DateTime Lower()
=> MEOSConvert.ToDateTime(Meos.TstzspanLower(this.Ptr));

Expand Down
Loading
Loading