using System;
using System.Collections.Generic;
namespace CapnpC.CSharp.Generator
{
///
/// Represents a .capnp -> code generator result
///
public class GenerationResult
{
///
/// Constructs an instance in case of at least partially successful generation.
///
/// Generation result per file to generate
public GenerationResult(IReadOnlyList generatedFiles)
{
GeneratedFiles = generatedFiles;
}
///
/// Constructs an instance in case of total failure.
///
/// Exception with details on error
public GenerationResult(Exception exception)
{
Exception = exception;
}
///
/// Generation result per file to generate or null in case of total failure
///
public IReadOnlyList GeneratedFiles { get; }
///
/// Exception with details on error or null in case of success
///
public Exception Exception { get; }
///
/// true iff generation was successful
///
public bool IsSuccess => GeneratedFiles != null;
}
}