File: scanner.cc

package info (click to toggle)
stealth 1.45-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 716 kB
  • ctags: 175
  • sloc: cpp: 1,612; makefile: 88; sh: 70
file content (35 lines) | stat: -rw-r--r-- 1,200 bytes parent folder | download
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
#include "scanner.ih"

/*
    Since the Scanner's destruction is also the termination of the program, no
explicit destruction of the newly created objects is necessary. A pointer is
used to prevent the construction of a constant object. As the constructor
itself would create a constant object, the construction *new... 
is used.

*/

Scanner::Scanner(ConfigSorter &sorter, Reporter &reporter)
:
    d_sorter(sorter),
    d_reporter(reporter),                       // ostream
    d_firstWord(*new Pattern("(\\S+)(\\s+(.*))?")),// firstword ([1]) and 
                                                // the rest ([3]) of a text
    d_sshFork
    (
        d_sorter["SSH"], 
        Process::CIN | Process::COUT | Process::IGNORE_CERR
    ),                 // child: ignores stderr, reads
    d_shFork
    (
        d_sorter["SH"],
        Process::CIN | Process::COUT | Process::IGNORE_CERR
    ),                   // from stdin/stdout
                                                // parent process communicates
                                                // via the Fork object's 
                                                // stream interface.
    d_nScans(0)
{
    setSentinel();
}