VTK  9.3.1
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 
57 VTK_ABI_NAMESPACE_BEGIN
58 class VTKIOINFOVIS_EXPORT vtkDelimitedTextReader : public vtkTableAlgorithm
59 {
60 public:
61  static vtkDelimitedTextReader* New();
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
66 
69  vtkGetFilePathMacro(FileName);
70  vtkSetFilePathMacro(FileName);
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);
123  const char* GetUTF8RecordDelimiters();
125 
127 
134  vtkSetStringMacro(FieldDelimiterCharacters);
135  vtkGetStringMacro(FieldDelimiterCharacters);
137 
138  void SetUTF8FieldDelimiters(const char* delimiters);
139  const char* GetUTF8FieldDelimiters();
140 
142 
151  vtkGetMacro(StringDelimiter, char);
152  vtkSetMacro(StringDelimiter, char);
154 
155  void SetUTF8StringDelimiters(const char* delimiters);
156  const char* GetUTF8StringDelimiters();
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 
301  vtkStdString GetLastError();
302 
304 
309  vtkSetMacro(ReplacementCharacter, vtkTypeUInt32);
310  vtkGetMacro(ReplacementCharacter, vtkTypeUInt32);
312 
313 protected:
315  ~vtkDelimitedTextReader() override;
316 
318 
319  // Read the content of the input file.
320  int ReadData(vtkTable* output_table);
321 
322  char* FileName;
324  char* InputString;
348  vtkTypeUInt32 ReplacementCharacter;
349 
350 private:
352  void operator=(const vtkDelimitedTextReader&) = delete;
353 };
354 
355 VTK_ABI_NAMESPACE_END
356 #endif
void SetInputString(const vtkStdString &input)
Specify the InputString for use when reading from a character array.
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:28
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static vtkTableAlgorithm * New()
Store vtkAlgorithm input/output information.
int vtkIdType
Definition: vtkType.h:315
int vtkTypeBool
Definition: vtkABI.h:64
reads in delimited ascii or unicode text files and outputs a vtkTable data structure.
a simple class to control print indentation
Definition: vtkIndent.h:28
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:58
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
Superclass for algorithms that produce only vtkTables as output.
Store zero or more vtkInformation instances.