VR-Exchange 2.7 API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
csvFileRdr.h
Go to the documentation of this file.
1 /****************************************************************************
2  * Copyright (c) 2016 VT MAK
3  * All rights reserved.
4  ****************************************************************************/
5 
9 
10 #pragma once
11 
12 #include <broker/csvFileEntry.h>
13 #include <vlutil/vlFilename.h>
14 #include <vl/hostStructs.h>
15 #include <fstream>
16 
17 class DtCsvFileReader;
18 
19 typedef DtCsvFileReader* (*DtCsvFileReaderCreatorFcn)();
20 
27 {
28 public:
29 
31  static DtCsvFileReader* creator();
32 
35 
37  DtCsvFileReader( const DtString& fileName );
38 
40  virtual ~DtCsvFileReader();
41 
44 
45  virtual bool openStream();
46  virtual bool openStream( const DtString& fileName );
47  virtual void closeStream();
48 
50 
53 
54  virtual bool isEOF() const;
55  virtual bool isOpen();
56 
58 
61 
62  virtual void setFilename(const DtString& name);
63  virtual const DtString& filename() const;
64 
66 
67  // Used to read and parse the rest of the table.
68  // Derived Readers should create a derived DtCsvFileEntry
69  // and pass that into parseLine.
70  // The default simply reads a line and returns a generic
71  // DtCsvFileEntry, containing a list of token strings.
72  virtual DtCsvFileEntry* readAndParseNextLine(
73  DtCsvFileEntryCreatorFcn pEntryCreatorFcn );
74 
75 protected:
76 
78  virtual bool readLine( DtString& line );
79 
81  virtual void parseLine( DtCsvFileEntry* pEntry, DtString& line );
82 
83 private:
84 
85  // copy constructor
86  DtCsvFileReader( const DtCsvFileReader& orig );
87 
88  // assignment operator
89  DtCsvFileReader& operator = ( const DtCsvFileReader& orig );
90 
91 protected:
92 
93  DtFilename myFilename;
94  std::ifstream myInfile;
95 
96 };
std::ifstream myInfile
Definition: csvFileRdr.h:94
Contains the DtCsvFileEntry class declaration.
Reads in and parses a csv file.
Definition: csvFileRdr.h:26
#define DT_DLL_BROKER
Definition: include/broker/dllExport.h:20
DtCsvFileEntry *(* DtCsvFileEntryCreatorFcn)()
Definition: csvFileEntry.h:18
A generic class that represents the entries that are parsed out of a csv file by the csv file reader...
Definition: csvFileEntry.h:24
DtFilename myFilename
Definition: csvFileRdr.h:93

Document ID: Generated on Mon Apr 19 15:55:22 EDT 2021 from SVN revision 227909
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)