// Copyright 2009-2022 Josh Close
// This file is a part of CsvHelper and is dual licensed under MS-PL and Apache 2.0.
// See LICENSE.txt for details or visit http://www.opensource.org/licenses/ms-pl.html for MS-PL and http://opensource.org/licenses/Apache-2.0 for Apache 2.0.
// https://github.com/JoshClose/CsvHelper
using System.Globalization;
using System.IO;
using CsvHelper.Configuration;
namespace CsvHelper
{
///
/// Creates CsvHelper classes.
///
public class Factory : IFactory
{
///
/// Creates an .
///
/// The text reader to use for the csv parser.
/// The configuration to use for the csv parser.
/// The created parser.
public virtual IParser CreateParser(TextReader reader, Configuration.CsvConfiguration configuration)
{
return new CsvParser(reader, configuration);
}
///
/// Creates an .
///
/// The text reader to use for the csv parser.
/// The culture information.
///
/// The created parser.
///
public virtual IParser CreateParser(TextReader reader, CultureInfo cultureInfo)
{
return new CsvParser(reader, cultureInfo);
}
///
/// Creates an .
///
/// The text reader to use for the csv reader.
/// The configuration to use for the reader.
/// The created reader.
public virtual IReader CreateReader(TextReader reader, Configuration.CsvConfiguration configuration)
{
return new CsvReader(reader, configuration);
}
///
/// Creates an .
///
/// The text reader to use for the csv reader.
/// The culture information.
///
/// The created reader.
///
public virtual IReader CreateReader(TextReader reader, CultureInfo cultureInfo)
{
return new CsvReader(reader, cultureInfo);
}
///
/// Creates an .
///
/// The parser used to create the reader.
/// The created reader.
public virtual IReader CreateReader(IParser parser)
{
return new CsvReader(parser);
}
///
/// Creates an .
///
/// The text writer to use for the csv writer.
/// The configuration to use for the writer.
/// The created writer.
public virtual IWriter CreateWriter(TextWriter writer, Configuration.CsvConfiguration configuration)
{
return new CsvWriter(writer, configuration);
}
///
/// Creates an .
///
/// The text writer to use for the csv writer.
/// The culture information.
///
/// The created writer.
///
public virtual IWriter CreateWriter(TextWriter writer, CultureInfo cultureInfo)
{
return new CsvWriter(writer, cultureInfo);
}
///
/// Access point for fluent interface to dynamically build a
///
/// Type you will be making a class map for
/// Options to further configure the
public IHasMap CreateClassMapBuilder()
{
return new ClassMapBuilder();
}
}
}