-
Notifications
You must be signed in to change notification settings - Fork 296
Expand file tree
/
Copy pathSingleLineDelimTextFileReader.h
More file actions
62 lines (50 loc) · 1.67 KB
/
SingleLineDelimTextFileReader.h
File metadata and controls
62 lines (50 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
* SingleLineTextFileReader.h
*
* Created on: Nov 8, 2012
* Author: nek3d
*/
#ifndef SINGLELINETEXTFILEREADER_H_
#define SINGLELINETEXTFILEREADER_H_
#include <algorithm>
#include <stdint.h>
#include "FileReader.h"
#include "string.h"
#include "lineFileUtilities.h"
typedef int64_t CHRPOS;
class SingleLineDelimTextFileReader : public FileReader {
public:
//Allow VCF records to access a specialized private method.
//See end of class declaration for details.
friend class VcfRecord;
SingleLineDelimTextFileReader(int numFields, char delimChar = '\t');
~SingleLineDelimTextFileReader();
virtual bool readEntry();
virtual int getNumFields() const { return _numFields; }
virtual void getField(int numField, string &val) const;
virtual void getField(int numField, CHRPOS &val) const; //this signaiture isn't const because it operates on an internal string for speed.
virtual void getField(int fieldNum, char &val) const;
virtual void appendField(int fieldNum, string &str) const;
virtual const string &getHeader() const { return _header; }
virtual bool hasHeader() const { return _fullHeaderFound; }
virtual void setInHeader(bool val) { _inheader = val; }
protected:
int _numFields;
char _delimChar;
string _header;
bool _fullHeaderFound;
int _currDataPos;
string _sLine;
int *_delimPositions;
string _currChromStr;
string _tempChrPosStr;
int _lineNum;
bool _inheader;
bool detectAndHandleHeader();
bool findDelimiters();
//This is actually a very specialized function strictly for VCF
//records to read and process extra information about Structural Variants.
static const int VCF_TAG_FIELD = 7;
CHRPOS getVcfSVlen();
};
#endif /* SINGLELINETEXTFILEREADER_H_ */