fixed: gcc8 compile issues
[opensg.git] / Tools / fcd2code / TemplateReader.py
blob40b6e2b93a76454f60a757cafd5039a9cef90f5b
2 import logging;
4 class TemplateReader:
5 """Simple helper for loading a template file.
6 """
8 def __init__(self, fileName):
9 """Creates a new TemplateReader for the given template file fileName.
10 """
11 self.m_log = logging.getLogger("TemplateReader");
12 self.m_fileName = fileName;
13 self.m_lines = [];
15 def read(self):
16 """Loads the template file specified in the constructor and returns a
17 list of strings, each a line of the template file contents.
18 """
19 self.m_log.debug("read: Opening file \"%s\"." % self.m_fileName);
20 fileObj = open(self.m_fileName, "rb");
22 self.m_log.debug("read: reading template.");
23 self.m_lines = fileObj.readlines();
25 self.m_log.debug("read: closing file.");
26 fileObj.close();
28 return self.m_lines[:];