コード例 #1
0
ファイル: dbustypes.py プロジェクト: jsafrane/dbus2cim
    def post_process(self, interface_prefix, cns, cns_upper, cns_lower, containing_iface):
        if len(self.doc_string) == 0:
            self.doc_string = utils.lookup_docs(self.annotations)
        if len(self.since) == 0:
            self.since = utils.lookup_since(self.annotations)
            if len(self.since) == 0:
                self.since = containing_iface.since

        name = self.name
        overridden_name = utils.lookup_annotation(self.annotations, 'org.gtk.GDBus.C.Name')
        if utils.is_ugly_case(overridden_name):
            self.name_lower = overridden_name.lower()
        else:
            if overridden_name:
                name = overridden_name
            self.name_lower = utils.camel_case_to_uscore(name).lower().replace('-', '_')
        self.name_hyphen = self.name_lower.replace('_', '-')

        arg_count = 0
        for a in self.args:
            a.post_process(interface_prefix, cns, cns_upper, cns_lower, arg_count)
            arg_count += 1

        if utils.lookup_annotation(self.annotations, 'org.freedesktop.DBus.Deprecated') == 'true':
            self.deprecated = True
コード例 #2
0
ファイル: dbustypes.py プロジェクト: jsafrane/dbus2cim
    def post_process(self, interface_prefix, cns, cns_upper, cns_lower, containing_iface):
        if len(self.doc_string) == 0:
            self.doc_string = utils.lookup_docs(self.annotations)
        if len(self.since) == 0:
            self.since = utils.lookup_since(self.annotations)
            if len(self.since) == 0:
                self.since = containing_iface.since

        name = self.name
        overridden_name = utils.lookup_annotation(self.annotations, 'org.gtk.GDBus.C.Name')
        if utils.is_ugly_case(overridden_name):
            self.name_lower = overridden_name.lower()
        else:
            if overridden_name:
                name = overridden_name
            self.name_lower = utils.camel_case_to_uscore(name).lower().replace('-', '_')
        self.name_hyphen = self.name_lower.replace('_', '-')
        # don't clash with the GType getter, e.g.: GType foo_bar_get_type (void); G_GNUC_CONST
        if self.name_lower == 'type':
            self.name_lower = 'type_'

        # recalculate arg
        self.arg.annotations = self.annotations
        self.arg.post_process(interface_prefix, cns, cns_upper, cns_lower, 0)

        if utils.lookup_annotation(self.annotations, 'org.freedesktop.DBus.Deprecated') == 'true':
            self.deprecated = True
コード例 #3
0
    def post_process(self, interface_prefix, c_namespace):
        if len(self.doc_string) == 0:
            self.doc_string = utils.lookup_docs(self.annotations)
        if len(self.since) == 0:
            self.since = utils.lookup_since(self.annotations)

        name = self.name
        overridden_name = utils.lookup_annotation(self.annotations, 'org.gtk.GDBus.C.Name')
        if utils.is_ugly_case(overridden_name):
            self.name_lower = overridden_name.lower()
        else:
            if overridden_name:
                name = overridden_name
            self.name_lower = utils.camel_case_to_uscore(name).lower().replace('-', '_')
        self.name_hyphen = self.name_lower.replace('_', '-')

        arg_count = 0
        for a in self.in_args:
            a.post_process(interface_prefix, c_namespace, arg_count)
            arg_count += 1

        for a in self.out_args:
            a.post_process(interface_prefix, c_namespace, arg_count)
            arg_count += 1

        if utils.lookup_annotation(self.annotations, 'org.freedesktop.DBus.Deprecated') == 'true':
            self.deprecated = True
コード例 #4
0
    def post_process(self, interface_prefix, c_namespace):
        if len(self.doc_string) == 0:
            self.doc_string = utils.lookup_docs(self.annotations)
        if len(self.doc_string_brief) == 0:
            self.doc_string_brief = utils.lookup_brief_docs(self.annotations)
        if len(self.since) == 0:
            self.since = utils.lookup_since(self.annotations)

        overridden_name = utils.lookup_annotation(self.annotations, 'org.gtk.GDBus.C.Name')
        if utils.is_ugly_case(overridden_name):
            name = overridden_name.replace('_', '')
            name_with_ns = c_namespace + name
            self.name_without_prefix = name
            self.camel_name = name_with_ns
            if len(c_namespace) > 0:
                self.ns_upper = utils.camel_case_to_uscore(c_namespace).upper() + '_'
                self.name_lower = utils.camel_case_to_uscore(c_namespace) + '_' + overridden_name.lower()
            else:
                self.ns_upper = ''
                self.name_lower = overridden_name.lower()
            self.name_upper = overridden_name.upper()

            #raise RuntimeError('handle Ugly_Case ', overridden_name)
        else:
            if overridden_name:
                name = overridden_name
            else:
                name = self.name
                if name.startswith(interface_prefix):
                    name = name[len(interface_prefix):]
            self.name_without_prefix = name
            name = utils.strip_dots(name)
            name_with_ns = utils.strip_dots(c_namespace + '.' + name)

            self.camel_name = name_with_ns
            if len(c_namespace) > 0:
                self.ns_upper = utils.camel_case_to_uscore(c_namespace).upper() + '_'
                self.name_lower = utils.camel_case_to_uscore(c_namespace) + '_' + utils.camel_case_to_uscore(name)
            else:
                self.ns_upper = ''
                self.name_lower = utils.camel_case_to_uscore(name_with_ns)
            self.name_upper = utils.camel_case_to_uscore(name).upper()

        self.name_hyphen = self.name_upper.lower().replace('_', '-')

        if utils.lookup_annotation(self.annotations, 'org.freedesktop.DBus.Deprecated') == 'true':
            self.deprecated = True

        for m in self.methods:
            m.post_process(interface_prefix, c_namespace)

        for s in self.signals:
            s.post_process(interface_prefix, c_namespace)

        for p in self.properties:
            p.post_process(interface_prefix, c_namespace)
コード例 #5
0
    def post_process(self, interface_prefix, c_namespace):
        if len(self.doc_string) == 0:
            self.doc_string = utils.lookup_docs(self.annotations)
        if len(self.doc_string_brief) == 0:
            self.doc_string_brief = utils.lookup_brief_docs(self.annotations)
        if len(self.since) == 0:
            self.since = utils.lookup_since(self.annotations)

        overridden_name = utils.lookup_annotation(self.annotations, 'org.gtk.GDBus.C.Name')
        if utils.is_ugly_case(overridden_name):
            name = overridden_name.replace('_', '')
            name_with_ns = c_namespace + name
            self.name_without_prefix = name
            self.camel_name = name_with_ns
            if len(c_namespace) > 0:
                self.ns_upper = utils.camel_case_to_uscore(c_namespace).upper() + '_'
                self.name_lower = utils.camel_case_to_uscore(c_namespace) + '_' + overridden_name.lower()
            else:
                self.ns_upper = ''
                self.name_lower = overridden_name.lower()
            self.name_upper = overridden_name.upper()

            #raise RuntimeError('handle Ugly_Case ', overridden_name)
        else:
            if overridden_name:
                name = overridden_name
            else:
                name = self.name
                if name.startswith(interface_prefix):
                    name = name[len(interface_prefix):]
            self.name_without_prefix = name
            name = utils.strip_dots(name)
            name_with_ns = utils.strip_dots(c_namespace + '.' + name)

            self.camel_name = name_with_ns
            if len(c_namespace) > 0:
                self.ns_upper = utils.camel_case_to_uscore(c_namespace).upper() + '_'
                self.name_lower = utils.camel_case_to_uscore(c_namespace) + '_' + utils.camel_case_to_uscore(name)
            else:
                self.ns_upper = ''
                self.name_lower = utils.camel_case_to_uscore(name_with_ns)
            self.name_upper = utils.camel_case_to_uscore(name).upper()

        self.name_hyphen = self.name_upper.lower().replace('_', '-')

        if utils.lookup_annotation(self.annotations, 'org.freedesktop.DBus.Deprecated') == 'true':
            self.deprecated = True

        for m in self.methods:
            m.post_process(interface_prefix, c_namespace)

        for s in self.signals:
            s.post_process(interface_prefix, c_namespace)

        for p in self.properties:
            p.post_process(interface_prefix, c_namespace)
コード例 #6
0
    def post_process(self, interface_prefix, c_namespace):
        if len(self.doc_string) == 0:
            self.doc_string = utils.lookup_docs(self.annotations)
        if len(self.since) == 0:
            self.since = utils.lookup_since(self.annotations)

        name = self.name
        overridden_name = utils.lookup_annotation(self.annotations, 'org.gtk.GDBus.C.Name')
        if utils.is_ugly_case(overridden_name):
            self.name_lower = overridden_name.lower()
        else:
            if overridden_name:
                name = overridden_name
            self.name_lower = utils.camel_case_to_uscore(name).lower().replace('-', '_')
        if self.name_lower == 'type':
            self.name_lower = 'type_'
        self.name_hyphen = self.name_lower.replace('_', '-')

        # recalculate arg
        self.arg.annotations = self.annotations
        self.arg.post_process(interface_prefix, c_namespace, 0)

        if utils.lookup_annotation(self.annotations, 'org.freedesktop.DBus.Deprecated') == 'true':
            self.deprecated = True
コード例 #7
0
    def post_process(self, interface_prefix, c_namespace):
        if len(self.doc_string) == 0:
            self.doc_string = utils.lookup_docs(self.annotations)
        if len(self.since) == 0:
            self.since = utils.lookup_since(self.annotations)

        name = self.name
        overridden_name = utils.lookup_annotation(self.annotations, 'org.gtk.GDBus.C.Name')
        if utils.is_ugly_case(overridden_name):
            self.name_lower = overridden_name.lower()
        else:
            if overridden_name:
                name = overridden_name
            self.name_lower = utils.camel_case_to_uscore(name).lower().replace('-', '_')
        if self.name_lower == 'type':
            self.name_lower = 'type_'
        self.name_hyphen = self.name_lower.replace('_', '-')

        # recalculate arg
        self.arg.annotations = self.annotations
        self.arg.post_process(interface_prefix, c_namespace, 0)

        if utils.lookup_annotation(self.annotations, 'org.freedesktop.DBus.Deprecated') == 'true':
            self.deprecated = True