コード例 #1
0
    def _write_source(self, writer, elem):
        
        file_name = self._file_name_manager.get_source_name(elem)
        file_path = self._outdir + os.sep + file_name

        if self.verbose:
            print "generating file %s..." % file_path,
        
        writer.set_user_content(file_path)
        
        if isinstance(writer, GObjectWriter) or isinstance(writer, GInterfaceWriter):
            writer.annotations.load_from_file(file_path)
        
        file_out = FileOut(file_path)
        
        saved_out = writer.get_output()
        writer.set_output(file_out)
        
        file_out.open()
        writer.write_source()
        file_out.close()
        
        writer.set_output(saved_out)

        if self.verbose:
            print "done"
コード例 #2
0
    def _write_marshaller_code(self, writer, elem, for_header):
        
        if for_header:
            file_name = self._file_name_manager.get_marshaller_header_name(elem)
        else:
            file_name = self._file_name_manager.get_marshaller_source_name(elem)
            
        file_path = self._outdir + os.sep + file_name
        file_out = FileOut(file_path)

        if self.verbose:
            print "generating file %s..." % file_path,
            
        saved_out = writer.get_output()
        writer.set_output(file_out)
        
        file_out.open()
        
        marshaller_gen = MarshallerGenerator(elem)
        lines = marshaller_gen.get_code(for_header)
        
        for line in lines:
            writer.writeln(line)
        writer.writeln()
        file_out.close()
        
        writer.set_output(saved_out)
        
        if self.verbose:
            print "done"
コード例 #3
0
    def _write_protected_header(self, writer, elem):
        
        file_name = self._file_name_manager.get_protected_header_name(elem)
        file_path = self._outdir + os.sep + file_name

        if self.verbose:
            print "generating file %s..." % file_path,
        
        writer.set_user_content(file_path)
        
        file_out = FileOut(file_path)
        
        saved_out = writer.get_output()
        writer.set_output(file_out)
        
        file_out.open()
        writer.write_header_protected()
        file_out.close()
        
        writer.set_output(saved_out)

        if self.verbose:
            print "done"