VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkDelimitedTextReader.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00015 /*------------------------------------------------------------------------- 00016 Copyright 2008 Sandia Corporation. 00017 Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, 00018 the U.S. Government retains certain rights in this software. 00019 -------------------------------------------------------------------------*/ 00020 00021 00069 #ifndef __vtkDelimitedTextReader_h 00070 #define __vtkDelimitedTextReader_h 00071 00072 #include "vtkIOInfovisModule.h" // For export macro 00073 #include "vtkTableAlgorithm.h" 00074 #include "vtkUnicodeString.h" // Needed for vtkUnicodeString 00075 #include "vtkStdString.h" // Needed for vtkStdString 00076 00077 class VTKIOINFOVIS_EXPORT vtkDelimitedTextReader : public vtkTableAlgorithm 00078 { 00079 public: 00080 static vtkDelimitedTextReader* New(); 00081 vtkTypeMacro(vtkDelimitedTextReader, vtkTableAlgorithm); 00082 void PrintSelf(ostream& os, vtkIndent indent); 00083 00085 00086 vtkGetStringMacro(FileName); 00087 vtkSetStringMacro(FileName); 00089 00091 00095 void SetInputString(const char *in); 00096 vtkGetStringMacro(InputString); 00097 void SetInputString(const char *in, int len); 00098 vtkGetMacro(InputStringLength, int); 00099 void SetInputString(const vtkStdString& input) 00100 { this->SetInputString(input.c_str(), static_cast<int>(input.length())); } 00102 00104 00106 vtkSetMacro(ReadFromInputString,int); 00107 vtkGetMacro(ReadFromInputString,int); 00108 vtkBooleanMacro(ReadFromInputString,int); 00110 00112 00120 vtkGetStringMacro(UnicodeCharacterSet); 00121 vtkSetStringMacro(UnicodeCharacterSet); 00123 00125 00128 void SetUTF8RecordDelimiters(const char* delimiters); 00129 const char* GetUTF8RecordDelimiters(); 00130 void SetUnicodeRecordDelimiters(const vtkUnicodeString& delimiters); 00131 vtkUnicodeString GetUnicodeRecordDelimiters(); 00133 00135 00140 vtkSetStringMacro(FieldDelimiterCharacters); 00141 vtkGetStringMacro(FieldDelimiterCharacters); 00143 00144 void SetUTF8FieldDelimiters(const char* delimiters); 00145 const char* GetUTF8FieldDelimiters(); 00146 void SetUnicodeFieldDelimiters(const vtkUnicodeString& delimiters); 00147 vtkUnicodeString GetUnicodeFieldDelimiters(); 00148 00150 00155 vtkGetMacro(StringDelimiter, char); 00156 vtkSetMacro(StringDelimiter, char); 00158 00159 void SetUTF8StringDelimiters(const char* delimiters); 00160 const char* GetUTF8StringDelimiters(); 00161 void SetUnicodeStringDelimiters(const vtkUnicodeString& delimiters); 00162 vtkUnicodeString GetUnicodeStringDelimiters(); 00163 00165 00166 vtkSetMacro(UseStringDelimiter, bool); 00167 vtkGetMacro(UseStringDelimiter, bool); 00168 vtkBooleanMacro(UseStringDelimiter, bool); 00170 00172 00173 vtkGetMacro(HaveHeaders, bool); 00174 vtkSetMacro(HaveHeaders, bool); 00176 00178 00181 vtkSetMacro(MergeConsecutiveDelimiters, bool); 00182 vtkGetMacro(MergeConsecutiveDelimiters, bool); 00183 vtkBooleanMacro(MergeConsecutiveDelimiters, bool); 00185 00187 00190 vtkGetMacro(MaxRecords, vtkIdType); 00191 vtkSetMacro(MaxRecords, vtkIdType); 00193 00195 00198 vtkSetMacro(DetectNumericColumns, bool); 00199 vtkGetMacro(DetectNumericColumns, bool); 00200 vtkBooleanMacro(DetectNumericColumns, bool); 00202 00204 00207 vtkSetMacro(ForceDouble, bool); 00208 vtkGetMacro(ForceDouble, bool); 00209 vtkBooleanMacro(ForceDouble, bool); 00211 00213 00222 vtkSetMacro(TrimWhitespacePriorToNumericConversion, bool); 00223 vtkGetMacro(TrimWhitespacePriorToNumericConversion, bool); 00224 vtkBooleanMacro(TrimWhitespacePriorToNumericConversion, bool); 00226 00228 00231 vtkSetMacro(DefaultIntegerValue, int); 00232 vtkGetMacro(DefaultIntegerValue, int); 00234 00236 00239 vtkSetMacro(DefaultDoubleValue, double); 00240 vtkGetMacro(DefaultDoubleValue, double); 00242 00244 00246 vtkSetStringMacro(PedigreeIdArrayName); 00247 vtkGetStringMacro(PedigreeIdArrayName); 00249 00251 00253 vtkSetMacro(GeneratePedigreeIds, bool); 00254 vtkGetMacro(GeneratePedigreeIds, bool); 00255 vtkBooleanMacro(GeneratePedigreeIds, bool); 00257 00259 00260 vtkSetMacro(OutputPedigreeIds, bool); 00261 vtkGetMacro(OutputPedigreeIds, bool); 00262 vtkBooleanMacro(OutputPedigreeIds, bool); 00264 00268 vtkStdString GetLastError(); 00269 00271 00274 vtkSetMacro(ReplacementCharacter, vtkTypeUInt32); 00275 vtkGetMacro(ReplacementCharacter, vtkTypeUInt32); 00277 00278 //BTX 00279 protected: 00280 vtkDelimitedTextReader(); 00281 ~vtkDelimitedTextReader(); 00282 00283 int RequestData( 00284 vtkInformation*, 00285 vtkInformationVector**, 00286 vtkInformationVector*); 00287 00288 char* FileName; 00289 int ReadFromInputString; 00290 char *InputString; 00291 int InputStringLength; 00292 char* UnicodeCharacterSet; 00293 vtkIdType MaxRecords; 00294 vtkUnicodeString UnicodeRecordDelimiters; 00295 vtkUnicodeString UnicodeFieldDelimiters; 00296 vtkUnicodeString UnicodeStringDelimiters; 00297 vtkUnicodeString UnicodeWhitespace; 00298 vtkUnicodeString UnicodeEscapeCharacter; 00299 bool DetectNumericColumns; 00300 bool ForceDouble; 00301 bool TrimWhitespacePriorToNumericConversion; 00302 int DefaultIntegerValue; 00303 double DefaultDoubleValue; 00304 char* FieldDelimiterCharacters; 00305 char StringDelimiter; 00306 bool UseStringDelimiter; 00307 bool HaveHeaders; 00308 bool UnicodeOutputArrays; 00309 bool MergeConsecutiveDelimiters; 00310 char* PedigreeIdArrayName; 00311 bool GeneratePedigreeIds; 00312 bool OutputPedigreeIds; 00313 vtkStdString LastError; 00314 vtkTypeUInt32 ReplacementCharacter; 00315 00316 private: 00317 vtkDelimitedTextReader(const vtkDelimitedTextReader&); // Not implemented 00318 void operator=(const vtkDelimitedTextReader&); // Not implemented 00319 //ETX 00320 }; 00321 00322 #endif 00323