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 
64 #ifndef vtkDelimitedTextReader_h
65 #define vtkDelimitedTextReader_h
66 
67 #include "vtkIOInfovisModule.h" // For export macro
68 #include "vtkTableAlgorithm.h"
69 #include "vtkUnicodeString.h" // Needed for vtkUnicodeString
70 #include "vtkStdString.h" // Needed for vtkStdString
71 
72 class VTKIOINFOVIS_EXPORT vtkDelimitedTextReader : public vtkTableAlgorithm
73 {
74 public:
75  static vtkDelimitedTextReader* New();
77  void PrintSelf(ostream& os, vtkIndent indent) override;
78 
80 
83  vtkGetStringMacro(FileName);
84  vtkSetStringMacro(FileName);
86 
88 
94  void SetInputString(const char *in);
95  vtkGetStringMacro(InputString);
96  void SetInputString(const char *in, int len);
97  vtkGetMacro(InputStringLength, int);
98  void SetInputString(const vtkStdString& input)
99  { this->SetInputString(input.c_str(), static_cast<int>(input.length())); }
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);
135  const char* GetUTF8RecordDelimiters();
136  void SetUnicodeRecordDelimiters(const vtkUnicodeString& delimiters);
137  vtkUnicodeString GetUnicodeRecordDelimiters();
139 
141 
148  vtkSetStringMacro(FieldDelimiterCharacters);
149  vtkGetStringMacro(FieldDelimiterCharacters);
151 
152  void SetUTF8FieldDelimiters(const char* delimiters);
153  const char* GetUTF8FieldDelimiters();
154  void SetUnicodeFieldDelimiters(const vtkUnicodeString& delimiters);
155  vtkUnicodeString GetUnicodeFieldDelimiters();
156 
158 
167  vtkGetMacro(StringDelimiter, char);
168  vtkSetMacro(StringDelimiter, char);
170 
171  void SetUTF8StringDelimiters(const char* delimiters);
172  const char* GetUTF8StringDelimiters();
173  void SetUnicodeStringDelimiters(const vtkUnicodeString& delimiters);
174  vtkUnicodeString GetUnicodeStringDelimiters();
175 
177 
180  vtkSetMacro(UseStringDelimiter, bool);
181  vtkGetMacro(UseStringDelimiter, bool);
182  vtkBooleanMacro(UseStringDelimiter, bool);
184 
186 
190  vtkGetMacro(HaveHeaders, bool);
191  vtkSetMacro(HaveHeaders, bool);
193 
195 
200  vtkSetMacro(MergeConsecutiveDelimiters, bool);
201  vtkGetMacro(MergeConsecutiveDelimiters, bool);
202  vtkBooleanMacro(MergeConsecutiveDelimiters, bool);
204 
206 
210  vtkGetMacro(MaxRecords, vtkIdType);
211  vtkSetMacro(MaxRecords, vtkIdType);
213 
215 
220  vtkSetMacro(DetectNumericColumns, bool);
221  vtkGetMacro(DetectNumericColumns, bool);
222  vtkBooleanMacro(DetectNumericColumns, bool);
224 
226 
231  vtkSetMacro(ForceDouble, bool);
232  vtkGetMacro(ForceDouble, bool);
233  vtkBooleanMacro(ForceDouble, bool);
235 
237 
252  vtkSetMacro(TrimWhitespacePriorToNumericConversion, bool);
253  vtkGetMacro(TrimWhitespacePriorToNumericConversion, bool);
254  vtkBooleanMacro(TrimWhitespacePriorToNumericConversion, bool);
256 
258 
262  vtkSetMacro(DefaultIntegerValue, int);
263  vtkGetMacro(DefaultIntegerValue, int);
265 
267 
271  vtkSetMacro(DefaultDoubleValue, double);
272  vtkGetMacro(DefaultDoubleValue, double);
274 
276 
280  vtkSetStringMacro(PedigreeIdArrayName);
281  vtkGetStringMacro(PedigreeIdArrayName);
283 
285 
289  vtkSetMacro(GeneratePedigreeIds, bool);
290  vtkGetMacro(GeneratePedigreeIds, bool);
291  vtkBooleanMacro(GeneratePedigreeIds, bool);
293 
295 
298  vtkSetMacro(OutputPedigreeIds, bool);
299  vtkGetMacro(OutputPedigreeIds, bool);
300  vtkBooleanMacro(OutputPedigreeIds, bool);
302 
304 
309  vtkSetMacro(AddTabFieldDelimiter, bool);
310  vtkGetMacro(AddTabFieldDelimiter, bool);
311  vtkBooleanMacro(AddTabFieldDelimiter, bool);
313 
319  vtkStdString GetLastError();
320 
322 
327  vtkSetMacro(ReplacementCharacter, vtkTypeUInt32);
328  vtkGetMacro(ReplacementCharacter, vtkTypeUInt32);
330 
331 protected:
333  ~vtkDelimitedTextReader() override;
334 
335  int RequestData(
338  vtkInformationVector*) override;
339 
340  char* FileName;
342  char *InputString;
367  vtkTypeUInt32 ReplacementCharacter;
368 
369 private:
371  void operator=(const vtkDelimitedTextReader&) = delete;
372 
373 };
374 
375 #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:34
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:33
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.