VR-Exchange 2.5 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 };

Document ID: Generated on Wed Dec 21 15:05:11 EST 2016 from SVN revision 171891
Copyright © 2005-2016 VT MÄK. All Rights Reserved (www.mak.com)