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


C++ UTL_ScopeActiveIterator::item方法代码示例

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


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

示例1:

void
be_visitor_valuetype_obv_cs::gen_obv_init_constructor_inits (
    be_valuetype *node
  )
{
  TAO_OutStream *os = this->ctx_->stream ();
  AST_Type *parent = node->inherits_concrete ();

  // Generate for inherited members first.
  if (parent != 0)
    {
      be_valuetype *be_parent = be_valuetype::narrow_from_decl (parent);
      this->gen_obv_init_constructor_inits (be_parent);
    }

  for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
       !si.is_done ();
       si.next())
    {
      // be_attribute inherits from be_field
      // so we have to also screen out attributes
      be_field *f = be_field::narrow_from_decl (si.item ());
      be_attribute *attr =
        be_attribute::narrow_from_decl (si.item ());

      if (f == 0 || attr != 0)
        {
          continue;
        }

      *os << be_nl
          << f->local_name () << " (_tao_init_" << f->local_name ()
          << ");";
    }
}
开发者ID:manut,项目名称:TAO,代码行数:35,代码来源:valuetype_obv_cs.cpp

示例2: while

AST_Module *
be_generator::create_module (UTL_Scope *s,
                             UTL_ScopedName *n)
{
  AST_Module *retval = 0;

  // Check for another module of the same name in this scope.
  for (UTL_ScopeActiveIterator iter (s, UTL_Scope::IK_decls);
       !iter.is_done ();
       iter.next ())
    {
      // Can't just check node type here, since it could be a
      // template module or template module instantiation.
      AST_Module *m = AST_Module::narrow_from_decl (iter.item ());

      if (m && m->local_name ()->compare (n->last_component ()))
        {
          // Create this new module with referance to the
          // "first" previous module found in scope.
          ACE_NEW_RETURN (retval, be_module (n, m), 0);
          retval->prefix (const_cast<char *> (m->prefix ()));
          return retval;
        }
    }

  // Since the scope didn't contain the same module name, it
  // doesn't mean that we haven't see it before. If the scope
  // is itself a module, and has been previously opened, any
  // of the previous openings may contain a previous opening
  // of the module we're creating.
  AST_Module *prev_module = AST_Module::narrow_from_scope (s);
  if (prev_module)
    {
      while (!!(prev_module = prev_module->previous_opening ()))
        {
          for (UTL_ScopeActiveIterator iter (prev_module, UTL_Scope::IK_decls);
               !iter.is_done ();
               iter.next ())
            {
              AST_Module *m = AST_Module::narrow_from_decl (iter.item ());
              if (m && m->local_name ()->compare (n->last_component ()))
                {
                  // Create this new module with referance to the
                  // "first" previous module found in scope.
                  ACE_NEW_RETURN (retval, be_module (n, m), 0);
                  return retval;
                }
            }
        }
    }

  // There is no previous module to be found
  ACE_NEW_RETURN (retval, be_module (n), 0);
  return retval;
}
开发者ID:handsomett,项目名称:ATCD,代码行数:55,代码来源:be_generator.cpp

示例3: GenerateGlobalDecls

void be_root::GenerateGlobalDecls (be_ClientHeader & source)
{
   UTL_ScopeActiveIterator * i;
   be_CodeGenerator * cg;
   AST_Decl * d;
   UTL_Scope * s = (UTL_Scope*) narrow ((long) & UTL_Scope::type_id);

   if (s)
   {
      // Iterate through decls

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

      while (!(i->is_done ()))
      {
         d = i->item ();

         if (!d->imported ())
         {
            cg = (be_CodeGenerator*) d->narrow
               ((long) & be_CodeGenerator::type_id);

            if (cg)
            {
               cg->Generate (source);
            }
         }

         i->next ();
      }

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

示例4:

// Compute the size type of the node in question.
int
AST_Structure::compute_size_type (void)
{
  for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
       !si.is_done ();
       si.next ())
    {
      // Get the next AST decl node.
      AST_Decl *d = si.item ();

      if (d->node_type () == AST_Decl::NT_enum_val)
        {
          continue;
        }

      AST_Field *f = AST_Field::narrow_from_decl (d);
      AST_Type *t = f->field_type ();

      if (t != 0)
        {
          this->size_type (t->size_type ());

          // While we're iterating, we might as well do this one too.
          this->has_constructor (t->has_constructor ());
        }
      else
        {
          ACE_DEBUG ((LM_DEBUG,
                      "WARNING (%N:%l) be_structure::compute_size_type - "
                      "narrow_from_decl returned 0\n"));
        }
    }

  return 0;
}
开发者ID:handsomett,项目名称:ATCD,代码行数:36,代码来源:ast_structure.cpp

示例5: 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

示例6:

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

  this->dump_i (o, "finder ");
  this->local_name ()->dump (o);
  this->dump_i (o, "(");

  // Iterator must be explicitly advanced inside the loop.
  for (UTL_ScopeActiveIterator i (this, IK_decls);
       !i.is_done ();)
    {
      d = i.item ();
      d->dump (o);
      i.next ();

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

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

示例7:

void
be_home::scan (UTL_Scope *s)
{
  if (s == 0)
    {
      return;
    }

  for (UTL_ScopeActiveIterator i (s, UTL_Scope::IK_both);
       !i.is_done ();
       i.next ())
    {
      AST_Decl *d = i.item ();
      AST_Attribute *attr =
        AST_Attribute::narrow_from_decl (d);

      if (attr != 0 && ! attr->readonly ())
        {
          this->has_rw_attributes_ = true;
          return;
        }
    }

  AST_Home *h = AST_Home::narrow_from_scope (s);

  if (h != 0)
    {
      this->scan (h->base_home ());
    }
}
开发者ID:asdlei00,项目名称:ACE,代码行数:30,代码来源:be_home.cpp

示例8: GenerateAssignmentOperator

void be_exception::GenerateAssignmentOperator (be_ClientImplementation& source)
{
   ostream & os = source.Stream ();
   DDS_StdString that ("");
   be_Type * btype;

   if (nmembers ())
   {
      that = " that";
   }

   os << ScopedName () << " & "
      << ScopedName () << "::operator = (const "
      << LocalName () << " &" << that << ")" << nl;
   os << "{" << nl;

   UTL_Scope * s = (UTL_Scope*)narrow((long) & UTL_Scope::type_id);
   assert (s);

   UTL_ScopeActiveIterator *it;

   // Iterate through decls

   for 
   (
      it = new UTL_ScopeActiveIterator (s, UTL_Scope::IK_decls);
      ! it->is_done ();
      it->next ()
   )
   {
      AST_Decl * adecl = it->item ();
      assert (adecl);

      be_field *bfield = (be_field *) adecl->narrow ((long) & be_field::type_id);

      if (bfield)
      {
         btype = bfield->get_be_type ();
         if (btype && btype->IsArrayType ())
         {
            // Need to copy array elements

            os << "   "
               << (char*) BE_Globals::RelativeScope (ScopedName (), bfield->StructMemberTypeName ())
               << "_copy (" << bfield->get_local_name () 
               << ", that." << bfield->get_local_name () << ");" << nl;
         }
         else
         {
            os << "   " << bfield->get_local_name () << " = that."
               << bfield->get_local_name() << ";" << nl;
         }
      }
   }

   delete it;

   os << "   return *this;" << nl;
   os << "}" << nl << nl;
}
开发者ID:diorahman,项目名称:opensplice,代码行数:60,代码来源:xbe_exception.cpp

示例9: while

void
be_CodeGenerator::Generate(be_ClientImplementation& source)
{
   UTL_ScopeActiveIterator* i;
   AST_Decl * d;
   UTL_Scope * s = (UTL_Scope*)narrow((long) & UTL_Scope::type_id);

   if (s)
   {
      i = new UTL_ScopeActiveIterator(s, UTL_Scope::IK_decls);

      while (!(i->is_done()))
      {
         be_CodeGenerator * cg;

         d = i->item();

         if (!d->imported() &&
             (cg = (be_CodeGenerator*)d->narrow((long) & be_CodeGenerator::type_id)))
         {
            cg->Generate(source);
         }

         i->next();
      }

      delete i;
   }
   else
   {
      assert(pbfalse);
   }
}
开发者ID:xrl,项目名称:opensplice_dds,代码行数:33,代码来源:xbe_codegen.cpp

示例10:

// Look up the default branch in union.
AST_UnionBranch *
AST_Union::lookup_default (void)
{
  AST_UnionBranch *b = 0;
  AST_Decl *d = 0;

  for (UTL_ScopeActiveIterator i (this, UTL_Scope::IK_both);
       !i.is_done();
       i.next ())
    {
      d = i.item ();

      if (d->node_type () == AST_Decl::NT_union_branch)
        {
          b = AST_UnionBranch::narrow_from_decl (d);

          if (b == 0)
            {
              continue;
            }

          if (b->label () != 0
              && b->label ()->label_kind () == AST_UnionLabel::UL_default)
            {
              idl_global->err ()->error2 (UTL_Error::EIDL_MULTIPLE_BRANCH,
                                          this,
                                          b);
              return b;
            }
        }
    }

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

示例11:

bool
be_valuetype::has_member (void)
{
  AST_Type *parent = this->pd_inherits_concrete;

  // We're looking for inherited members too.
  if (parent != 0)
    {
      be_valuetype *be_parent =
        be_valuetype::narrow_from_decl (parent);

      if (be_parent->has_member ())
        {
          return true;
        }
    }

  for (UTL_ScopeActiveIterator si (this, UTL_Scope::IK_decls);
       !si.is_done ();
       si.next())
    {
      if (si.item ()->node_type () == AST_Decl::NT_field)
        {
          return true;
        }
    }

  return false;
}
开发者ID:CCJY,项目名称:ATCD,代码行数:29,代码来源:be_valuetype.cpp

示例12:

int
ast_visitor_tmpl_module_inst::visit_scope (UTL_Scope *node)
{
  for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
       !si.is_done ();
       si.next ())
    {
      AST_Decl *d = si.item ();

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

      // Send the visitor.
      if (d == 0 || d->ast_accept (this) == -1)
        {
          ACE_ERROR_RETURN ((LM_ERROR,
                             ACE_TEXT ("ast_visitor_tmpl_module_inst::")
                             ACE_TEXT ("visit_scope - ")
                             ACE_TEXT ("codegen for scope failed\n")),
                            -1);
        }
    }

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

示例13:

int
be_visitor_home_attr_set::visit_home (be_home *node)
{
  if (node == 0)
    {
      return 0;
    }

  for (UTL_ScopeActiveIterator i (node, UTL_Scope::IK_decls);
       !i.is_done ();
       i.next ())
    {
      be_decl *d = be_decl::narrow_from_decl (i.item ());

      if (d->accept (this) == -1)
        {
          ACE_ERROR_RETURN ((LM_ERROR,
                             ACE_TEXT ("be_visitor_home_attr_set")
                             ACE_TEXT ("::visit_home - ")
                             ACE_TEXT ("accept () failed\n")),
                            -1);
        }
    }

  be_home *h = be_home::narrow_from_decl (node->base_home ());

  return this->visit_home (h);
}
开发者ID:CCJY,项目名称:ATCD,代码行数:28,代码来源:home_svs.cpp

示例14: instance_name

void
be_visitor_valuetype_cs::gen_ostream_operator_r (be_valuetype *node,
                                                 unsigned long &index)
{
  TAO_OutStream *os = this->ctx_->stream ();
  AST_Type *parent = node->inherits_concrete ();

  // Recurse up the parent chain.
  if (parent != 0)
    {
      this->gen_ostream_operator_r (be_valuetype::narrow_from_decl (parent),
                                    index);
    }

  // Generate output for the members of whichever recursion we are in.
  for (UTL_ScopeActiveIterator i (node, UTL_Scope::IK_decls);
       !i.is_done ();
       i.next ())
    {
      be_field *f = be_field::narrow_from_decl (i.item ());
      be_attribute *attr =
        be_attribute::narrow_from_decl (i.item ());

      // No way to access the private members from generated code.
      if (f == 0
          || f->visibility () != AST_Field::vis_PUBLIC
          || attr != 0)
        {
          continue;
        }

      if (index++ != 0)
        {
          *os << " << \", \"";
        }

      *os << be_nl
          << "     << ";

      ACE_CString instance_name ("this->");
      instance_name += f->local_name ()->get_string ();
      f->gen_member_ostream_operator (os,
                                      instance_name.c_str (),
                                      false,
                                      true);
    }
}
开发者ID:DOCGroup,项目名称:ACE_TAO,代码行数:47,代码来源:valuetype_cs.cpp

示例15: visitor

// Operations for field marshaling.
int
be_visitor_valuetype_marshal_cs::gen_fields (be_valuetype *node,
                                             be_visitor_context &ctx)
{
  int n_processed = 0;
  TAO_OutStream *os = ctx.stream ();
  this->elem_number_ = 0;

  // Initialize an iterator to iterate thru our scope.
  for (UTL_ScopeActiveIterator si (node, UTL_Scope::IK_decls);
       !si.is_done ();
       si.next())
    {
      AST_Decl *d = si.item ();

      if (!d)
        {
          ACE_ERROR_RETURN ((LM_ERROR,
                             ACE_TEXT ("be_visitor_scope::visit_scope - ")
                             ACE_TEXT ("bad node in this scope\n")),
                            -1);
        }

      // (JP) 2010-10-21
      // be_attribute now inherits from be_field, so we need this check.
      be_attribute *attr = be_attribute::narrow_from_decl (d);

      be_field *field = be_field::narrow_from_decl (d);

      if (field != 0 && attr == 0)
        {
          if (n_processed > 0)
            {
              *os << " &&" << be_nl;
            }

          ++n_processed;
          be_visitor_valuetype_field_cdr_cs visitor (&ctx);
          visitor.pre_ = node->field_pd_prefix ();
          visitor.post_ = node->field_pd_postfix ();

          if (visitor.visit_field (field) == -1)
            {
              ACE_ERROR_RETURN ((LM_ERROR,
                                 ACE_TEXT ("be_visitor_valuetype_marshal_cs::")
                                 ACE_TEXT ("visit_valuetype - ")
                                 ACE_TEXT ("codegen for scope failed\n")),
                                -1);
            }
        }
    }

  if (n_processed == 0)
    {
      *os << "true";
    }

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


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