VTK  9.4.2
vtkDelimitedTextCodecIteratorPrivate.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
3
15#ifndef vtkDelimitedTextCodecIterator_h
16#define vtkDelimitedTextCodecIterator_h
17
18#include "vtkTextCodec.h"
19
20#include <set> //for set
21
22VTK_ABI_NAMESPACE_BEGIN
23
25class vtkDoubleArray;
26class vtkIntArray;
27class vtkStringArray;
28class vtkTable;
29
31{
32public:
33 vtkDelimitedTextCodecIteratorPrivate(vtkIdType max_records, const std::string& record_delimiters,
34 const std::string& field_delimiters, const std::string& string_delimiters,
35 const std::string& whitespace, const std::string& escape, bool have_headers,
36 bool merg_cons_delimiters, bool use_string_delimiter, bool detect_numeric_columns,
37 bool force_double, int default_int, double default_double, vtkTable* output_table);
38
40
45
49 vtkDelimitedTextCodecIteratorPrivate& operator=(const vtkTypeUInt32& value) override;
50
51private:
54
55 template <typename T>
56 static vtkSmartPointer<vtkStringArray> ToStringArray(T* array);
57
62 static vtkSmartPointer<vtkDoubleArray> ToDoubleArray(vtkIntArray* array);
63
70 vtkIntArray* array, vtkIdType index, const std::string& str);
71
78 vtkDoubleArray* array, vtkIdType index, const std::string& str);
79
85 vtkStringArray* array, vtkIdType index, const std::string& str);
86
94 vtkAbstractArray* array, vtkIdType index, const std::string& str);
95
100 void CreateColumn();
101
107 void InsertField();
108
109 vtkIdType MaxRecords = 0;
110 vtkIdType MaxRecordIndex = 0;
111 std::set<vtkTypeUInt32> RecordDelimiters;
112 std::set<vtkTypeUInt32> FieldDelimiters;
113 std::set<vtkTypeUInt32> StringDelimiters;
114 std::set<vtkTypeUInt32> Whitespace;
115 std::set<vtkTypeUInt32> EscapeDelimiter;
116 bool HaveHeaders = false;
117 bool WhiteSpaceOnlyString = true;
118 vtkTable* OutputTable = nullptr;
119 vtkIdType CurrentRecordIndex = 0;
120 vtkIdType CurrentFieldIndex = 0;
121 std::string CurrentField;
122 bool RecordAdjacent = true;
123 bool MergeConsDelims = false;
124 bool ProcessEscapeSequence = false;
125 bool UseStringDelimiter = true;
126 bool DetectNumericColumns = false;
127 bool ForceDouble = false;
128 int DefaultIntegerValue = 0;
129 double DefaultDoubleValue = 0.;
130 vtkTypeUInt32 WithinString = 0;
131};
132
133VTK_ABI_NAMESPACE_END
134#endif
135/* VTK-HeaderTest-Exclude: INCLUDES:CLASSES */
Abstract superclass for all arrays.
Implements vtkTextCodec::OutputIterator to fill a vtkTable from text input.
vtkDelimitedTextCodecIteratorPrivate(vtkIdType max_records, const std::string &record_delimiters, const std::string &field_delimiters, const std::string &string_delimiters, const std::string &whitespace, const std::string &escape, bool have_headers, bool merg_cons_delimiters, bool use_string_delimiter, bool detect_numeric_columns, bool force_double, int default_int, double default_double, vtkTable *output_table)
void ReachedEndOfInput()
Handle windows files that do not have a carriage return line feed on the last line of the file.
vtkDelimitedTextCodecIteratorPrivate & operator=(const vtkTypeUInt32 &value) override
Entry point to parse text.
dynamic, self-adjusting array of double
dynamic, self-adjusting array of int
Hold a reference to a vtkObjectBase instance.
a vtkAbstractArray subclass for strings
A table, which contains similar-typed columns of data.
Definition vtkTable.h:169
a base class that any output iterators need to derive from to use the first signature of to_unicode.
int vtkIdType
Definition vtkType.h:315