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


C++ ParseNode::First方法代码示例

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


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

示例1: Prepare

///Предварительный разбор
  void Prepare (const ParseNode& decl)
  {
    for (Parser::Iterator iter=decl.First (); iter; ++iter)
    {
      try
      {        
        ParseNode decl = *iter;

        const char* type = decl.Name ();

        ParserMap::iterator iter = parsers.find (type);

        if (iter == parsers.end () || !iter->second.prepare_handler)
          continue; //игнорирование неизвестных узлов

        iter->second.prepare_handler (decl);
      }
      catch (common::ParserException&)
      {
        //игнорирование, протоколирование уже произведено
      }
      catch (std::exception& e)
      {
        root.Log ().Error (*iter, "%s", e.what ());
      }
      catch (...)
      {
        root.Log ().Error (*iter, "unknown exception");
      }
    }
    
    prepared = true;
  }
开发者ID:untgames,项目名称:funner,代码行数:34,代码来源:sg_xml_scene_parser.cpp

示例2: node_decl

SpriteDeclPtr XmlSceneParser::Impl::PrepareSprite (const ParseNode& decl)
{
  try
  {
      //попытка найти параметры в кеше

    if (SpriteDeclPtr* node_decl_ptr = cache.FindValue<SpriteDeclPtr> (decl))
      return *node_decl_ptr;
      
    SpriteDeclPtr node_decl (new SpriteDecl, false);

    node_decl->color.Parse (decl, "color");
    node_decl->alpha.Parse (decl, "alpha");
    node_decl->mode.Parse (decl, "mode");
    node_decl->usage.Parse (decl, "usage");
    node_decl->up.Parse (decl, "up");

    node_decl->material = get<const char*> (decl, "material", "");

    if (ParseNode layout_node = decl.First ("layout"))
      node_decl->layout.reset (new stl::string (get<const char*> (layout_node, "")));

      //регистрация дескриптора узла

    cache.SetValue (decl, node_decl);    

    return node_decl;
  }
  catch (xtl::exception& e)
  {
    e.touch ("scene_graph::XmlSceneParser::Impl::PrepareSprite");
    throw;
  }  
}
开发者ID:untgames,项目名称:funner,代码行数:34,代码来源:sg_xml_scene_parser.cpp

示例3: if

///Конструктор
    SceneRenderServerSubsystem (ParseNode& node)    
    {
      const char* name                 = get<const char*> (node, "Id");
      const char* threading_model_name = get<const char*> (node, "ThreadingModel", "SingleThreaded");
      
      ServerThreadingModel threading_model = ServerThreadingModel_SingleThreaded;

      if      (!strcmp (threading_model_name, "MultiThreaded"))  threading_model = ServerThreadingModel_MultiThreaded;
      else if (!strcmp (threading_model_name, "SingleThreaded")) threading_model = ServerThreadingModel_SingleThreaded;
      else                                                       common::raise_parser_exception (node.First ("ThreadingModel"), "Invalid threading model '%s'", threading_model_name); 

      const char *driver_mask  = get<const char*> (node, "DriverMask", (const char*)0),
                 *adapter_mask = get<const char*> (node, "AdapterMask", (const char*)0),
                 *init_string  = get<const char*> (node, "InitString", (const char*)0);

      server.reset (new Server (name, threading_model));

      for (Parser::NamesakeIterator iter=node.First ("RenderTarget"); iter; ++iter)
      {
        const char*         attachment = get<const char*> (*iter, "Window");
        const char*         name       = get<const char*> (*iter, "Id", attachment);
        syslib::Window&     window     = AttachmentRegistry::Get<syslib::Window> (attachment);
        common::PropertyMap properties = to_properties (*iter);

        if (driver_mask)  properties.SetProperty ("DriverMask", driver_mask);
        if (adapter_mask) properties.SetProperty ("AdapterMask", adapter_mask);
        if (init_string)  properties.SetProperty ("InitString", init_string);

        server->AttachWindow (name, window, properties);
      }
    }
开发者ID:untgames,项目名称:funner,代码行数:32,代码来源:engine_scene_render_server.cpp

示例4: Parse

void XmlSceneParser::Parse (const ParseNode& decl, Node& parent, SceneContext& context)
{
  try
  {
    for (Parser::Iterator iter=decl.First (); iter; ++iter)
    {
      try
      {
        ParseNode decl = *iter;

        const char* type = decl.Name ();

        Impl::ParserMap::iterator iter = impl->parsers.find (type);

        if (iter == impl->parsers.end () || !iter->second.parse_handler)
          continue; //игнорирование неизвестных узлов

        iter->second.parse_handler (decl, parent, context);
      }
      catch (std::exception& e)
      {
        if (!context.FilterError (e.what ()))
          throw;
        
        print_log (context.LogHandler (), e.what ());
      }
      catch (...)            
      {
        static const char* ERROR_STRING = "unknown exception";
        
        if (!context.FilterError (ERROR_STRING))
          throw;        

        print_log (context.LogHandler (), ERROR_STRING);
      }
    }    
  }
  catch (xtl::exception& e)
  {
    e.touch ("scene_graph::XmlSceneParser::ParseDispatch");
    throw;
  }  
}
开发者ID:untgames,项目名称:funner,代码行数:43,代码来源:sg_xml_scene_parser.cpp

示例5: WindowInputDriverSubsystem

///Конструктор
    WindowInputDriverSubsystem (ParseNode& node)
    {
      for (Parser::NamesakeIterator iter=node.First ("Device"); iter; ++iter)
        devices.push_back (DevicePtr (new WindowDevice (*iter), false));
    }
开发者ID:untgames,项目名称:funner,代码行数:6,代码来源:engine_window_input_driver.cpp


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