Exemple #1
0
 def add_deref(
   self,
   returns,
   this_access = ThisAccess.const,
   kl_method_name = 'cxx_deref',
   ):
   assert isinstance(kl_method_name, basestring)
   assert isinstance(returns, basestring)
   if this_access == ThisAccess.const:
     assert not self.const_deref_kl_method_name
     self.const_deref_kl_method_name = kl_method_name
     self.const_deref_result = ResultCodec(
       self.ext.type_mgr.get_dqti(
         self.resolve_cpp_type_expr(returns)
         )
       )
   else:
     assert not self.mutable_deref_kl_method_name
     self.mutable_deref_kl_method_name = kl_method_name
     self.mutable_deref_result = ResultCodec(
       self.ext.type_mgr.get_dqti(
         self.resolve_cpp_type_expr(returns)
         )
       )
   return self
Exemple #2
0
    def __init__(
        self,
        parent_namespace,
        cpp_global_name,
        kl_global_name,
        returns_cpp_type_expr,
        params,
        promotion_prolog=None,
        dfg_preset_omit=False,
    ):
        Decl.__init__(
            self,
            parent_namespace,
        )

        self.cpp_global_name = cpp_global_name
        self.kl_global_name = kl_global_name

        self.result = ResultCodec(
            self.type_mgr.get_dqti(
                self.cpp_type_expr_parser.parse(returns_cpp_type_expr)))
        self.params = []
        for param_index in range(0, len(params)):
            param = params[param_index]
            param_codec = param.gen_codec(param_index,
                                          parent_namespace.resolve_dqti)
            if not param_codec:
                raise Exception("cannot parse type for parameter %d" %
                                (param_index + 1))
            self.params.append(param_codec)
        self.comments = []
        self.promotion_prolog = promotion_prolog
        self.dfg_preset_omit = dfg_preset_omit
Exemple #3
0
 def __init__(
   self,
   record,
   cpp_name,
   returns,
   params,
   this_access,
   kl_name=None,
   promotion_prolog=None,
   dfg_preset_omit=False,
   virtuality=Virtuality.local,
   ):
   Methodlike.__init__(self, record)
   self.cpp_name = cpp_name
   if not kl_name:
     kl_name = cpp_name
   self.kl_name = kl_name
   self.clean_kl_name = clean_method_name(kl_name)
   self.clean_cxx_kl_name = clean_cxx_method_name(kl_name)
   self.result = ResultCodec(record.resolve_dqti(returns))
   self.params = [param.gen_codec(index, record.resolve_dqti) for index, param in enumerate(params)]
   self.this_access = this_access
   self.is_const = self.this_access == ThisAccess.const
   self.is_mutable = self.this_access == ThisAccess.mutable
   self.is_static = self.this_access == ThisAccess.static
   self.promotion_prolog = promotion_prolog
   self.dfg_preset_omit = dfg_preset_omit
   self.virtuality = virtuality
Exemple #4
0
  def __init__(
    self,
    parent_namespace,
    op,
    returns_cpp_type_expr,
    params,
    ):
    Decl.__init__(
      self,
      parent_namespace,
      )

    self.op = op

    self.result = ResultCodec(
      self.type_mgr.get_dqti(
        self.cpp_type_expr_parser.parse(returns_cpp_type_expr)
        )
      )
    self.params = []
    for param_index in range(0, len(params)):
      param = params[param_index]
      param_codec = param.gen_codec(param_index, parent_namespace.resolve_dqti)
      if not param_codec:
        raise Exception("cannot parse type for parameter %d" % (param_index + 1))
      self.params.append(param_codec)
    self.comments = []
Exemple #5
0
 def add_get_ind_op(self,
                    value_cpp_type_name,
                    param_cpp_type_name='size_t',
                    this_access=ThisAccess.const):
     self.get_ind_op_result = ResultCodec(
         self.ext.type_mgr.get_dqti(
             self.resolve_cpp_type_expr(value_cpp_type_name)))
     self.get_ind_op_params = [
         ParamCodec(
             self.ext.type_mgr.get_dqti(
                 self.resolve_cpp_type_expr(param_cpp_type_name)), 'index'),
     ]
     self.get_ind_op_this_access = this_access
     return self
Exemple #6
0
 def __init__(
   self,
   record,
   returns,
   params,
   this_access,
   kl_name=None,
   ):
   Methodlike.__init__(self, record)
   self.result = ResultCodec(record.resolve_dqti(returns))
   self.params = [param.gen_codec(index, record.resolve_dqti) for index, param in enumerate(params)]
   self.this_access = this_access
   self.is_const = self.this_access == ThisAccess.const
   self.is_mutable = self.this_access == ThisAccess.mutable
   self.is_static = self.this_access == ThisAccess.static
Exemple #7
0
 def __init__(
   self,
   record,
   result_type,
   op,
   params,
   ):
   Methodlike.__init__(self, record)
   self.resolve_cpp_type_expr = record.resolve_cpp_type_expr
   self.result = ResultCodec(
     self.ext.type_mgr.get_dqti(
       self.resolve_cpp_type_expr(result_type)
       )
     )
   self.op = op
   self.params = [param.gen_codec(index, record.resolve_dqti) for index, param in enumerate(params)]
Exemple #8
0
 def __init__(
     self,
     record,
     op,
     kl_method_name,
     result_cpp_type_name,
 ):
     Methodlike.__init__(self, record)
     self.resolve_cpp_type_expr = record.resolve_cpp_type_expr
     assert isinstance(kl_method_name, basestring)
     self.kl_method_name = kl_method_name
     self.op = op
     assert isinstance(result_cpp_type_name, basestring)
     self.result = ResultCodec(
         self.ext.type_mgr.get_dqti(
             self.resolve_cpp_type_expr(result_cpp_type_name)))
Exemple #9
0
 def __init__(
   self,
   record,
   cpp_name,
   dqti,
   getter_kl_name,
   setter_kl_name,
   visibility,
   ):
   self.record = record
   self.cpp_name = cpp_name
   self.kl_name = cpp_name
   self.type_info = dqti.type_info
   self.result = ResultCodec(dqti)
   self.param = ParamCodec(dqti, cpp_name)
   self.getter_kl_name = getter_kl_name
   if not self.getter_kl_name is None and self.getter_kl_name == '':
     self.getter_kl_name = 'get_' + cpp_name
   self.setter_kl_name = setter_kl_name
   if not self.setter_kl_name is None and self.setter_kl_name == '':
     self.setter_kl_name = 'set_' + cpp_name
   self.visibility = visibility