This commit is contained in:
Simon Gruber
2024-01-08 16:21:10 +01:00
parent f3768348e9
commit b17044f959
51 changed files with 263 additions and 274 deletions
@@ -0,0 +1,12 @@
namespace ReportGeneration.Interface;
public interface IBounds
{
public string Unit { get; }
public int? MinWidth { get; }
public int? MinHeight { get; }
public int? MaxWidth { get; }
public int? MaxHeight { get; }
public int? Width { get; }
public int? Height { get; }
}
@@ -0,0 +1,18 @@
using System;
namespace ReportGeneration.Interface;
public interface IDocumentGenerator : IStreamWriter
{
IDocumentGenerator Append(string? text = default);
IDocumentGenerator AppendLine(string? text = default);
IDocumentGenerator AppendParagraph(string? text = default);
IDocumentGenerator AppendHeading(int level, string text);
IDocumentGenerator AppendTable(int columns, Action<ITableGenerator> table);
string FormatImage(string path, IBounds? bounds = default);
}
@@ -0,0 +1,40 @@
using System;
using System.IO;
namespace ReportGeneration.Interface;
public interface IStreamWriter : IDisposable
{
/// <inheritdoc cref="TextWriter.WriteLine(string)"/>
IStreamWriter Write(string? text = default);
/// <inheritdoc cref="TextWriter.WriteLine(string)"/>
IStreamWriter WriteLine(string? text = default);
/// <summary>
/// <para>Writes the contents of the given <paramref name="writer"/>
/// to the internal <see cref="Stream"/></para>
/// </summary>
IStreamWriter Write(IStreamWriter writer);
/// <summary>
/// <para>Writes the contents of the given <paramref name="reader"/>
/// to the internal <see cref="Stream"/></para>
/// </summary>
IStreamWriter Write(StreamReader reader);
/// <summary>
/// Finalizes the content writer
/// </summary>
void Close();
/// <summary>
/// Initializes the content writer
/// </summary>
void Open();
/// <summary>
/// Reads the content of the underlying stream
/// </summary>
StreamReader Read();
}
@@ -0,0 +1,16 @@
using System.Collections.Generic;
namespace ReportGeneration.Interface;
public interface ITableGenerator : IStreamWriter
{
int Columns { get; }
ITableGenerator AppendHeader(string content);
ITableGenerator AppendHeader(IEnumerable<string> row);
ITableGenerator AppendHeader(IEnumerable<IEnumerable<string>> rows);
ITableGenerator AppendRow(string content);
ITableGenerator AppendRow(IEnumerable<string> row);
ITableGenerator AppendRows(IEnumerable<IEnumerable<string>> rows);
}
@@ -0,0 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<IncludeSymbols>True</IncludeSymbols>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
</PropertyGroup>
</Project>