1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
// 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 CsvHelper.Delegates;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
namespace CsvHelper.Configuration
{
/// <summary>
/// Configuration used for the <see cref="IParser"/>.
/// </summary>
public interface IParserConfiguration
{
/// <summary>
/// Gets the culture info used to read an write CSV files.
/// </summary>
CultureInfo CultureInfo { get; }
/// <summary>
/// Cache fields that are created when parsing.
/// Default is false.
/// </summary>
bool CacheFields { get; }
/// <summary>
/// The newline string to use. Default is \r\n (CRLF).
/// When writing, this value is always used.
/// When reading, this value is only used if explicitly set.
/// If not set, the parser uses one of \r\n, \r, or \n.
/// </summary>
string NewLine { get; }
/// <summary>
/// A value indicating if <see cref="NewLine"/> was set.
/// </summary>
/// <value>
/// <c>true</c> if <see cref="NewLine"/> was set. <c>false</c> if <see cref="NewLine"/> is the default.
/// </value>
bool IsNewLineSet { get; }
/// <summary>
/// The mode.
/// See <see cref="CsvMode"/> for more details.
/// </summary>
CsvMode Mode { get; }
/// <summary>
/// Gets the size of the buffer
/// used for parsing and writing CSV files.
/// Default is 0x1000.
/// </summary>
int BufferSize { get; }
/// <summary>
/// The size of the buffer used when processing fields.
/// Default is 1024.
/// </summary>
int ProcessFieldBufferSize { get; }
/// <summary>
/// Gets a value indicating whether the number of bytes should
/// be counted while parsing. Default is false. This will slow down parsing
/// because it needs to get the byte count of every char for the given encoding.
/// The <see cref="Encoding"/> needs to be set correctly for this to be accurate.
/// </summary>
bool CountBytes { get; }
/// <summary>
/// Gets the encoding used when counting bytes.
/// </summary>
Encoding Encoding { get; }
/// <summary>
/// Gets the function that is called when bad field data is found. A field
/// has bad data if it contains a quote and the field is not quoted (escaped).
/// You can supply your own function to do other things like logging the issue
/// instead of throwing an exception.
/// </summary>
BadDataFound BadDataFound { get; }
/// <summary>
/// Gets or sets the maximum size of a field.
/// Defaults to 0, indicating maximum field size is not checked.
/// </summary>
double MaxFieldSize { get; }
/// <summary>
/// Gets a value indicating if a line break found in a quote field should
/// be considered bad data. <c>true</c> to consider a line break bad data, otherwise <c>false</c>.
/// Defaults to false.
/// </summary>
bool LineBreakInQuotedFieldIsBadData { get; }
/// <summary>
/// Gets the character used to denote
/// a line that is commented out. Default is '#'.
/// </summary>
char Comment { get; }
/// <summary>
/// Gets a value indicating if comments are allowed.
/// <c>true</c> to allow commented out lines, otherwise <c>false</c>.
/// </summary>
bool AllowComments { get; }
/// <summary>
/// Gets a value indicating if blank lines
/// should be ignored when reading.
/// <c>true</c> to ignore, otherwise <c>false</c>. Default is true.
/// </summary>
bool IgnoreBlankLines { get; }
/// <summary>
/// Gets the character used to quote fields.
/// Default is '"'.
/// </summary>
char Quote { get; }
/// <summary>
/// The delimiter used to separate fields.
/// Default is <see cref="TextInfo.ListSeparator"/>.
/// </summary>
string Delimiter { get; }
/// <summary>
/// Detect the delimiter instead of using the delimiter from configuration.
/// Default is <c>false</c>.
/// </summary>
bool DetectDelimiter { get; }
/// <summary>
/// Gets the function that is called when <see cref="DetectDelimiter"/> is enabled.
/// </summary>
GetDelimiter GetDelimiter { get; }
/// <summary>
/// The possible delimiter values used when detecting the delimiter.
/// Default is [",", ";", "|", "\t"].
/// </summary>
string[] DetectDelimiterValues { get; }
/// <summary>
/// The character used to escape characters.
/// Default is '"'.
/// </summary>
char Escape { get; }
/// <summary>
/// Gets the field trimming options.
/// </summary>
TrimOptions TrimOptions { get; }
/// <summary>
/// Characters considered whitespace.
/// Used when trimming fields.
/// Default is [' '].
/// </summary>
char[] WhiteSpaceChars { get; }
/// <summary>
/// A value indicating if exception messages contain raw CSV data.
/// <c>true</c> if exception contain raw CSV data, otherwise <c>false</c>.
/// Default is <c>true</c>.
/// </summary>
bool ExceptionMessagesContainRawData { get; }
/// <summary>
/// Validates the configuration.
/// </summary>
void Validate();
}
}
|