Mac binaries
[jabaws.git] / website / archive / binaries / mac / src / clustalw / src / fileInput / FileParser.h
1 /**
2  * Author: Mark Larkin
3  * 
4  * Copyright (c) 2007 Des Higgins, Julie Thompson and Toby Gibson.  
5  */
6 /** The aim of this class is to return one sequence at a time.
7  * Note that the file must be open when it is passed to the FileParser.
8  * The parser does not know the name of the file to open. Only the filereader knows.
9  *
10  * Changes: 
11  *
12  * Mark 24-1-2007. I added the function findDelimiter to determine if '\r' or '\n' 
13  * will be used as the line delimiter when parsing the file.
14  *
15  * 10-02-07,Nigel Brown(EMBL): Removed delimiter and findDelimiter()
16  * members, as functionality now handled by the stream class.
17  */
18 #ifndef FILEPARSER_H
19 #define FILEPARSER_H
20
21 #include <ctype.h>
22 #include "../alignment/Sequence.h"
23 #include "../general/userparams.h"
24 #include <iostream>
25 #include "InFileStream.h"
26
27 namespace clustalw
28 {
29  
30 class FileParser
31 {
32     public:
33         /* Functions */
34         FileParser();
35         virtual ~FileParser();
36         virtual vector<Sequence> getSeqRange(int firstSeq, int num, string *offendingSeq) = 0;
37         virtual Sequence getSeq(int seqNum, string *offendingSeq=NULL) = 0;
38         virtual int countSeqs() = 0; // VIRTUAL 
39         virtual void getSecStructure(vector<char>& gapPenaltyMask, 
40                                      vector<char>& secStructMask,
41                                      string& secStructName, int &structPenalties, int length) = 0;
42         void fillCharTab(void);
43         char getDelimiter(string filename);
44         /* Attributes */
45         char chartab[128];
46         int getParseExitCode() { return parseExitCode; };
47         
48     protected:
49         void freeFileResources(InFileStream* filePtr);
50         InFileStream* _fileIn;
51         int parseExitCode; // reason for returning empty sequence
52                            // vector; same as used in FileReader
53
54     private:
55         /* Functions */
56
57         /* Attributes */
58
59 };
60
61 }
62 #endif
63