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
brokers
tenaBroker
tenaBroker
brokers/tenaBroker/tenaBroker/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 "
dllExport.h
"
13
#include "
csvFileEntry.h
"
14
#include <vl/hostStructs.h>
15
#include <vlutil/vlFilename.h>
16
#include <fstream>
17
18
class
DtCsvFileReader
;
19
20
// class DtCsvFileReader:
21
// Reads in and parses a csv file. Children classes will hold the parsed entries in sorted lists or
22
// hash lists.
23
24
// to use:
25
// a. construct
26
// b. open a stream.
27
// c. read and parse lines
28
// d. close
29
// e. destruct
30
31
typedef
DtCsvFileReader
* (*DtCsvFileReaderCreatorFcn)();
32
33
class
DT_DLL_TENABROKER
DtCsvFileReader
34
{
35
public
:
36
37
static
DtCsvFileReader
* creator();
38
39
// default constructor
40
DtCsvFileReader
();
41
42
// Full-featured constructor
43
DtCsvFileReader
(
const
DtString
& fileName);
44
45
// destructor
46
virtual
~
DtCsvFileReader
();
47
48
// virtual bool openStream(const DtString & fileName);
49
virtual
bool
openStream();
50
virtual
bool
openStream(
const
DtString
& fileName);
51
virtual
void
closeStream();
52
53
// status
54
virtual
bool
isEOF()
const
;
55
virtual
bool
isOpen();
56
57
// name
58
virtual
void
setFilename(
const
DtString
& name);
59
virtual
const
DtString
& filename()
const
;
60
61
// Fills up line with a row from the table
62
63
virtual
bool
readLine(
DtString
& line );
64
65
// Used to read and parse the rest of the table.
66
// Derived Readers should create a derived DtCsvFileEntry
67
// and pass that into parseLine.
68
// The default simply reads a line and returns a generic
69
// DtCsvFileEntry, containing a list of token strings.
70
virtual
DtCsvFileEntry
* readAndParseNextLine(
71
DtCsvFileEntryCreatorFcn
pEntryCreatorFcn);
72
73
// Parses the line and stores data in the entry
74
virtual
void
parseLine(
DtCsvFileEntry
* pEntry,
DtString
& line );
75
76
private
:
77
78
// copy constructor
79
DtCsvFileReader
(
const
DtCsvFileReader
& orig);
80
81
// assignment operator
82
DtCsvFileReader
& operator=(
const
DtCsvFileReader
& orig);
83
84
protected
:
85
86
DtFilename myFilename;
87
std::ifstream myInfile;
88
89
};
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
)