Пример #1
0
class CurrentTranslationUnitAccess(object):
    def __init__(self, translation_unit_accessor):
        self._translation_unit_accessor = translation_unit_accessor
        self._listeners = []
        self._worker = SingleResultWorker(self._process)

    def terminate(self):
        self._worker.terminate()

    def file_changed(self, file):
        self._worker.request(file)

    def add_listener(self, listener):
        self._listeners.append(listener)

    def _process(self, file):

        def do_it(translation_unit):
            for listener in self._listeners:
                listener(translation_unit)

        self._translation_unit_accessor.clear_caches()
        self._translation_unit_accessor.translation_unit_do(file, do_it)
Пример #2
0
 def __init__(self, translation_unit_accessor):
     self._translation_unit_accessor = translation_unit_accessor
     self._listeners = []
     self._worker = SingleResultWorker(self._process)