mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-09-22 23:05:12 +00:00
Unify type parameter naming
This commit is contained in:
23
README.MD
23
README.MD
@@ -84,23 +84,24 @@ Below is a table representing the various conversion interfaces that are impleme
|
||||
|
||||
| Interface Name | Source Type | Destination Type |
|
||||
| --- | --- | --- |
|
||||
| `SabreTools.Serialization.Interfaces.IByteReader` | `byte[]?` | Model |
|
||||
| `SabreTools.Serialization.Interfaces.IByteWriter` | Model | `byte[]?` |
|
||||
| `SabreTools.Serialization.Interfaces.IFileReader` | `string?` path | Model |
|
||||
| `SabreTools.Serialization.Interfaces.IFileWriter` | Model | `string?` path |
|
||||
| `SabreTools.Serialization.Interfaces.IModelSerializer` | Model | Model |
|
||||
| `SabreTools.Serialization.Interfaces.IStreamReader` | `Stream?` | Model |
|
||||
| `SabreTools.Serialization.Interfaces.IStreamWriter` | Model | `Stream?` |
|
||||
| `SabreTools.Serialization.Interfaces.IStringReader` | `string?` representation | Model |
|
||||
| `SabreTools.Serialization.Interfaces.IStringWriter` | Model | `string?` representation |
|
||||
| `SabreTools.Serialization.Interfaces.IByteReader<TModel>` | `byte[]?` | `TModel` |
|
||||
| `SabreTools.Serialization.Interfaces.IByteWriter<TModel>` | `TModel` | `byte[]?` |
|
||||
| `SabreTools.Serialization.Interfaces.IFileReader<TModel>` | `string?` path | `TModel` |
|
||||
| `SabreTools.Serialization.Interfaces.IFileWriter<TModel>` | `TModel` | `string?` path |
|
||||
| `SabreTools.Serialization.Interfaces.IModelSerializer<TSource, TDest>` | `TSource`/`TDest` | `TDest`/`TSource` |
|
||||
| `SabreTools.Serialization.Interfaces.IStreamReader<TModel>` | `Stream?` | `TModel` |
|
||||
| `SabreTools.Serialization.Interfaces.IStreamWriter<TModel>` | `TModel` | `Stream?` |
|
||||
| `SabreTools.Serialization.Interfaces.IStringReader<TModel>` | `string?` representation | `TModel` |
|
||||
| `SabreTools.Serialization.Interfaces.IStringWriter<TModel>` | `TModel` | `string?` representation |
|
||||
|
||||
Below is a table representing the various non-conversion interfaces that are implemented within this library.
|
||||
|
||||
| Interface Name | Purpose |
|
||||
| --- | --- |
|
||||
| `SabreTools.Data.Printers.IPrinter` | Provides a formatted output for a model |
|
||||
| `SabreTools.Data.Printers.IPrinter<TModel>` | Provides a formatted output for a `TModel` |
|
||||
| `SabreTools.Serialization.Wrappers.IExtractable` | Marks a wrapper as able to be extracted |
|
||||
| `SabreTools.Serialization.Wrappers.IWrapper` / `SabreTools.Serialization.Wrappers.IWrapper<T>` | Wraps a model or set of models to provide additional functionality |
|
||||
| `SabreTools.Serialization.Wrappers.IWrapper` | Represents an item with a description and JSON serializable state, allowing for extensions |
|
||||
| `SabreTools.Serialization.Wrappers.IWrapper<TModel>` | Wraps a model with source data, allowing for extensions |
|
||||
|
||||
## Namespaces
|
||||
|
||||
|
||||
@@ -3,15 +3,15 @@ namespace SabreTools.Serialization.Interfaces
|
||||
/// <summary>
|
||||
/// Defines how to read from byte arrays
|
||||
/// </summary>
|
||||
public interface IByteReader<T>
|
||||
public interface IByteReader<TModel>
|
||||
{
|
||||
/// <summary>
|
||||
/// Deserialize a byte array into <typeparamref name="T"/>
|
||||
/// Deserialize a byte array into <typeparamref name="TModel"/>
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object to deserialize to</typeparam>
|
||||
/// <param name="data">Byte array to parse</param>
|
||||
/// <param name="offset">Offset into the byte array</param>
|
||||
/// <returns>Filled object on success, null on error</returns>
|
||||
T? Deserialize(byte[]? data, int offset);
|
||||
TModel? Deserialize(byte[]? data, int offset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ namespace SabreTools.Serialization.Interfaces
|
||||
/// <summary>
|
||||
/// Defines how to write to byte arrays
|
||||
/// </summary>
|
||||
public interface IByteWriter<T>
|
||||
public interface IByteWriter<TModel>
|
||||
{
|
||||
/// <summary>
|
||||
/// Serialize a <typeparamref name="T"/> into a byte array
|
||||
/// Serialize a <typeparamref name="TModel"/> into a byte array
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object to serialize from</typeparam>
|
||||
/// <param name="obj">Data to serialize</param>
|
||||
/// <returns>Filled object on success, null on error</returns>
|
||||
byte[]? SerializeArray(T? obj);
|
||||
byte[]? SerializeArray(TModel? obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ namespace SabreTools.Serialization.Interfaces
|
||||
/// <summary>
|
||||
/// Defines how to read from files
|
||||
/// </summary>
|
||||
public interface IFileReader<T>
|
||||
public interface IFileReader<TModel>
|
||||
{
|
||||
/// <summary>
|
||||
/// Deserialize a file into <typeparamref name="T"/>
|
||||
/// Deserialize a file into <typeparamref name="TModel"/>
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object to deserialize to</typeparam>
|
||||
/// <param name="path">Path to deserialize from</param>
|
||||
/// <returns>Filled object on success, null on error</returns>
|
||||
T? Deserialize(string? path);
|
||||
TModel? Deserialize(string? path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,15 +3,15 @@ namespace SabreTools.Serialization.Interfaces
|
||||
/// <summary>
|
||||
/// Defines how to write to files
|
||||
/// </summary>
|
||||
public interface IFileWriter<T>
|
||||
public interface IFileWriter<TModel>
|
||||
{
|
||||
/// <summary>
|
||||
/// Serialize a <typeparamref name="T"/> into a file
|
||||
/// Serialize a <typeparamref name="TModel"/> into a file
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object to serialize from</typeparam>
|
||||
/// <param name="obj">Data to serialize</param>
|
||||
/// <param name="path">Path to the file to serialize to</param>
|
||||
/// <returns>True on successful serialization, false otherwise</returns>
|
||||
bool SerializeFile(T? obj, string? path);
|
||||
bool SerializeFile(TModel? obj, string? path);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,24 +3,24 @@ namespace SabreTools.Serialization.Interfaces
|
||||
/// <summary>
|
||||
/// Defines how to serialize to and from models
|
||||
/// </summary>
|
||||
public interface IModelSerializer<T, U>
|
||||
public interface IModelSerializer<TSource, TDest>
|
||||
{
|
||||
/// <summary>
|
||||
/// Deserialize a <typeparamref name="U"/> into <typeparamref name="T"/>
|
||||
/// Deserialize a <typeparamref name="TDest"/> into <typeparamref name="TSource"/>
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object to deserialize to</typeparam>
|
||||
/// <typeparam name="U">Type of object to deserialize from</typeparam>
|
||||
/// <param name="obj">Object to deserialize from</param>
|
||||
/// <returns>Filled object on success, null on error</returns>
|
||||
T? Deserialize(U? obj);
|
||||
TSource? Deserialize(TDest? obj);
|
||||
|
||||
/// <summary>
|
||||
/// Serialize a <typeparamref name="T"/> into <typeparamref name="U"/>
|
||||
/// Serialize a <typeparamref name="TSource"/> into <typeparamref name="TDest"/>
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object to serialize from</typeparam>
|
||||
/// <typeparam name="U">Type of object to serialize to</typeparam>
|
||||
/// <param name="obj">Object to serialize from</param>
|
||||
/// <returns>Filled object on success, null on error</returns>
|
||||
U? Serialize(T? obj);
|
||||
TDest? Serialize(TSource? obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ namespace SabreTools.Serialization.Interfaces
|
||||
/// <summary>
|
||||
/// Defines how to read from Streams
|
||||
/// </summary>
|
||||
public interface IStreamReader<T>
|
||||
public interface IStreamReader<TModel>
|
||||
{
|
||||
/// <summary>
|
||||
/// Deserialize a Stream into <typeparamref name="T"/>
|
||||
/// Deserialize a Stream into <typeparamref name="TModel"/>
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object to deserialize to</typeparam>
|
||||
/// <param name="data">Stream to parse</param>
|
||||
/// <returns>Filled object on success, null on error</returns>
|
||||
T? Deserialize(System.IO.Stream? data);
|
||||
TModel? Deserialize(System.IO.Stream? data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ namespace SabreTools.Serialization.Interfaces
|
||||
/// <summary>
|
||||
/// Defines how to write to Streams
|
||||
/// </summary>
|
||||
public interface IStreamWriter<T>
|
||||
public interface IStreamWriter<TModel>
|
||||
{
|
||||
/// <summary>
|
||||
/// Serialize a <typeparamref name="T"/> into a Stream
|
||||
/// Serialize a <typeparamref name="TModel"/> into a Stream
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object to serialize from</typeparam>
|
||||
/// <param name="obj">Data to serialize</param>
|
||||
/// <returns>Filled object on success, null on error</returns>
|
||||
System.IO.Stream? SerializeStream(T? obj);
|
||||
System.IO.Stream? SerializeStream(TModel? obj);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ namespace SabreTools.Serialization.Interfaces
|
||||
/// <summary>
|
||||
/// Defines how to read from strings
|
||||
/// </summary>
|
||||
public interface IStringReader<T>
|
||||
public interface IStringReader<TModel>
|
||||
{
|
||||
/// <summary>
|
||||
/// Deserialize a string into <typeparamref name="T"/>
|
||||
/// Deserialize a string into <typeparamref name="TModel"/>
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object to deserialize to</typeparam>
|
||||
/// <param name="str">String to deserialize from</param>
|
||||
/// <returns>Filled object on success, null on error</returns>
|
||||
T? Deserialize(string? str);
|
||||
TModel? Deserialize(string? str);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ namespace SabreTools.Serialization.Interfaces
|
||||
/// <summary>
|
||||
/// Defines how to write to strings
|
||||
/// </summary>
|
||||
public interface IStringWriter<T>
|
||||
public interface IStringWriter<TModel>
|
||||
{
|
||||
/// <summary>
|
||||
/// Serialize a <typeparamref name="T"/> into a string
|
||||
/// Serialize a <typeparamref name="TModel"/> into a string
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Type of object to serialize from</typeparam>
|
||||
/// <param name="obj">Data to serialize</param>
|
||||
/// <returns>Filled string on successful serialization, null otherwise</returns>
|
||||
string? Serialize(T? obj);
|
||||
string? Serialize(TModel? obj);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user