~ubuntu-branches/ubuntu/utopic/cccc/utopic

« back to all changes in this revision

Viewing changes to pccts/h/BufFileInput.h

  • Committer: Bazaar Package Importer
  • Author(s): Colin Watson
  • Date: 2003-08-23 04:34:05 UTC
  • Revision ID: james.westby@ubuntu.com-20030823043405-xnzd3mn3hwtvi6dr
Tags: upstream-3.pre81
ImportĀ upstreamĀ versionĀ 3.pre81

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// FILE:        BufFileInput.h
 
2
// AUTHOR:      Alexey Demakov (AVD) demakov@kazbek.ispras.ru
 
3
// CREATION:    26-JAN-1998
 
4
// DESCRIPTION: File Input Stream with lookahead for Scanner
 
5
// Tested under Win32 with ANTLR 1.33 MR10 and MSVC 5.0
 
6
 
 
7
// Change History:
 
8
//
 
9
//   28-May-1998    Add virtual destructor to release buffer
 
10
//                  Manfred Kogler (km@cast.uni-linz.ac.at)
 
11
//                  (1.33MR14)
 
12
 
 
13
#ifndef BufFileInput_h
 
14
#define BufFileInput_h
 
15
 
 
16
#include "pcctscfg.h"
 
17
 
 
18
#include "pccts_stdio.h"
 
19
 
 
20
PCCTS_NAMESPACE_STD
 
21
 
 
22
#include "DLexerBase.h"
 
23
 
 
24
class DllExportPCCTS BufFileInput : public DLGInputStream
 
25
{
 
26
public:
 
27
    // constructor
 
28
    // f - input stream
 
29
    // buf_size - size of buffer (maximal length for string in is_in)
 
30
 
 
31
    BufFileInput(FILE *f, int buf_size = 8 );
 
32
 
 
33
    virtual ~BufFileInput();
 
34
 
 
35
    // gets next char from stream
 
36
 
 
37
    virtual int nextChar( void );
 
38
 
 
39
    // looks in stream and compares next l characters with s
 
40
    // returns the result of comparision
 
41
 
 
42
    int lookahead( char* s );
 
43
 
 
44
private:
 
45
    FILE *input; // input stream;
 
46
    int* buf;    // buffer
 
47
    int  size;   // size of buffer
 
48
    int  start;  // position of the first symbol in buffer
 
49
    int  len;    // count of characters in buffers
 
50
};
 
51
 
 
52
#endif
 
53
// end of file BufFileInput.h