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
59#ifndef vtkDelimitedTextReader_h
60#define vtkDelimitedTextReader_h
61
62#include "vtkIOInfovisModule.h" // For export macro
63#include "vtkStdString.h" // Needed for vtkStdString
64#include "vtkTableAlgorithm.h"
65
66VTK_ABI_NAMESPACE_BEGIN
67class VTKIOINFOVIS_EXPORT vtkDelimitedTextReader : public vtkTableAlgorithm
68{
69public:
72 void PrintSelf(ostream& os, vtkIndent indent) override;
73
75
81
83
89 void SetInputString(const char* in);
90 vtkGetStringMacro(InputString);
91 void SetInputString(const char* in, int len);
92 vtkGetMacro(InputStringLength, int);
93 void SetInputString(const vtkStdString& input)
94 {
95 this->SetInputString(input.c_str(), static_cast<int>(input.length()));
96 }
98
100
104 vtkSetMacro(ReadFromInputString, vtkTypeBool);
105 vtkGetMacro(ReadFromInputString, vtkTypeBool);
106 vtkBooleanMacro(ReadFromInputString, vtkTypeBool);
108
110
121 vtkGetStringMacro(UnicodeCharacterSet);
122 vtkSetStringMacro(UnicodeCharacterSet);
124
126
131 void SetUTF8RecordDelimiters(const char* delimiters);
134
136
143 vtkSetStringMacro(FieldDelimiterCharacters);
144 vtkGetStringMacro(FieldDelimiterCharacters);
146
147 void SetUTF8FieldDelimiters(const char* delimiters);
149
151
160 vtkGetMacro(StringDelimiter, char);
161 vtkSetMacro(StringDelimiter, char);
163
164 void SetUTF8StringDelimiters(const char* delimiters);
166
168
171 vtkSetMacro(UseStringDelimiter, bool);
172 vtkGetMacro(UseStringDelimiter, bool);
173 vtkBooleanMacro(UseStringDelimiter, bool);
175
177
181 vtkGetMacro(HaveHeaders, bool);
182 vtkSetMacro(HaveHeaders, bool);
184
186
191 vtkSetMacro(MergeConsecutiveDelimiters, bool);
192 vtkGetMacro(MergeConsecutiveDelimiters, bool);
193 vtkBooleanMacro(MergeConsecutiveDelimiters, bool);
195
197
201 vtkGetMacro(MaxRecords, vtkIdType);
202 vtkSetMacro(MaxRecords, vtkIdType);
204
206
211 vtkSetMacro(DetectNumericColumns, bool);
212 vtkGetMacro(DetectNumericColumns, bool);
213 vtkBooleanMacro(DetectNumericColumns, bool);
215
217
222 vtkSetMacro(ForceDouble, bool);
223 vtkGetMacro(ForceDouble, bool);
224 vtkBooleanMacro(ForceDouble, bool);
226
228
243 vtkSetMacro(TrimWhitespacePriorToNumericConversion, bool);
244 vtkGetMacro(TrimWhitespacePriorToNumericConversion, bool);
245 vtkBooleanMacro(TrimWhitespacePriorToNumericConversion, bool);
247
249
253 vtkSetMacro(DefaultIntegerValue, int);
254 vtkGetMacro(DefaultIntegerValue, int);
256
258
262 vtkSetMacro(DefaultDoubleValue, double);
263 vtkGetMacro(DefaultDoubleValue, double);
265
267
271 vtkSetStringMacro(PedigreeIdArrayName);
272 vtkGetStringMacro(PedigreeIdArrayName);
274
276
280 vtkSetMacro(GeneratePedigreeIds, bool);
281 vtkGetMacro(GeneratePedigreeIds, bool);
282 vtkBooleanMacro(GeneratePedigreeIds, bool);
284
286
289 vtkSetMacro(OutputPedigreeIds, bool);
290 vtkGetMacro(OutputPedigreeIds, bool);
291 vtkBooleanMacro(OutputPedigreeIds, bool);
293
295
300 vtkSetMacro(AddTabFieldDelimiter, bool);
301 vtkGetMacro(AddTabFieldDelimiter, bool);
302 vtkBooleanMacro(AddTabFieldDelimiter, bool);
304
311
313
318 vtkSetMacro(ReplacementCharacter, vtkTypeUInt32);
319 vtkGetMacro(ReplacementCharacter, vtkTypeUInt32);
321
322protected:
325
327
328 // Read the content of the input file.
329 int ReadData(vtkTable* output_table);
330
331 char* FileName;
340 std::string UnicodeWhitespace;
357 vtkTypeUInt32 ReplacementCharacter;
358
359private:
361 void operator=(const vtkDelimitedTextReader&) = delete;
362};
363
364VTK_ABI_NAMESPACE_END
365#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:38
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:68
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:315