Exemplo n.º 1
0
    def _update_names(self):
        
        prefix = settings.name_prefix.capitalize()

        if self.outer_class is None:
            if self.foreign_cpp_namespace:
                self.full_name = self.foreign_cpp_namespace + '::' + self.name
            else:
                if self._module.cpp_namespace_prefix:
                    if self._module.cpp_namespace_prefix == '::':
                        self.full_name = '::' + self.name
                    else:
                        self.full_name = self._module.cpp_namespace_prefix + '::' + self.name
                else:
                    self.full_name = self.name
        else:
            assert not self.foreign_cpp_namespace
            self.full_name = '::'.join([self.outer_class.full_name, self.name])

        def make_upper(s):
            if s and s[0].islower():
                return s[0].upper()+s[1:]
            else:
                return s

        def flatten(name):
            "make a name like::This look LikeThis"
            return ''.join([make_upper(utils.mangle_name(s)) for s in name.split('::')])

        self.mangled_name = flatten(self.name)
        self.mangled_full_name = utils.mangle_name(self.full_name)

        self.pytypestruct = "Py%s%s_Type" % (prefix,  self.mangled_full_name)
Exemplo n.º 2
0
    def _update_names(self):

        prefix = settings.name_prefix.capitalize()

        if self.outer_class is None:
            if self.foreign_cpp_namespace:
                self.full_name = self.foreign_cpp_namespace + '::' + self.name
            else:
                if self._module.cpp_namespace_prefix:
                    if self._module.cpp_namespace_prefix == '::':
                        self.full_name = '::' + self.name
                    else:
                        self.full_name = self._module.cpp_namespace_prefix + '::' + self.name
                else:
                    self.full_name = self.name
        else:
            assert not self.foreign_cpp_namespace
            self.full_name = '::'.join([self.outer_class.full_name, self.name])

        def make_upper(s):
            if s and s[0].islower():
                return s[0].upper() + s[1:]
            else:
                return s

        def flatten(name):
            "make a name like::This look LikeThis"
            return ''.join(
                [make_upper(utils.mangle_name(s)) for s in name.split('::')])

        self.mangled_name = flatten(self.name)
        self.mangled_full_name = utils.mangle_name(self.full_name)

        self.pytypestruct = "Py%s%s_Type" % (prefix, self.mangled_full_name)
Exemplo n.º 3
0
 def get_c_to_python_type_converter_function_name(self, value_type):
     """
     Internal API, do not use.
     """
     assert isinstance(value_type, TypeHandler)
     ctype = value_type.ctype
     mangled_ctype = utils.mangle_name(ctype)
     converter_function_name = "_wrap_convert_c2py__%s" % mangled_ctype
     return converter_function_name
Exemplo n.º 4
0
 def get_c_to_python_type_converter_function_name(self, value_type):
     """
     Internal API, do not use.
     """
     assert isinstance(value_type, TypeHandler)
     ctype = value_type.ctype
     mangled_ctype = utils.mangle_name(str(ctype))
     converter_function_name = "_wrap_convert_c2py__%s" % mangled_ctype
     return converter_function_name
 def flatten(name):
     "make a name like::This look LikeThis"
     return ''.join([make_upper(utils.mangle_name(s)) for s in name.split('::')])