// 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;
using CsvHelper.Configuration;
using System.Threading.Tasks;
namespace CsvHelper
{
///
/// Defines methods used the parse a CSV file.
///
public interface IParser : IDisposable
{
///
/// Gets the count of how many bytes have been read.
/// needs
/// to be enabled for this value to be populated.
///
long ByteCount { get; }
///
/// Gets the count of how many characters have been read.
///
long CharCount { get; }
///
/// Gets the number of fields for the current row.
///
int Count { get; }
///
/// Gets the field at the specified index for the current row.
///
/// The index.
/// The field.
string this[int index] { get; }
///
/// Gets the record for the current row. Note:
/// It is much more efficient to only get the fields you need. If
/// you need all fields, then use this.
///
string[]? Record { get; }
///
/// Gets the raw record for the current row.
///
string RawRecord { get; }
///
/// Gets the CSV row the parser is currently on.
///
int Row { get; }
///
/// Gets the raw row the parser is currently on.
///
int RawRow { get; }
///
/// The delimiter the parser is using.
///
string Delimiter { get; }
///
/// Gets the reading context.
///
CsvContext Context { get; }
///
/// Gets the configuration.
///
IParserConfiguration Configuration { get; }
///
/// Reads a record from the CSV file.
///
/// True if there are more records to read, otherwise false.
bool Read();
///
/// Reads a record from the CSV file asynchronously.
///
/// True if there are more records to read, otherwise false.
Task ReadAsync();
}
}