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


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

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


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

示例1: assert

void
be_enum::FinishProtoTypeCode()
{
   // flesh out typecode
   // since enums names are all in a scope and not added directly
   // we go through the scope and add them all here
   UTL_Scope* s = (UTL_Scope*)narrow((long) & UTL_Scope::type_id);
   assert(s);

   UTL_ScopeActiveIterator* i = 0;
   i = new UTL_ScopeActiveIterator(s, UTL_Scope::IK_decls);

   if (s->nmembers() > 0)
   {
      for ( ; !(i->is_done()); i->next())
      {
         AST_Decl* d = i->item();
         assert(d);

         m_typecode->member_names.push_back(d->local_name()->get_string());
      }

      delete i;
   }
}
开发者ID:osrf,项目名称:opensplice,代码行数:25,代码来源:xbe_enum.cpp

示例2: if

// Dump this AST_Enum to the ostream o
void
AST_Enum::dump (ACE_OSTREAM_TYPE &o)
{
  AST_Decl *d = 0;

  if (this->is_local ())
    {
      this->dump_i (o, "(local) ");
    }
  else if (this->is_abstract ())
    {
      this->dump_i (o, "(abstract) ");
    }

  this->dump_i (o, "enum ");

  this->local_name ()->dump (o);

  this->dump_i (o, " {\n");

  // Must increment the iterator explicitly inside the loop.
  for (UTL_ScopeActiveIterator i (this, IK_decls);!i.is_done ();)
    {
      d = i.item ();
      d->local_name ()->dump (o);
      i.next ();

      if (!i.is_done ())
        {
          this->dump_i (o, ", ");
        }
    }

  idl_global->indent ()->skip_to (o);

  this->dump_i (o, "}");
}
开发者ID:asdlei00,项目名称:ACE,代码行数:38,代码来源:ast_enum.cpp

示例3: name

UTL_ScopedName *
ast_visitor_reifying::template_module_rel_name (AST_Decl *d)
{
  AST_Decl *tmp = d;
  ACE_CString name (d->full_name ());

  while (tmp != 0)
    {
      if (AST_Template_Module::narrow_from_decl (tmp) != 0)
        {
          ACE_CString head (tmp->local_name ()->get_string ());

          ACE_CString::size_type start = name.find (head) + 2;

          ACE_CString tail (name.substr (start + head.length ()));

          return FE_Utils::string_to_scoped_name (tail.c_str ());
        }

      tmp = ScopeAsDecl (tmp->defined_in ());
    }

  return 0;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:24,代码来源:ast_visitor_reifying.cpp

示例4: name

UTL_ScopedName *
be_visitor_xplicit_pre_proc::xplicit_iface_rel_name (AST_Decl *d)
{
  AST_Decl *tmp = d;
  ACE_CString name (d->full_name ());

  while (tmp != 0)
    {
      if (be_home::narrow_from_decl (tmp) != 0)
        {
          ACE_CString head (tmp->local_name ()->get_string ());

          ACE_CString::size_type start = name.find (head) + 2;

          ACE_CString tail (name.substr (start + head.length ()));

          return FE_Utils::string_to_scoped_name (tail.c_str ());
        }

      tmp = ScopeAsDecl (tmp->defined_in ());
    }

  return 0;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:24,代码来源:be_visitor_xplicit_pre_proc.cpp

示例5: switch

// NOTE: No attempt is made to ensure that exceptions are mentioned
//       only once..
UTL_NameList *
AST_Operation::fe_add_exceptions (UTL_NameList *t)
{
  if (0 == t)
    {
      return 0;
    }

  UTL_ScopedName *nl_n = 0;
  AST_Type *fe = 0;
  AST_Decl *d = 0;

  this->pd_exceptions = 0;

  for (UTL_NamelistActiveIterator nl_i (t); !nl_i.is_done (); nl_i.next ())
    {
      nl_n = nl_i.item ();
      d = this->lookup_by_name (nl_n, true);

      if (d == 0)
        {
          idl_global->err ()->lookup_error (nl_n);
          return 0;
        }

      AST_Decl::NodeType nt = d->node_type ();

      switch (nt)
        {
          case AST_Decl::NT_except:
            break;
          case AST_Decl::NT_param_holder:
            {
              AST_Param_Holder *ph =
                AST_Param_Holder::narrow_from_decl (d);

              nt = ph->info ()->type_;

              if (nt != AST_Decl::NT_except
                  && nt != AST_Decl::NT_type)
                {
                  idl_global->err ()->mismatched_template_param (
                    ph->info ()->name_.c_str ());
                }

              break;
            }
          case AST_Decl::NT_typedef:
            {
              AST_Typedef *td =
                AST_Typedef::narrow_from_decl (d);

              nt = td->primitive_base_type ()->node_type ();

              if (nt != AST_Decl::NT_except)
                {
                  idl_global->err ()->error1 (
                    UTL_Error::EIDL_ILLEGAL_RAISES,
                    this);
                }

              break;
            }
          case AST_Decl::NT_native:
            {
              // This is the only use case for this node type.
              int compare =
                ACE_OS::strcmp (d->local_name ()->get_string (),
                                "UserExceptionBase");

              if (compare != 0)
                {
                  idl_global->err ()->error1 (
                    UTL_Error::EIDL_ILLEGAL_RAISES,
                    this);
                }

              break;
            }
          default:
            idl_global->err ()->error1 (
              UTL_Error::EIDL_ILLEGAL_RAISES,
              this);

            break;
        };

      bool oneway_op =
        (this->flags () == AST_Operation::OP_oneway);

      fe = AST_Type::narrow_from_decl (d);

      if (oneway_op && fe != 0)
        {
          idl_global->err ()->error1 (UTL_Error::EIDL_ILLEGAL_RAISES,
                                      this);
        }

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

示例6: op_visitor

int
be_visitor_interface_ss::gen_abstract_ops_helper (
  be_interface *node,
  be_interface *base,
  TAO_OutStream *os)
{
  if (!base->is_abstract ())
    {
      return 0;
    }

  AST_Decl *d = 0;
  be_visitor_context ctx;
  ctx.stream (os);
  ctx.state (TAO_CodeGen::TAO_ROOT_SS);

  for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls);
       !si.is_done ();
       si.next ())
    {
      d = si.item ();

      if (d == 0)
        {
          ACE_ERROR_RETURN ((LM_ERROR,
                             ACE_TEXT ("be_visitor_interface_ss::")
                             ACE_TEXT ("gen_abstract_ops_helper - ")
                             ACE_TEXT ("bad node in this scope\n")),
                            -1);
        }

      AST_Decl::NodeType nt = d->node_type ();

      UTL_ScopedName *item_new_name = 0;
      UTL_ScopedName *new_name = 0;

      if (AST_Decl::NT_op == nt || AST_Decl::NT_attr == nt)
        {
          ACE_NEW_RETURN (item_new_name,
                          UTL_ScopedName (d->local_name ()->copy (),
                                          0),
                          -1);

          new_name = (UTL_ScopedName *) node->name ()->copy ();
          new_name->nconc (item_new_name);
        }
      else
        {
          continue;
        }

      // We pass the node's is_abstract flag to the operation
      // constructor so we will get the right generated operation
      // body if we are regenerating an operation from an
      // abstract interface in a concrete interface or component.
      if (AST_Decl::NT_op == nt)
        {
          be_operation *op = be_operation::narrow_from_decl (d);
          UTL_ScopedName *old_name =
            (UTL_ScopedName *) op->name ()->copy ();
          op->set_name (new_name);
          op->set_defined_in (node);
          op->is_abstract (node->is_abstract ());

          be_visitor_operation_ss op_visitor (&ctx);
          op_visitor.visit_operation (op);

          op->set_name (old_name);
          op->set_defined_in (base);
          op->is_abstract (base->is_abstract ());
        }
      else if (AST_Decl::NT_attr == nt)
        {
          AST_Attribute *attr =
            AST_Attribute::narrow_from_decl (d);
          be_attribute new_attr (attr->readonly (),
                                 attr->field_type (),
                                 0,
                                 attr->is_local (),
                                 attr->is_abstract ());
          new_attr.set_defined_in (node);
          new_attr.set_name (new_name);

          UTL_ExceptList *get_exceptions =
            attr->get_get_exceptions ();

          if (0 != get_exceptions)
            {
              new_attr.be_add_get_exceptions (get_exceptions->copy ());
            }

          UTL_ExceptList *set_exceptions =
            attr->get_set_exceptions ();

          if (0 != set_exceptions)
            {
              new_attr.be_add_set_exceptions (set_exceptions->copy ());
            }

          be_visitor_attribute attr_visitor (&ctx);
//.........这里部分代码省略.........
开发者ID:asdlei00,项目名称:ACE,代码行数:101,代码来源:interface_ss.cpp

示例7: op_visitor

int
be_visitor_interface_cs::gen_abstract_ops_helper (be_interface *node,
                                                  be_interface *base,
                                                  TAO_OutStream *os)
{
  // If the derived interface is local, the abstract parent's operation
  // was generated as pure virtual.
  if (!base->is_abstract () || node->is_local ())
    {
      return 0;
    }

  AST_Decl *d = 0;
  be_visitor_context ctx;
  ctx.stream (os);

  for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls);
       !si.is_done ();
       si.next ())
    {
      d = si.item ();

      if (d == 0)
        {
          ACE_ERROR_RETURN ((LM_ERROR,
                             "(%N:%l) be_visitor_interface_cs::"
                             "gen_abstract_ops_helper - "
                             "bad node in this scope\n"),
                            -1);
        }

      if (d->node_type () == AST_Decl::NT_op)
        {
          UTL_ScopedName *item_new_name  = 0;
          ACE_NEW_RETURN (item_new_name,
                          UTL_ScopedName (d->local_name ()->copy (),
                                          0),
                          -1);

          UTL_ScopedName *new_op_name =
            (UTL_ScopedName *)node->name ()->copy ();
          new_op_name->nconc (item_new_name);

          be_operation *op = be_operation::narrow_from_decl (d);
          UTL_ScopedName *old_op_name =
            (UTL_ScopedName *) op->name ()->copy ();
          op->set_name (new_op_name);
          op->set_defined_in (node);
          op->is_abstract (node->is_abstract ());

          ctx.state (TAO_CodeGen::TAO_OPERATION_CS);
          be_visitor_operation_cs op_visitor (&ctx);
          op_visitor.visit_operation (op);

          op->set_name (old_op_name);
          op->set_defined_in (base);
          op->is_abstract (base->is_abstract ());
        }
    }

  return 0;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:62,代码来源:interface_cs.cpp

示例8: arg_flat_name

int
be_visitor_arg_traits::visit_argument (be_argument *node)
{
  if (this->ctx_->alias () != 0 || this->generated (node))
    {
      return 0;
    }

  AST_Type *bt = node->field_type ();
  AST_Decl::NodeType nt = bt->node_type ();

  // We are interested here only in unaliased, bounded
  // (w)strings.

  if (nt != AST_Decl::NT_string && nt != AST_Decl::NT_wstring)
    {
      return 0;
    }

  be_string *st = be_string::narrow_from_decl (bt);
  ACE_CDR::ULong bound = st->max_size ()->ev ()->u.ulval;

  if (bound == 0)
    {
      return 0;
    }

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

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

  std::string guard_suffix =
    std::string (this->S_) + std::string ("arg_traits");

  // The guard should be generated to prevent multiple declarations,
  // since a bounded (w)string of the same length may be used or typedef'd
  // more than once.

  os->gen_ifdef_macro (node->flat_name (), guard_suffix.c_str (), false);

  bool wide = (st->width () != 1);

  // It is legal IDL to declare a bounded (w)string as an operation
  // parameter type. There could be any number of identical
  // declarations in the same build, translation unit, or even in
  // the same operation, so we use the argument's flat name to
  // declare an empty struct, and use that struct as the template
  // parameter for Arg_Traits<>.
  *os << be_nl_2;

  AST_Decl *op = ScopeAsDecl (node->defined_in ());
  AST_Decl *intf = ScopeAsDecl (op->defined_in ());
  ACE_CString arg_flat_name (intf->flat_name ());
  arg_flat_name += '_';
  arg_flat_name += op->local_name ()->get_string ();
  arg_flat_name += '_';
  arg_flat_name += node->local_name ()->get_string ();

  // Avoid generating a duplicate structure in the skeleton.
  if (ACE_OS::strlen (this->S_) == 0)
    {
      *os << "struct " << arg_flat_name.c_str () << " {};"
          << be_nl_2;
    }

  *os << "template<>" << be_nl
      << "class "
      << this->S_ << "Arg_Traits<"
      << arg_flat_name.c_str ()
      << ">" << be_idt_nl
      << ": public" << be_idt << be_idt_nl
      << "BD_String_" << this->S_ << "Arg_Traits_T<" << be_nl
      << "CORBA::" << (wide ? "W" : "") << "String_var," << be_nl
      << bound << "," << be_nl
      << this->insert_policy()
      << be_uidt_nl
      << ">"
      << be_uidt << be_uidt << be_uidt_nl
      << "{" << be_nl
      << "};";

  os->gen_endif ();

  this->generated (node, true);
  return 0;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:87,代码来源:be_visitor_arg_traits.cpp

示例9: item_new_name

int
be_visitor_interface_sh::gen_abstract_ops_helper (
  be_interface *node,
  be_interface *base,
  TAO_OutStream *os)
{
  if (!base->is_abstract ())
    {
      return 0;
    }

  AST_Decl *d = 0;
  be_visitor_context ctx;
  ctx.stream (os);
  ctx.state (TAO_CodeGen::TAO_ROOT_SH);

  for (UTL_ScopeActiveIterator si (base, UTL_Scope::IK_decls);
       !si.is_done ();
       si.next ())
    {
      d = si.item ();

      if (d == 0)
        {
          ACE_ERROR_RETURN ((LM_ERROR,
                             ACE_TEXT ("be_visitor_interface_sh::")
                             ACE_TEXT ("gen_abstract_ops_helper - ")
                             ACE_TEXT ("bad node in this scope\n")),
                            -1);
        }

      UTL_ScopedName item_new_name (d->local_name (),
                                    0);

      if (d->node_type () == AST_Decl::NT_op)
        {
          be_operation *op = be_operation::narrow_from_decl (d);
          be_visitor_operation_sh op_visitor (&ctx);
          op_visitor.visit_operation (op);
        }
      else if (d->node_type () == AST_Decl::NT_attr)
        {
          AST_Attribute *attr = AST_Attribute::narrow_from_decl (d);
          be_attribute new_attr (attr->readonly (),
                                 attr->field_type (),
                                 &item_new_name,
                                 attr->is_local (),
                                 attr->is_abstract ());
          new_attr.set_defined_in (node);

          UTL_ExceptList *get_exceptions = attr->get_get_exceptions ();

          if (0 != get_exceptions)
            {
              new_attr.be_add_get_exceptions (get_exceptions->copy ());
            }

          UTL_ExceptList *set_exceptions = attr->get_set_exceptions ();

          if (0 != set_exceptions)
            {
              new_attr.be_add_set_exceptions (set_exceptions->copy ());
            }

          be_visitor_attribute attr_visitor (&ctx);
          attr_visitor.visit_attribute (&new_attr);
          ctx.attribute (0);
          new_attr.destroy ();
        }
    }

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


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