VTK  9.3.0
vtkDelimitedTextReader.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3// SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
4
50#ifndef vtkDelimitedTextReader_h
51#define vtkDelimitedTextReader_h
52
53#include "vtkIOInfovisModule.h" // For export macro
54#include "vtkStdString.h" // Needed for vtkStdString
55#include "vtkTableAlgorithm.h"
56
57VTK_ABI_NAMESPACE_BEGIN
58class VTKIOINFOVIS_EXPORT vtkDelimitedTextReader : public vtkTableAlgorithm
59{
60public:
63 void PrintSelf(ostream& os, vtkIndent indent) override;
64
66
72
74
80 void SetInputString(const char* in);
81 vtkGetStringMacro(InputString);
82 void SetInputString(const char* in, int len);
83 vtkGetMacro(InputStringLength, int);
84 void SetInputString(const vtkStdString& input)
85 {
86 this->SetInputString(input.c_str(), static_cast<int>(input.length()));
87 }
89
91
95 vtkSetMacro(ReadFromInputString, vtkTypeBool);
96 vtkGetMacro(ReadFromInputString, vtkTypeBool);
97 vtkBooleanMacro(ReadFromInputString, vtkTypeBool);
99
101
112 vtkGetStringMacro(UnicodeCharacterSet);
113 vtkSetStringMacro(UnicodeCharacterSet);
115
117
122 void SetUTF8RecordDelimiters(const char* delimiters);
125
127
134 vtkSetStringMacro(FieldDelimiterCharacters);
135 vtkGetStringMacro(FieldDelimiterCharacters);
137
138 void SetUTF8FieldDelimiters(const char* delimiters);
140
142
151 vtkGetMacro(StringDelimiter, char);
152 vtkSetMacro(StringDelimiter, char);
154
155 void SetUTF8StringDelimiters(const char* delimiters);
157
159
162 vtkSetMacro(UseStringDelimiter, bool);
163 vtkGetMacro(UseStringDelimiter, bool);
164 vtkBooleanMacro(UseStringDelimiter, bool);
166
168
172 vtkGetMacro(HaveHeaders, bool);
173 vtkSetMacro(HaveHeaders, bool);
175
177
182 vtkSetMacro(MergeConsecutiveDelimiters, bool);
183 vtkGetMacro(MergeConsecutiveDelimiters, bool);
184 vtkBooleanMacro(MergeConsecutiveDelimiters, bool);
186
188
192 vtkGetMacro(MaxRecords, vtkIdType);
193 vtkSetMacro(MaxRecords, vtkIdType);
195
197
202 vtkSetMacro(DetectNumericColumns, bool);
203 vtkGetMacro(DetectNumericColumns, bool);
204 vtkBooleanMacro(DetectNumericColumns, bool);
206
208
213 vtkSetMacro(ForceDouble, bool);
214 vtkGetMacro(ForceDouble, bool);
215 vtkBooleanMacro(ForceDouble, bool);
217
219
234 vtkSetMacro(TrimWhitespacePriorToNumericConversion, bool);
235 vtkGetMacro(TrimWhitespacePriorToNumericConversion, bool);
236 vtkBooleanMacro(TrimWhitespacePriorToNumericConversion, bool);
238
240
244 vtkSetMacro(DefaultIntegerValue, int);
245 vtkGetMacro(DefaultIntegerValue, int);
247
249
253 vtkSetMacro(DefaultDoubleValue, double);
254 vtkGetMacro(DefaultDoubleValue, double);
256
258
262 vtkSetStringMacro(PedigreeIdArrayName);
263 vtkGetStringMacro(PedigreeIdArrayName);
265
267
271 vtkSetMacro(GeneratePedigreeIds, bool);
272 vtkGetMacro(GeneratePedigreeIds, bool);
273 vtkBooleanMacro(GeneratePedigreeIds, bool);
275
277
280 vtkSetMacro(OutputPedigreeIds, bool);
281 vtkGetMacro(OutputPedigreeIds, bool);
282 vtkBooleanMacro(OutputPedigreeIds, bool);
284
286
291 vtkSetMacro(AddTabFieldDelimiter, bool);
292 vtkGetMacro(AddTabFieldDelimiter, bool);
293 vtkBooleanMacro(AddTabFieldDelimiter, bool);
295
302
304
309 vtkSetMacro(ReplacementCharacter, vtkTypeUInt32);
310 vtkGetMacro(ReplacementCharacter, vtkTypeUInt32);
312
313protected:
316
318
319 // Read the content of the input file.
320 int ReadData(vtkTable* output_table);
321
322 char* FileName;
331 std::string UnicodeWhitespace;
348 vtkTypeUInt32 ReplacementCharacter;
349
350private:
352 void operator=(const vtkDelimitedTextReader&) = delete;
353};
354
355VTK_ABI_NAMESPACE_END
356#endif
reads in delimited ascii or unicode text files and outputs a vtkTable data structure.
void SetInputString(const char *in, int len)
Specify the InputString for use when reading from a character array.
int ReadData(vtkTable *output_table)
~vtkDelimitedTextReader() override
void SetUTF8RecordDelimiters(const char *delimiters)
Specify the character(s) that will be used to separate records.
vtkStdString GetLastError()
Returns a human-readable description of the most recent error, if any.
void SetInputString(const char *in)
Specify the InputString for use when reading from a character array.
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
void SetUTF8StringDelimiters(const char *delimiters)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkGetFilePathMacro(FileName)
Specifies the delimited text file to be loaded.
const char * GetUTF8StringDelimiters()
vtkSetFilePathMacro(FileName)
Specifies the delimited text file to be loaded.
static vtkDelimitedTextReader * New()
const char * GetUTF8RecordDelimiters()
Specify the character(s) that will be used to separate records.
void SetInputString(const vtkStdString &input)
Specify the InputString for use when reading from a character array.
const char * GetUTF8FieldDelimiters()
void SetUTF8FieldDelimiters(const char *delimiters)
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Wrapper around std::string to keep symbols short.
Superclass for algorithms that produce only vtkTables as output.
A table, which contains similar-typed columns of data.
Definition vtkTable.h:59
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:315