VR-Forces 5.0.3 Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
tokenizer.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2017 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
8 
11 
12 #pragma once
13 #include <vrfutil/vrfutilDefines.h>
14 
15 #include <fstream>
16 #include <string>
17 #include <vector>
18 
19 
20 
21 using namespace std;
22 
27 {
28 public:
29  DtTokenizer();
30  ~DtTokenizer();
31 
33  void setFilename( const string& filename );
35  void setStream( istream& stream );
36 
38  void setRecordSeparator( const string& separator );
39  void setFieldSeparators( const string& separators );
40  void setQuoteChars( const string& quoteChars );
41  void setEscapeChars( const string& escapeChars );
42  void setSeparatorData( const string& recordSeparator, const string& fieldSeparators = ",",
43  const string& quoteChars = "\"", const string& escapeChars = "\\" );
44 
46  void setTrimWhitespace( bool bTrim );
48  void setAddEmptyTokens( bool bAdd );
49 
51  void setSkipNextRecord( bool bSkip );
52 
56  bool nextRecord( vector<string>& record );
57 
58 protected:
60  virtual bool isEndOfRecord( const string& str );
61 
62 private:
64  void readRecord( string& record );
65 
68  string myQuoteChars;
69  string myEscapeChars;
70 
74 
75  ifstream myFileStream;
76  istream* pMyStream;
77 };
78 
string myRecordSeparator
Definition: tokenizer.h:66
bool mySkipNextRecord
Definition: tokenizer.h:73
ifstream myFileStream
Definition: tokenizer.h:75
string myQuoteChars
Definition: tokenizer.h:68
bool myAddEmptyTokens
Definition: tokenizer.h:72
A generic tokenizer class that can be used to read in a stream of data and parse it into tokens...
Definition: tokenizer.h:26
istream * pMyStream
Definition: tokenizer.h:76
voidpf stream
Definition: ioapi.h:39
bool myTrimWhitespace
Definition: tokenizer.h:71
#define DT_DLL_vrfutil
This file is used to determine how to build Disable inconsistent dll linkage warning Visual Studio 6...
Definition: vrfutilDefines.h:34
string myEscapeChars
Definition: tokenizer.h:69
string myFieldSeparators
Definition: tokenizer.h:67

Document ID: Generated on Thu Jun 1 17:58:13 EDT 2023 from SVN revision 255404
Copyright © 2005-2021 MAK Technologies. All Rights Reserved (www.mak.com)