当前位置: 首页>>代码示例>>C++>>正文


C++ AST_Decl::name方法代码示例

本文整理汇总了C++中AST_Decl::name方法的典型用法代码示例。如果您正苦于以下问题:C++ AST_Decl::name方法的具体用法?C++ AST_Decl::name怎么用?C++ AST_Decl::name使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AST_Decl的用法示例。


在下文中一共展示了AST_Decl::name方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: assert

DDS_StdString
be_Type::EnclosingScopeString(AST_Decl * decl)
{
   DDS_StdString ret;

   assert(decl);

   if (decl)
   {
      UTL_Scope * enclosingScope = decl->defined_in();
      AST_Decl * enclosingDecl;

      if (enclosingScope)
      {
         if ((enclosingDecl = (AST_Decl*)enclosingScope->narrow((long) & AST_Decl::type_id)))
         {
            ret = NameToString(enclosingDecl->name(), 0);
         }
         else
         {
            DDSError((DDS_StdString)"Can't narrow enclosing scope for " + NameToString(decl->name(), 0));
         }
      }
   }

   return ret;
}
开发者ID:xrl,项目名称:opensplice_dds,代码行数:27,代码来源:xbe_type.cpp

示例2: ScopeAsDecl

void
be_type::gen_fwd_helper_name (void)
{
  AST_Decl *parent = ScopeAsDecl (this->defined_in ());
  Identifier *segment = 0;
  char *tmp = 0;
  this->fwd_helper_name_.clear (true);

  if (parent != 0 && parent->node_type () != AST_Decl::NT_root)
    {
      for (UTL_IdListActiveIterator i (parent->name ());
           !i.is_done ();
           i.next ())
        {
          segment = i.item ();
          tmp = segment->get_string ();

          if (ACE_OS::strcmp (tmp, "") == 0)
            {
              continue;
            }

          this->fwd_helper_name_ += tmp;
          this->fwd_helper_name_ += "::";
        }
    }
  else
    {
      this->fwd_helper_name_= "";
    }

  this->fwd_helper_name_ += "tao_";
  this->fwd_helper_name_ += this->local_name ()->get_string ();
}
开发者ID:CCJY,项目名称:ATCD,代码行数:34,代码来源:be_type.cpp

示例3: ScopeAsDecl

UTL_ScopedName * make_fully_scoped_name (Identifier * id)
{
   UTL_ScopedName * result = NULL;
   UTL_Scope *s = idl_global->scopes()->top_non_null();
   AST_Decl * d = ScopeAsDecl(s);
   UTL_ScopedName * lastComponent = new UTL_ScopedName(id, NULL);
   UTL_ScopedName * leadComponents = d->name();

   if (leadComponents)
   {
      result = (UTL_IdList*)leadComponents->copy(); // YO downcast
      result->nconc(lastComponent);
   }
   else
   {
      result = lastComponent;
   }

   return result;
}
开发者ID:S73417H,项目名称:opensplice,代码行数:20,代码来源:utl_scope.cpp

示例4: ScopeAsDecl

void
be_visitor_connector_dds_exh::gen_interface_connector_trait (
  be_interface *iface,
  be_field *port_elem,
  bool for_facet)
{
  if (!iface->dds_connector_traits_done ())
    {
      AST_Decl *scope = ScopeAsDecl (iface->defined_in ());
      bool global = (scope->node_type () == AST_Decl::NT_root);
      const char *smart_scope = (global ? "" : "::");
      const char *lname = iface->local_name ();

      os_ << be_nl
          << "typedef ::" << scope->name () << smart_scope
          << (!for_facet ? "" : "CCM_") << lname
          << " " << port_elem->local_name ()->get_string ()
          << "_type;";

      iface->dds_connector_traits_done (true);
      this->port_ifaces_.enqueue_tail (iface);
    }
}
开发者ID:asdlei00,项目名称:ACE,代码行数:23,代码来源:connector_dds_exh.cpp

示例5: lname_str

int
be_visitor_facet_exh::visit_provides (be_provides *node)
{
  be_type *impl = node->provides_type ();
  const char *iname =
    impl->original_local_name ()->get_string ();

  ACE_CString lname_str (this->ctx_->port_prefix ());
  lname_str += node->original_local_name ()->get_string ();
  const char *lname = lname_str.c_str ();

  AST_Decl *s = ScopeAsDecl (impl->defined_in ());
  ACE_CString sname_str =
    IdentifierHelper::orig_sn (s->name (), false);
  const char *sname = sname_str.c_str ();
  const char *global = (sname_str == "" ? "" : "::");

  AST_Decl *c_scope = ScopeAsDecl (this->node_->defined_in ());
  bool is_global = (c_scope->node_type () == AST_Decl::NT_root);
  const char *smart_scope = (is_global ? "" : "::");

  os_ << be_nl_2
      << "///  Executor implementation class for "
      << lname << " facet";

  os_ << be_nl
      << "class "
      << lname << "_exec_i" << be_idt_nl
      << ": public virtual " << global << sname << "::CCM_"
      << iname << "," << be_idt_nl
      << "public virtual ::CORBA::LocalObject"
      << be_uidt << be_uidt_nl
      << "{" << be_nl
      << "public:" << be_idt_nl
      << "/// Constructor" << be_nl
      << "/// @param[in] ctx - Container context" << be_nl
      << lname << "_exec_i (" << be_idt_nl
      << smart_scope << c_scope->full_name () << "::CCM_"
      << this->node_->local_name ()
      << "_Context_ptr ctx);" << be_uidt_nl
      << "/// Destructor" << be_nl
      << "virtual ~" << lname << "_exec_i (void);";

  if (impl->node_type () == AST_Decl::NT_interface)
    {
      be_interface *intf =
        be_interface::narrow_from_decl (impl);

      os_ << be_nl_2
          << "/** @name Operations and attributes from "
          << intf->full_name () << " */" << be_nl
          << "//@{";

      int const status =
        intf->traverse_inheritance_graph (
          be_visitor_facet_exh::method_helper,
          &os_);

      if (status == -1)
        {
          ACE_ERROR_RETURN ((LM_ERROR,
                             ACE_TEXT ("be_visitor_facet_exh::")
                             ACE_TEXT ("visit_provides - ")
                             ACE_TEXT ("traverse_inheritance_graph() ")
                             ACE_TEXT ("failed\n")),
                            -1);
        }

      os_ << be_nl << "//@}";
    }

  os_ << be_uidt << be_nl_2
      << "private:" << be_idt_nl
      << "/// Context for component instance. Used for all middleware communication." << be_nl
      << smart_scope << c_scope->full_name () << "::CCM_"
      << this->node_->local_name ()
      << "_Context_var ciao_context_;" << be_uidt_nl
      << "};";

  return 0;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:81,代码来源:facet_exh.cpp

示例6: header

int
ast_visitor_tmpl_module_inst::visit_home (AST_Home *node)
{
  UTL_ScopedName *base_name = 0;
  AST_Decl *parent =
    this->reify_type (node->base_home ());

  if (parent != 0)
    {
      base_name = parent->name ();
    }

  UTL_NameList *supports_names =
    this->create_name_list (node->supports (),
                            node->n_supports ());

  UTL_ScopedName *managed_comp_name = 0;

  AST_Component *managed_comp =
    AST_Component::narrow_from_decl (
      this->reify_type (node->managed_component ()));

  if (managed_comp != 0)
    {
      managed_comp_name = managed_comp->name ();
    }

  UTL_ScopedName *p_key_name = 0;

  AST_ValueType *p_key =
    AST_ValueType::narrow_from_decl (
      this->reify_type (node->primary_key ()));

  if (p_key != 0)
    {
      p_key_name = p_key->name ();
    }

  Identifier *node_id = 0;
  ACE_NEW_RETURN (node_id,
                  Identifier (node->local_name ()->get_string ()),
                  -1);

  UTL_ScopedName *local_name = 0;
  ACE_NEW_RETURN (local_name,
                  UTL_ScopedName (node_id, 0),
                  -1);

  FE_HomeHeader header (local_name,
                        base_name,
                        supports_names,
                        managed_comp_name,
                        p_key_name);

  AST_Home *added_home =
    idl_global->gen ()->create_home (header.name (),
                                     header.base_home (),
                                     header.managed_component (),
                                     header.primary_key (),
                                     header.supports (),
                                     header.n_supports (),
                                     header.supports_flat (),
                                     header.n_supports_flat ());

  if (supports_names != 0)
    {
      supports_names->destroy ();
      delete supports_names;
      supports_names = 0;
    }

  idl_global->scopes ().top ()->add_to_scope (added_home);

  // Update the scope management.
  idl_global->scopes ().push (added_home);

  if (this->visit_scope (node) != 0)
    {
      ACE_ERROR_RETURN ((LM_ERROR,
                         ACE_TEXT ("ast_visitor_tmpl_module_inst::")
                         ACE_TEXT ("visit_home - ")
                         ACE_TEXT ("visit_scope failed\n")),
                        -1);
    }

  // Through with this scope.
  idl_global->scopes ().pop ();

  return 0;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:90,代码来源:ast_visitor_tmpl_module_inst.cpp

示例7: if

// Visit the Constant node and its scope.
int
be_visitor_constant_ch::visit_constant (be_constant *node)
{
  if (node->cli_hdr_gen () || node->imported ())
    {
      return 0;
    }

  TAO_OutStream *os = this->ctx_->stream ();

  *os << be_nl_2 << "// TAO_IDL - Generated from" << be_nl
      << "// " << __FILE__ << ":" << __LINE__;

  // If we are defined in the outermost scope, then the value is assigned
  // to us here itself, else it will be in the *.cpp file.

  AST_Decl::NodeType nt = AST_Decl::NT_pre_defined;
  AST_Decl *tdef = node->constant_value ()->get_tdef ();
  AST_Decl::NodeType bnt = AST_Decl::NT_pre_defined;
  AST_Expression::ExprType etype = node->et ();
  AST_Decl::NodeType snt = node->defined_in ()->scope_node_type ();

  if (tdef != 0)
    {
      nt = tdef->node_type ();
      be_typedef *td = be_typedef:: narrow_from_decl (tdef);
      bnt = td->base_node_type ();
    }

  *os << be_nl_2;

  if (! node->is_nested ())
    {
      *os << "const ";

      if (etype == AST_Expression::EV_enum)
        {
          *os << node->enum_full_name ();
        }
      else if (nt == AST_Decl::NT_typedef)
        {
          *os << tdef->name ();
        }
      else
        {
          *os << node->exprtype_to_string ();
        }

      *os << " " << node->local_name ();
    }
  // We are nested inside an interface or a valuetype.
  else
    {
      if (snt != AST_Decl::NT_module)
        {
          *os << "static ";
        }
      else if (!be_global->gen_inline_constants ())
        {
          *os << "extern " << be_global->stub_export_macro () << " ";
        }

      *os << "const ";

      if (etype == AST_Expression::EV_enum)
        {
          *os << node->enum_full_name ();
        }
      else if (nt == AST_Decl::NT_typedef)
        {
          if (bnt == AST_Decl::NT_string || bnt == AST_Decl::NT_wstring)
            {
              *os << node->exprtype_to_string ();
            }
          else
            {
              *os << tdef->name ();
            }
        }
      else
        {
          *os << node->exprtype_to_string ();
        }

      *os << " " << node->local_name ();
    }

  // If this is true, can't generate inline constants.
  bool forbidden_in_class = (snt != AST_Decl::NT_root
                             && snt != AST_Decl::NT_module
                             && (etype == AST_Expression::EV_string
                                 || etype == AST_Expression::EV_wstring
                                 || etype == AST_Expression::EV_float
                                 || etype == AST_Expression::EV_double
                                 || etype == AST_Expression::EV_longdouble));

  if (!node->is_nested ()
      || (be_global->gen_inline_constants () && !forbidden_in_class))
    {
//.........这里部分代码省略.........
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:101,代码来源:constant_ch.cpp

示例8: switch

int
be_visitor_connector_dds_exs::visit_connector (be_connector *node)
{
  if (node->imported ())
    {
      return 0;
    }

  if (!this->begin (node))
    {
      return -1;
    }

  // If we have a connector within a templated module
  if (! this->t_args_.is_empty ())
    {
      os_ << be_nl
          << this->node_->local_name () << "_exec_i::"
          << this->node_->local_name () << "_exec_i (void)"
          << be_idt_nl
          << ": " << this->base_tname_ << "_Connector_T";

      os_ << " <" << be_idt << be_idt_nl;

      os_ << "CCM_" << this->node_->flat_name ()
          << "_Traits," << be_nl;

      size_t slot = 1UL;

      for (FE_Utils::T_ARGLIST::CONST_ITERATOR i (this->t_args_);
          !i.done ();
          i.advance (), ++slot)
        {
          AST_Decl **item = 0;
          i.next (item);
          AST_Decl *d = *item;

          if (this->is_dds_type (node, d))
            {
              os_ << d->flat_name ()
                  << "_DDS_Traits";
            }
          else
            {
              os_ << d->name ();
            }

          bool needs_bool = false;
          bool is_fixed = false;
          FE_Utils::T_Param_Info *param = 0;

          if (this->t_params_->get (param, slot - 1) != 0)
            {
              ACE_ERROR_RETURN ((LM_ERROR,
                                 ACE_TEXT ("be_visitor_connector_dds_exh::")
                                 ACE_TEXT ("visit_connector - ")
                                 ACE_TEXT ("template param fetch failed\n ")),
                                -1);
            }

          if (d->node_type () == AST_Decl::NT_typedef)
            {
              /// Strip away all layers of typedef before narrowing.
              AST_Typedef *td = AST_Typedef::narrow_from_decl (d);
              d = td->primitive_base_type ();
            }

          /// No need to check if this is 0, but must narrow
          /// to call virtual function size_type() below.
          AST_Type *t = AST_Type::narrow_from_decl (d);

          switch (param->type_)
            {
              case AST_Decl::NT_type:
              case AST_Decl::NT_struct:
              case AST_Decl::NT_union:
                needs_bool = true;
                is_fixed = (t->size_type () == AST_Type::FIXED);
                break;
              default:
                break;
            }

          if (needs_bool)
            {
              os_ << "," << be_nl
                  << (is_fixed ? "true" : "false");
            }

          if (slot < this->t_args_.size ())
            {
              os_ << "," << be_nl;
            }
        }

      os_ << "> ()"
          << be_uidt << be_uidt << be_uidt_nl
          << "{" << be_nl
          << "}";

//.........这里部分代码省略.........
开发者ID:CCJY,项目名称:ATCD,代码行数:101,代码来源:connector_dds_exs.cpp

示例9: exec_visitor

int
be_visitor_component_ex_idl::visit_component (
  be_component *node)
{
  if (node->imported ())
    {
      return 0;
    }

  be_util::gen_nesting_open (os_, node);

  be_visitor_executor_ex_idl exec_visitor (this->ctx_);

  if (exec_visitor.visit_component (node) == -1)
    {
      ACE_ERROR_RETURN ((LM_ERROR,
                         ACE_TEXT ("be_visitor_component_ex_idl::")
                         ACE_TEXT ("visit_component - ")
                         ACE_TEXT ("executor visitor failed\n")),
                        -1);
    }

  be_visitor_context_ex_idl context_visitor (this->ctx_);

  if (context_visitor.visit_component (node) == -1)
    {
      ACE_ERROR_RETURN ((LM_ERROR,
                         ACE_TEXT ("be_visitor_component_ex_idl::")
                         ACE_TEXT ("visit_component - ")
                         ACE_TEXT ("context visitor failed\n")),
                        -1);
    }

  be_util::gen_nesting_close (os_, node);

  AST_Decl *scope = ScopeAsDecl (node->defined_in ());

  ACE_CString sname_str =
    IdentifierHelper::orig_sn (scope->name ());
  const char *sname = sname_str.c_str ();

  const char *lname =
    node->original_local_name ()->get_string ();

  const char *global = (sname_str == "" ? "" : "::");

  os_ << be_nl_2
      << "module CIAO_" << node->flat_name () << "_Impl" << be_nl
      << "{" << be_idt_nl;

  os_ << "local interface " << lname << "_Exec" << be_idt_nl
      << ": " << global << sname << "::CCM_" << lname
      << "," << be_idt_nl;

  os_ << "::Components::" << be_global->ciao_container_type ()
      << "Component" << be_uidt << be_uidt_nl;

  os_ << "{" << be_nl
      << "};";

  os_ << be_uidt_nl
      << "};";

  return 0;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:65,代码来源:component_ex_idl.cpp

示例10: switch

int
be_visitor_connector_dds_exh::visit_connector (be_connector *node)
{
  if (node->imported ())
    {
      return 0;
    }

  if (!this->begin (node))
    {
      return -1;
    }

  // If we have a connector within a templated module
  if (! this->t_args_.is_empty ())
    {
      // Generate all needed dds_traits
      for (FE_Utils::T_ARGLIST::CONST_ITERATOR i (this->t_args_);
          !i.done ();
          i.advance ())
        {
          AST_Decl **item = 0;
          i.next (item);
          AST_Decl *d = *item;

          if (this->is_dds_type (node, d))
            {
              this->gen_dds_traits (d);
            }
        }

      // Generate connector traits
      this->gen_connector_traits ();

      os_ << be_nl_2
          << "class " << this->export_macro_.c_str () << " "
          << this->node_->local_name () << "_exec_i" << be_idt_nl
          << ": public " << this->base_tname_ << "_Connector_T";

      os_ << " <" << be_idt << be_idt_nl;

      os_ << "CCM_" << this->node_->flat_name ()
          << "_Traits," << be_nl;

      size_t slot = 1UL;

      for (FE_Utils::T_ARGLIST::CONST_ITERATOR i (this->t_args_);
          !i.done ();
          i.advance (), ++slot)
        {
          AST_Decl **item = 0;
          i.next (item);
          AST_Decl *d = *item;

          if (this->is_dds_type (node, d))
            {
              os_ << d->flat_name ()
                  << "_DDS_Traits";
            }
          else
            {
              os_ << d->name ();
            }

          bool needs_bool = false;
          bool is_fixed = false;
          FE_Utils::T_Param_Info *param = 0;

          if (this->t_params_->get (param, slot - 1) != 0)
            {
              ACE_ERROR_RETURN ((LM_ERROR,
                                 ACE_TEXT ("be_visitor_connector_dds_exh::")
                                 ACE_TEXT ("visit_connector - ")
                                 ACE_TEXT ("template param fetch failed\n ")),
                                -1);
            }

          if (d->node_type () == AST_Decl::NT_typedef)
            {
              /// Strip away all layers of typedef before narrowing.
              AST_Typedef *td = AST_Typedef::narrow_from_decl (d);
              d = td->primitive_base_type ();
            }

          /// No need to check if this is 0, but must narrow
          /// to call virtual function size_type() below.
          AST_Type *t = AST_Type::narrow_from_decl (d);

          switch (param->type_)
            {
              case AST_Decl::NT_type:
              case AST_Decl::NT_struct:
              case AST_Decl::NT_union:
                needs_bool = true;
                is_fixed = (t->size_type () == AST_Type::FIXED);
                break;
              default:
                break;
            }

//.........这里部分代码省略.........
开发者ID:asdlei00,项目名称:ACE,代码行数:101,代码来源:connector_dds_exh.cpp

示例11: op_name

int
be_visitor_attribute::visit_attribute (be_attribute *node)
{
    this->ctx_->node (node);
    this->ctx_->attribute (node);

    UTL_Scope *s = node->defined_in ();
    AST_Decl *d = ScopeAsDecl (s);
    ACE_CString op_name (this->ctx_->port_prefix ());
    op_name += node->local_name ()->get_string ();
    Identifier *op_id = 0;
    ACE_NEW_RETURN (op_id,
                    Identifier (op_name.c_str ()),
                    -1);

    UTL_ScopedName *op_ln = 0;
    ACE_NEW_RETURN (op_ln,
                    UTL_ScopedName (op_id, 0),
                    -1);

    UTL_ScopedName *op_sn =
        static_cast<UTL_ScopedName *> (d->name ()->copy ());
    op_sn->nconc (op_ln);

    // first the "get" operation
    be_operation get_op (node->field_type (),
                         AST_Operation::OP_noflags,
                         0,
                         node->is_local (),
                         node->is_abstract ());

    get_op.set_defined_in (s);
    get_op.set_name (op_sn);
    UTL_ExceptList *get_exceptions = node->get_get_exceptions ();

    if (0 != get_exceptions)
    {
        get_op.be_add_exceptions (get_exceptions->copy ());
    }

    be_visitor_context ctx (*this->ctx_);
    int status = 1;

    switch (this->ctx_->state ())
    {
    // These two cases are the only ones that could involve a strategy.
    case TAO_CodeGen::TAO_ROOT_CH:
    case TAO_CodeGen::TAO_INTERFACE_CH:
    {
        ctx.state (TAO_CodeGen::TAO_OPERATION_CH);
        be_visitor_operation_ch visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_CS:
    {
        ctx.state (TAO_CodeGen::TAO_OPERATION_CS);
        be_visitor_operation_cs visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_SH:
    {
        be_visitor_operation_sh visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_IH:
    {
        be_visitor_operation_ih visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_SS:
    {
        be_visitor_operation_ss visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_ROOT_IS:
    {
        be_visitor_operation_is visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SH:
    {
        be_visitor_operation_proxy_impl_xh visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_INTERFACE_DIRECT_PROXY_IMPL_SS:
    {
        be_visitor_operation_direct_proxy_impl_ss visitor (&ctx);
        status = get_op.accept (&visitor);
        break;
    }
    case TAO_CodeGen::TAO_INTERFACE_SMART_PROXY_CH:
    {
        be_visitor_operation_smart_proxy_ch visitor (&ctx);
//.........这里部分代码省略.........
开发者ID:akostrikov,项目名称:ATCD,代码行数:101,代码来源:attribute.cpp


注:本文中的AST_Decl::name方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。