VTK
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 
21 
70 #ifndef vtkDelimitedTextReader_h
71 #define vtkDelimitedTextReader_h
72 
73 #include "vtkIOInfovisModule.h" // For export macro
74 #include "vtkTableAlgorithm.h"
75 #include "vtkUnicodeString.h" // Needed for vtkUnicodeString
76 #include "vtkStdString.h" // Needed for vtkStdString
77 
78 class VTKIOINFOVIS_EXPORT vtkDelimitedTextReader : public vtkTableAlgorithm
79 {
80 public:
81  static vtkDelimitedTextReader* New();
83  void PrintSelf(ostream& os, vtkIndent indent) override;
84 
86 
89  vtkGetStringMacro(FileName);
90  vtkSetStringMacro(FileName);
92 
94 
100  void SetInputString(const char *in);
101  vtkGetStringMacro(InputString);
102  void SetInputString(const char *in, int len);
103  vtkGetMacro(InputStringLength, int);
104  void SetInputString(const vtkStdString& input)
105  { this->SetInputString(input.c_str(), static_cast<int>(input.length())); }
107 
109 
113  vtkSetMacro(ReadFromInputString,vtkTypeBool);
114  vtkGetMacro(ReadFromInputString,vtkTypeBool);
115  vtkBooleanMacro(ReadFromInputString,vtkTypeBool);
117 
119 
130  vtkGetStringMacro(UnicodeCharacterSet);
131  vtkSetStringMacro(UnicodeCharacterSet);
133 
135 
140  void SetUTF8RecordDelimiters(const char* delimiters);
141  const char* GetUTF8RecordDelimiters();
142  void SetUnicodeRecordDelimiters(const vtkUnicodeString& delimiters);
143  vtkUnicodeString GetUnicodeRecordDelimiters();
145 
147 
154  vtkSetStringMacro(FieldDelimiterCharacters);
155  vtkGetStringMacro(FieldDelimiterCharacters);
157 
158  void SetUTF8FieldDelimiters(const char* delimiters);
159  const char* GetUTF8FieldDelimiters();
160  void SetUnicodeFieldDelimiters(const vtkUnicodeString& delimiters);
161  vtkUnicodeString GetUnicodeFieldDelimiters();
162 
164 
173  vtkGetMacro(StringDelimiter, char);
174  vtkSetMacro(StringDelimiter, char);
176 
177  void SetUTF8StringDelimiters(const char* delimiters);
178  const char* GetUTF8StringDelimiters();
179  void SetUnicodeStringDelimiters(const vtkUnicodeString& delimiters);
180  vtkUnicodeString GetUnicodeStringDelimiters();
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 
325  vtkStdString GetLastError();
326 
328 
333  vtkSetMacro(ReplacementCharacter, vtkTypeUInt32);
334  vtkGetMacro(ReplacementCharacter, vtkTypeUInt32);
336 
337 protected:
339  ~vtkDelimitedTextReader() override;
340 
341  int RequestData(
344  vtkInformationVector*) override;
345 
346  char* FileName;
348  char *InputString;
373  vtkTypeUInt32 ReplacementCharacter;
374 
375 private:
377  void operator=(const vtkDelimitedTextReader&) = delete;
378 
379 };
380 
381 #endif
void SetInputString(const vtkStdString &input)
Specify the InputString for use when reading from a character array.
vtkUnicodeString UnicodeRecordDelimiters
Wrapper around std::string to keep symbols short.
Definition: vtkStdString.h:40
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.
vtkUnicodeString UnicodeStringDelimiters
int vtkIdType
Definition: vtkType.h:347
int vtkTypeBool
Definition: vtkABI.h:69
reads in delimited ascii or unicode text files and outputs a vtkTable data structure.
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkUnicodeString UnicodeEscapeCharacter
vtkUnicodeString UnicodeWhitespace
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkUnicodeString UnicodeFieldDelimiters
Superclass for algorithms that produce only vtkTables as output.
Store zero or more vtkInformation instances.
String class that stores Unicode text.