root/branches/Carsten_PtrWork2/Tools/fcd2code/TemplateReader.py

Revision 423, 0.9 kB (checked in by cneumann, 2 years ago)

changed: - improved formatting of description text for comments

and inclusion into runtime.

  • moved description for class Foo into FooBase?.cpp
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1
2 import logging;
3
4 class TemplateReader:
5     """Simple helper for loading a template file.
6     """
7
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    = [];
14    
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, "r");
21        
22         self.m_log.debug("read: reading template.");
23         self.m_lines = fileObj.readlines();
24        
25         self.m_log.debug("read: closing file.");
26         fileObj.close();
27        
28         return self.m_lines[:];
29    
Note: See TracBrowser for help on using the browser.