// // IParameterGenerator.cs // // Copyright (c) František Boháček. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. using System.CodeDom.Compiler; using Microsoft.CodeAnalysis.CSharp.Syntax; using NosSmooth.PacketSerializersGenerator.Data; using NosSmooth.PacketSerializersGenerator.Errors; namespace NosSmooth.PacketSerializersGenerator.AttributeGenerators { /// /// Generate serializer and deserializer method parts for the given constructor parameter. /// public interface IParameterGenerator { /// /// Check whether this generator should handle parameter with this attribute. /// /// The parameter. /// Whether to handle this parameter. public bool ShouldHandle(ParameterInfo parameter); /// /// Checks the given parameter, returns an error if the parameter cannot be processed. /// /// The packet. /// The parameter. /// An error, if any. public IError? CheckParameter(PacketInfo packet, ParameterInfo parameter); /// /// Generate part for the Serializer method to serialize the given parameter. /// /// The text writer to write the code to. /// The packet info to generate for. /// The generated source code. public IError? GenerateSerializerPart(IndentedTextWriter textWriter, PacketInfo packetInfo); /// /// Generate part for the Deserializer method to deserialize the given parameter. /// /// The text writer to write the code to. /// The packet info to generate for. /// The generated source code. public IError? GenerateDeserializerPart(IndentedTextWriter textWriter, PacketInfo packetInfo); } }