VTK  9.2.6
vtkDelimitedTextReader.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkDelimitedTextReader.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
15/*-------------------------------------------------------------------------
16 Copyright 2008 Sandia Corporation.
17 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18 the U.S. Government retains certain rights in this software.
19-------------------------------------------------------------------------*/
20
75#ifndef vtkDelimitedTextReader_h
76#define vtkDelimitedTextReader_h
77
78#include "vtkIOInfovisModule.h" // For export macro
79#include "vtkStdString.h" // Needed for vtkStdString
80#include "vtkTableAlgorithm.h"
81
82class VTKIOINFOVIS_EXPORT vtkDelimitedTextReader : public vtkTableAlgorithm
83{
84public:
87 void PrintSelf(ostream& os, vtkIndent indent) override;
88
90
96
98
104 void SetInputString(const char* in);
105 vtkGetStringMacro(InputString);
106 void SetInputString(const char* in, int len);
107 vtkGetMacro(InputStringLength, int);
108 void SetInputString(const vtkStdString& input)
109 {
110 this->SetInputString(input.c_str(), static_cast<int>(input.length()));
111 }
113
115
119 vtkSetMacro(ReadFromInputString, vtkTypeBool);
120 vtkGetMacro(ReadFromInputString, vtkTypeBool);
121 vtkBooleanMacro(ReadFromInputString, vtkTypeBool);
123
125
136 vtkGetStringMacro(UnicodeCharacterSet);
137 vtkSetStringMacro(UnicodeCharacterSet);
139
141
146 void SetUTF8RecordDelimiters(const char* delimiters);
149
151
158 vtkSetStringMacro(FieldDelimiterCharacters);
159 vtkGetStringMacro(FieldDelimiterCharacters);
161
162 void SetUTF8FieldDelimiters(const char* delimiters);
164
166
175 vtkGetMacro(StringDelimiter, char);
176 vtkSetMacro(StringDelimiter, char);
178
179 void SetUTF8StringDelimiters(const char* delimiters);
181
183
186 vtkSetMacro(UseStringDelimiter, bool);
187 vtkGetMacro(UseStringDelimiter, bool);
188 vtkBooleanMacro(UseStringDelimiter, bool);
190
192
196 vtkGetMacro(HaveHeaders, bool);
197 vtkSetMacro(HaveHeaders, bool);
199
201
206 vtkSetMacro(MergeConsecutiveDelimiters, bool);
207 vtkGetMacro(MergeConsecutiveDelimiters, bool);
208 vtkBooleanMacro(MergeConsecutiveDelimiters, bool);
210
212
216 vtkGetMacro(MaxRecords, vtkIdType);
217 vtkSetMacro(MaxRecords, vtkIdType);
219
221
226 vtkSetMacro(DetectNumericColumns, bool);
227 vtkGetMacro(DetectNumericColumns, bool);
228 vtkBooleanMacro(DetectNumericColumns, bool);
230
232
237 vtkSetMacro(ForceDouble, bool);
238 vtkGetMacro(ForceDouble, bool);
239 vtkBooleanMacro(ForceDouble, bool);
241
243
258 vtkSetMacro(TrimWhitespacePriorToNumericConversion, bool);
259 vtkGetMacro(TrimWhitespacePriorToNumericConversion, bool);
260 vtkBooleanMacro(TrimWhitespacePriorToNumericConversion, bool);
262
264
268 vtkSetMacro(DefaultIntegerValue, int);
269 vtkGetMacro(DefaultIntegerValue, int);
271
273
277 vtkSetMacro(DefaultDoubleValue, double);
278 vtkGetMacro(DefaultDoubleValue, double);
280
282
286 vtkSetStringMacro(PedigreeIdArrayName);
287 vtkGetStringMacro(PedigreeIdArrayName);
289
291
295 vtkSetMacro(GeneratePedigreeIds, bool);
296 vtkGetMacro(GeneratePedigreeIds, bool);
297 vtkBooleanMacro(GeneratePedigreeIds, bool);
299
301
304 vtkSetMacro(OutputPedigreeIds, bool);
305 vtkGetMacro(OutputPedigreeIds, bool);
306 vtkBooleanMacro(OutputPedigreeIds, bool);
308
310
315 vtkSetMacro(AddTabFieldDelimiter, bool);
316 vtkGetMacro(AddTabFieldDelimiter, bool);
317 vtkBooleanMacro(AddTabFieldDelimiter, bool);
319
326
328
333 vtkSetMacro(ReplacementCharacter, vtkTypeUInt32);
334 vtkGetMacro(ReplacementCharacter, vtkTypeUInt32);
336
337protected:
340
342
343 // Read the content of the input file.
344 int ReadData(vtkTable* const output_table);
345
346 char* FileName;
355 std::string UnicodeWhitespace;
372 vtkTypeUInt32 ReplacementCharacter;
373
374private:
376 void operator=(const vtkDelimitedTextReader&) = delete;
377};
378
379#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.
~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()
int ReadData(vtkTable *const output_table)
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:49
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:83
int vtkTypeBool
Definition vtkABI.h:69
int vtkIdType
Definition vtkType.h:332