File: InFileStream.h

package info (click to toggle)
clustalx 2.1%2Blgpl-8
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 3,320 kB
  • sloc: cpp: 40,050; sh: 163; xml: 102; makefile: 16
file content (53 lines) | stat: -rw-r--r-- 1,311 bytes parent folder | download | duplicates (12)
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
/**
 * Author: Nigel Brown
 * 
 * Copyright (c) 2007 Des Higgins, Julie Thompson and Toby Gibson.  
 */
/**
 * InFileStream subclasses std::ifstream, adding a check for the end-of-line
 * character convention in the input file. This is then used by the getline()
 * member as the line delimiter, unless the caller supplies an explicit
 * delimiter.
 *
 * Created: 09-02-07,Nigel Brown(EMBL)
 ***************************************************************************/
#ifndef INFILESTREAM_H
#define INFILESTREAM_H

#include <string>
#include <fstream>
#include <iostream>
#include <memory>

class InFileStream : public std::ifstream
{
  public:
    InFileStream();
    InFileStream(const char *filename);
    //- InFileStream(const InFileStream &copy);

    void open(const char *filename);
    void close();

    //int get();
    //bool is_open();
    std::istream& getline(char *s, std::streamsize n);/*{return ifstream::getline(s, n, delim);}*/
    std::istream& getline(char *s, std::streamsize n, char delim);
    /*{
        return ifstream::getline(s, n, delim);
    }*/

  protected:
    char findDelimiter();

  private:
    //disable copy-constructor
    InFileStream(const InFileStream &copy);
    std::string filename;
    //auto_ptr<ifstream> inFile;
    char delim;
};

#endif //INFILESTREAM_H