//
// IInlineConverterGenerator.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;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using NosSmooth.PacketSerializersGenerator.Data;
using NosSmooth.PacketSerializersGenerator.Errors;
namespace NosSmooth.PacketSerializersGenerator.InlineConverterGenerators;
///
/// Generates inline type converters.
///
public interface IInlineConverterGenerator
{
///
/// Whether the given parameter should be handled by this.
///
/// The type syntax.
/// The type symbol.
/// Whether to handle.
public bool ShouldHandle(TypeSyntax? typeSyntax, ITypeSymbol? typeSymbol);
///
/// Generate the serializer part.
///
/// The text writer to write to.
/// The name of the variable.
/// The type syntax.
/// The type symbol.
/// An error, if any.
public IError? GenerateSerializerPart(IndentedTextWriter textWriter, string variableName, TypeSyntax? typeSyntax, ITypeSymbol? typeSymbol);
///
/// Generate the deserializer part.
///
/// The text writer to write to.
/// The type syntax.
/// The type symbol.
/// Whether the parameter is nullable.
/// An error, if any.
public IError? CallDeserialize(IndentedTextWriter textWriter, TypeSyntax? typeSyntax, ITypeSymbol? typeSymbol, bool nullable);
///
/// Generate helper methods to HelperClass.
///
///
/// These will be added to class .
/// This will be called after calling and
/// for all packets and parameters.
/// The converter can group information it needs for the generations that way.
///
/// The text writer to append full methods to.
public void GenerateHelperMethods(IndentedTextWriter textWriter);
}