VR-Exchange 2.4 API Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
include
broker
include/broker/csvFileRdr.h
Go to the documentation of this file.
1
/*****************************************************************************
2
* Copyright (c) 2013 VT MAK
3
* All rights reserved.
4
****************************************************************************/
5
9
10
#pragma once
11
12
#include <fstream>
13
14
#include <vl/hostStructs.h>
15
#include <vlutil/vlFilename.h>
16
17
#include <
broker/csvFileEntry.h
>
18
19
class
DtCsvFileReader
;
20
21
// class DtCsvFileReader:
22
// Reads in and parses a csv file. Children classes will hold the parsed entries in sorted lists or
23
// hash lists.
24
25
// to use:
26
// a. construct
27
// b. open a stream.
28
// c. read and parse lines
29
// d. close
30
// e. destruct
31
32
typedef
DtCsvFileReader
* (*DtCsvFileReaderCreatorFcn)();
33
34
class
DT_DLL_BROKER
DtCsvFileReader
35
{
36
public
:
37
38
static
DtCsvFileReader
* creator();
39
40
// default constructor
41
DtCsvFileReader
();
42
43
// Full-featured constructor
44
DtCsvFileReader
(
const
DtString
& fileName);
45
46
// destructor
47
virtual
~
DtCsvFileReader
();
48
49
// virtual bool openStream(const DtString & fileName);
50
virtual
bool
openStream();
51
virtual
bool
openStream(
const
DtString
& fileName);
52
virtual
void
closeStream();
53
54
// status
55
virtual
bool
isEOF()
const
;
56
virtual
bool
isOpen();
57
58
// name
59
virtual
void
setFilename(
const
DtString
& name);
60
virtual
const
DtString
& filename()
const
;
61
62
// Fills up line with a row from the table
63
64
virtual
bool
readLine(
DtString
& line );
65
66
// Used to read and parse the rest of the table.
67
// Derived Readers should create a derived DtCsvFileEntry
68
// and pass that into parseLine.
69
// The default simply reads a line and returns a generic
70
// DtCsvFileEntry, containing a list of token strings.
71
virtual
DtCsvFileEntry
* readAndParseNextLine(
72
DtCsvFileEntryCreatorFcn
pEntryCreatorFcn);
73
74
// Parses the line and stores data in the entry
75
virtual
void
parseLine(
DtCsvFileEntry
* pEntry,
DtString
& line );
76
77
private
:
78
79
// copy constructor
80
DtCsvFileReader
(
const
DtCsvFileReader
& orig);
81
82
// assignment operator
83
DtCsvFileReader
& operator=(
const
DtCsvFileReader
& orig);
84
85
protected
:
86
87
DtFilename
myFilename
;
88
std::ifstream
myInfile
;
89
90
};
Document ID: Generated on Thu Jul 23 10:25:22 EDT 2015 from SVN revision 155065
Copyright © 2005-2014 VT MÄK. All Rights Reserved (
www.mak.com
)