Beispiel #1
0
    def __init__(self,
                 output_cpp,
                 output_h,
                 header_path,
                 output_tcc=None,
                 tcc_path=None):
        self._output_cpp = output_cpp
        self._output_h = output_h
        self._header_path = header_path
        outputs = [output_cpp, output_h]
        # if we define a tcc output, make sure tcc path is passed as well
        assert (output_tcc is None) == (tcc_path is None)
        self._templates = output_tcc is not None
        if self._templates:
            self._output_tcc = output_tcc
            self._tcc_path = tcc_path
            outputs.append(output_tcc)
        else:
            self._output_tcc = DummyOutput()

        cpp_scope_factory = create_scope_factory(CppScope, self._output_cpp)
        h_scope_factory = create_scope_factory(CppScope, self._output_h)
        tcc_scope_factory = create_scope_factory(CppScope, self._output_tcc)
        # accessors in the context to get a scope
        self._output_cpp.make_scope = cpp_scope_factory
        self._output_h.make_scope = h_scope_factory
        self._output_tcc.make_scope = tcc_scope_factory

        # shorthand to write to all outputs at the same time
        self._all_outputs = CompositeOutput(*outputs)
        # start writing in the header
        self.output = output_h
Beispiel #2
0
    def __init__(self, output_cpp, output_h, header_path, output_tcc=None,
                 tcc_path=None):
        self._output_cpp = output_cpp
        self._output_h = output_h
        self._header_path = header_path
        outputs = [output_cpp, output_h]
        # if we define a tcc output, make sure tcc path is passed as well
        assert (output_tcc is None) == (tcc_path is None)
        self._templates = output_tcc is not None
        if self._templates:
            self._output_tcc = output_tcc
            self._tcc_path = tcc_path
            outputs.append(output_tcc)
        else:
            self._output_tcc = DummyOutput()

        cpp_scope_factory = create_scope_factory(CppScope, self._output_cpp)
        h_scope_factory = create_scope_factory(CppScope, self._output_h)
        tcc_scope_factory = create_scope_factory(CppScope, self._output_tcc)
        # accessors in the context to get a scope
        self._output_cpp.make_scope = cpp_scope_factory
        self._output_h.make_scope = h_scope_factory
        self._output_tcc.make_scope = tcc_scope_factory

        # shorthand to write to all outputs at the same time
        self._all_outputs = CompositeOutput(*outputs)
        # start writing in the header
        self.output = output_h
Beispiel #3
0
    def __init__(self,
                 output_cpp,
                 output_h,
                 output_tcc,
                 header_path,
                 additional_outputs=[],
                 custom_protocol_h=None):
        self.omit_include = False
        self._output_cpp = output_cpp
        self._output_h = output_h
        self._output_tcc = output_tcc
        self._additional_outputs = additional_outputs
        self._custom_protocol_h = custom_protocol_h
        self._header_path = header_path
        outputs = [output_h]
        if output_cpp:
            outputs.append(output_cpp)
        if output_tcc:
            outputs.append(output_tcc)
        outputs.extend(additional_outputs)

        for output in outputs:
            output.make_scope = create_scope_factory(CppScope, output)

        # shorthand to write to all outputs at the same time
        self._all_outputs = CompositeOutput(*outputs)
        # start writing in the header
        self.output = output_h
Beispiel #4
0
    def __init__(self, output_h, header_path):
        self._output_h = output_h
        self._header_path = header_path
        outputs = [output_h]

        for output in outputs:
            output.make_scope = create_scope_factory(CppScope, output)

        # shorthand to write to all outputs at the same time
        self._all_outputs = CompositeOutput(*outputs)
        # start writing in the header
        self.output = output_h
Beispiel #5
0
    def __init__(self, output_cpp, output_h, output_tcc, header_path):
        self._output_cpp = output_cpp
        self._output_h = output_h
        self._output_tcc = output_tcc
        self._header_path = header_path
        outputs = [output_cpp, output_h]

        if output_tcc:
            outputs.append(output_tcc)

        for output in outputs:
            output.make_scope = create_scope_factory(CppScope, output)

        # shorthand to write to all outputs at the same time
        self._all_outputs = CompositeOutput(*outputs)
        # start writing in the header
        self.output = output_h
Beispiel #6
0
    def __init__(self,
                 output_cpp,
                 output_h,
                 output_tcc,
                 header_path,
                 additional_outputs=[]):
        self._output_cpp = output_cpp
        self._output_h = output_h
        self._output_tcc = output_tcc
        self._additional_outputs = additional_outputs
        self._header_path = header_path
        outputs = [output_cpp, output_h] + additional_outputs

        if output_tcc:
            outputs.append(output_tcc)

        for output in outputs:
            output.make_scope = create_scope_factory(CppScope, output)

        # shorthand to write to all outputs at the same time
        self._all_outputs = CompositeOutput(*outputs)
        # start writing in the header
        self.output = output_h