msa
git-svn-id: file:///home/git/hedgehog.fhcrc.org/bioconductor/trunk/madman/Rpacks/msa@102253 bc3139a8-67e5-0310-9ffc-ced21a209358
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,53 @@ |
1 |
+/** |
|
2 |
+ * Author: Nigel Brown |
|
3 |
+ * |
|
4 |
+ * Copyright (c) 2007 Des Higgins, Julie Thompson and Toby Gibson. |
|
5 |
+ */ |
|
6 |
+/** |
|
7 |
+ * InFileStream subclasses std::ifstream, adding a check for the end-of-line |
|
8 |
+ * character convention in the input file. This is then used by the getline() |
|
9 |
+ * member as the line delimiter, unless the caller supplies an explicit |
|
10 |
+ * delimiter. |
|
11 |
+ * |
|
12 |
+ * Created: 09-02-07,Nigel Brown(EMBL) |
|
13 |
+ ***************************************************************************/ |
|
14 |
+#ifndef INFILESTREAM_H |
|
15 |
+#define INFILESTREAM_H |
|
16 |
+ |
|
17 |
+#include <string> |
|
18 |
+#include <fstream> |
|
19 |
+#include <iostream> |
|
20 |
+#include <memory> |
|
21 |
+ |
|
22 |
+class InFileStream : public std::ifstream |
|
23 |
+{ |
|
24 |
+ public: |
|
25 |
+ InFileStream(); |
|
26 |
+ InFileStream(const char *filename); |
|
27 |
+ //- InFileStream(const InFileStream ©); |
|
28 |
+ |
|
29 |
+ void open(const char *filename); |
|
30 |
+ void close(); |
|
31 |
+ |
|
32 |
+ //int get(); |
|
33 |
+ //bool is_open(); |
|
34 |
+ std::istream& getline(char *s, std::streamsize n);/*{return ifstream::getline(s, n, delim);}*/ |
|
35 |
+ std::istream& getline(char *s, std::streamsize n, char delim); |
|
36 |
+ /*{ |
|
37 |
+ return ifstream::getline(s, n, delim); |
|
38 |
+ }*/ |
|
39 |
+ |
|
40 |
+ protected: |
|
41 |
+ char findDelimiter(); |
|
42 |
+ |
|
43 |
+ private: |
|
44 |
+ //disable copy-constructor |
|
45 |
+ InFileStream(const InFileStream ©); |
|
46 |
+ std::string filename; |
|
47 |
+ //auto_ptr<ifstream> inFile; |
|
48 |
+ char delim; |
|
49 |
+}; |
|
50 |
+ |
|
51 |
+#endif //INFILESTREAM_H |
|
52 |
+ |
|
53 |
+ |