summaryrefslogtreecommitdiff
path: root/ThirdParty/CsvHelper-master/src/CsvHelper/Configuration/IWriterConfiguration.cs
blob: 349c4930c5cc428fd5e4ef40a0397cab6f8139a1 (plain)
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
// 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.Collections.Generic;
using System.IO;

namespace CsvHelper.Configuration
{
	/// <summary>
	/// Configuration used for the <see cref="IWriter"/>.
	/// </summary>
	public interface IWriterConfiguration
	{
		/// <summary>
		/// Gets the size of the buffer
		/// used for parsing and writing CSV files.
		/// Default is 0x1000.
		/// </summary>
		int BufferSize { get; }

		/// <summary>
		/// The mode.
		/// See <see cref="CsvMode"/> for more details.
		/// </summary>
		CsvMode Mode { get; }

		/// <summary>
		/// Gets the delimiter used to separate fields.
		/// Default is ',';
		/// </summary>
		string Delimiter { get; }

		/// <summary>
		/// Gets the character used to quote fields.
		/// Default is '"'.
		/// </summary>
		char Quote { 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>
		/// Gets the injection options.
		/// </summary>
		InjectionOptions InjectionOptions { get; }

		/// <summary>
		/// Gets the characters that are used for injection attacks.
		/// </summary>
		char[] InjectionCharacters { get; }

		/// <summary>
		/// Gets the character used to escape a detected injection.
		/// </summary>
		char InjectionEscapeCharacter { 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>
		/// Gets a function that is used to determine if a field should get quoted 
		/// when writing.
		/// </summary>
		ShouldQuote ShouldQuote { get; }

		/// <summary>
		/// Gets the culture info used to read and write CSV files.
		/// </summary>
		CultureInfo CultureInfo { get; }

		/// <summary>
		/// Gets a value indicating if comments are allowed.
		/// True to allow commented out lines, otherwise false.
		/// </summary>
		bool AllowComments { 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 the
		/// CSV file has a header record.
		/// Default is true.
		/// </summary>
		bool HasHeaderRecord { get; }

		/// <summary>
		/// Gets a value indicating whether references
		/// should be ignored when auto mapping. True to ignore
		/// references, otherwise false. Default is false.
		/// </summary>
		bool IgnoreReferences { get; }

		/// <summary>
		/// Gets a value indicating if private
		/// member should be read from and written to.
		/// True to include private member, otherwise false. Default is false.
		/// </summary>
		bool IncludePrivateMembers { get; }

		/// <summary>
		/// Gets a callback that will return the prefix for a reference header.
		/// </summary>
		ReferenceHeaderPrefix ReferenceHeaderPrefix { get; }

		/// <summary>
		/// Gets the member types that are used when auto mapping.
		/// MemberTypes are flags, so you can choose more than one.
		/// Default is Properties.
		/// </summary>
		MemberTypes MemberTypes { get; }

		/// <summary>
		/// Gets a value indicating that during writing if a new 
		/// object should be created when a reference member is null.
		/// True to create a new object and use it's defaults for the
		/// fields, or false to leave the fields empty for all the
		/// reference member's member.
		/// </summary>
		bool UseNewObjectForNullReferenceMembers { get; }

		/// <summary>
		/// Gets the comparer used to order the properties
		/// of dynamic objects when writing. The default is null,
		/// which will preserve the order the object properties
		/// were created with.
		/// </summary>
		IComparer<string> DynamicPropertySort { 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();
	}
}