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
63#ifndef vtkDelimitedTextReader_h
64#define vtkDelimitedTextReader_h
65
66#include "vtkIOInfovisModule.h" // For export macro
67#include "vtkStdString.h" // Needed for vtkStdString
68#include "vtkTableAlgorithm.h"
69
70class VTKIOINFOVIS_EXPORT vtkDelimitedTextReader : public vtkTableAlgorithm
71{
72public:
75 void PrintSelf(ostream& os, vtkIndent indent) override;
76
78
84
86
92 void SetInputString(const char* in);
93 vtkGetStringMacro(InputString);
94 void SetInputString(const char* in, int len);
95 vtkGetMacro(InputStringLength, int);
96 void SetInputString(const vtkStdString& input)
97 {
98 this->SetInputString(input.c_str(), static_cast<int>(input.length()));
99 }
101
103
107 vtkSetMacro(ReadFromInputString, vtkTypeBool);
108 vtkGetMacro(ReadFromInputString, vtkTypeBool);
109 vtkBooleanMacro(ReadFromInputString, vtkTypeBool);
111
113
124 vtkGetStringMacro(UnicodeCharacterSet);
125 vtkSetStringMacro(UnicodeCharacterSet);
127
129
134 void SetUTF8RecordDelimiters(const char* delimiters);
137
139
146 vtkSetStringMacro(FieldDelimiterCharacters);
147 vtkGetStringMacro(FieldDelimiterCharacters);
149
150 void SetUTF8FieldDelimiters(const char* delimiters);
152
154
163 vtkGetMacro(StringDelimiter, char);
164 vtkSetMacro(StringDelimiter, char);
166
167 void SetUTF8StringDelimiters(const char* delimiters);
169
171
174 vtkSetMacro(UseStringDelimiter, bool);
175 vtkGetMacro(UseStringDelimiter, bool);
176 vtkBooleanMacro(UseStringDelimiter, bool);
178
180
184 vtkGetMacro(HaveHeaders, bool);
185 vtkSetMacro(HaveHeaders, bool);
187
189
194 vtkSetMacro(MergeConsecutiveDelimiters, bool);
195 vtkGetMacro(MergeConsecutiveDelimiters, bool);
196 vtkBooleanMacro(MergeConsecutiveDelimiters, bool);
198
200
204 vtkGetMacro(MaxRecords, vtkIdType);
205 vtkSetMacro(MaxRecords, vtkIdType);
207
209
214 vtkSetMacro(DetectNumericColumns, bool);
215 vtkGetMacro(DetectNumericColumns, bool);
216 vtkBooleanMacro(DetectNumericColumns, bool);
218
220
225 vtkSetMacro(ForceDouble, bool);
226 vtkGetMacro(ForceDouble, bool);
227 vtkBooleanMacro(ForceDouble, bool);
229
231
246 vtkSetMacro(TrimWhitespacePriorToNumericConversion, bool);
247 vtkGetMacro(TrimWhitespacePriorToNumericConversion, bool);
248 vtkBooleanMacro(TrimWhitespacePriorToNumericConversion, bool);
250
252
256 vtkSetMacro(DefaultIntegerValue, int);
257 vtkGetMacro(DefaultIntegerValue, int);
259
261
265 vtkSetMacro(DefaultDoubleValue, double);
266 vtkGetMacro(DefaultDoubleValue, double);
268
270
274 vtkSetStringMacro(PedigreeIdArrayName);
275 vtkGetStringMacro(PedigreeIdArrayName);
277
279
283 vtkSetMacro(GeneratePedigreeIds, bool);
284 vtkGetMacro(GeneratePedigreeIds, bool);
285 vtkBooleanMacro(GeneratePedigreeIds, bool);
287
289
292 vtkSetMacro(OutputPedigreeIds, bool);
293 vtkGetMacro(OutputPedigreeIds, bool);
294 vtkBooleanMacro(OutputPedigreeIds, bool);
296
298
303 vtkSetMacro(AddTabFieldDelimiter, bool);
304 vtkGetMacro(AddTabFieldDelimiter, bool);
305 vtkBooleanMacro(AddTabFieldDelimiter, bool);
307
314
316
321 vtkSetMacro(ReplacementCharacter, vtkTypeUInt32);
322 vtkGetMacro(ReplacementCharacter, vtkTypeUInt32);
324
325protected:
328
330
331 // Read the content of the input file.
332 int ReadData(vtkTable* const output_table);
333
334 char* FileName;
343 std::string UnicodeWhitespace;
360 vtkTypeUInt32 ReplacementCharacter;
361
362private:
364 void operator=(const vtkDelimitedTextReader&) = delete;
365};
366
367#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:34
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:69
int vtkIdType
Definition vtkType.h:332