src
input.cc
Go to the documentation of this file.
1 #include "src/parse/input.h"
2 
3 namespace re2c {
4 
5 Input::Input (const char * fn)
6  : file (NULL)
7  , file_name (fn)
8 {}
9 
10 bool Input::open ()
11 {
12  if (file_name == "<stdin>")
13  {
14  file = stdin;
15  }
16  else
17  {
18  file = fopen (file_name.c_str (), "rb");
19  }
20  return file != NULL;
21 }
22 
24 {
25  if (file != NULL && file != stdin)
26  {
27  fclose (file);
28  }
29 }
30 
31 } // namespace re2c
bool open()
Definition: input.cc:10
~Input()
Definition: input.cc:23
std::string file_name
Definition: input.h:14
Input(const char *fn)
Definition: input.cc:5
FILE * file
Definition: input.h:13
Definition: bitmap.cc:10