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


C++ csRef::AttachNew方法代码示例

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


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

示例1: csScanPluginDirs

csRef<iStringArray> csScanPluginDirs (csPathsList* dirs, 
				    csRef<iStringArray>& plugins)
{
  iStringArray* messages = 0;

  if (!plugins)
    plugins.AttachNew (new scfStringArray ());

  for (size_t i = 0; i < dirs->Length (); i++)
  {
    iStringArray* dirMessages = 0;
    InternalScanPluginDir (dirMessages, (*dirs)[i].path, plugins, 
      (*dirs)[i].scanRecursive);
    
    if (dirMessages != 0)
    {
      csString tmp;
      tmp.Format ("The following error(s) occured while scanning '%s':",
	(*dirs)[i].path.GetDataSafe ());

      AppendStrVecString (messages, tmp);

      for (size_t i = 0; i < dirMessages->GetSize(); i++)
      {
	tmp.Format (" %s", dirMessages->Get (i));
	AppendStrVecString (messages, tmp);
      }
      dirMessages->DecRef();
    }
  }
	 
  return csPtr<iStringArray> (messages);
}
开发者ID:garinh,项目名称:cs,代码行数:33,代码来源:scanplugins.cpp

示例2: csScanPluginDir

csRef<iStringArray> csScanPluginDir (const char* dir, 
				   csRef<iStringArray>& plugins,
				   bool recursive)
{
  iStringArray* messages = 0;

  if (!plugins)
    plugins.AttachNew (new scfStringArray ());

  InternalScanPluginDir (messages, dir, plugins, 
    recursive);
	 
  return csPtr<iStringArray> (messages);
}
开发者ID:garinh,项目名称:cs,代码行数:14,代码来源:scanplugins.cpp

示例3: Run

    void Run()
    {
        {
            CS::Threading::MutexScopedLock lock (doneMutex);
            // construct the netManager is its own thread to avoid wrong warnings of dynamic thread checking via valgrind
            netManager.AttachNew(new NetManager(thread));
            if (!netManager->Initialize(client_firstmsg, npcclient_firstmsg,
                                        timeout))
            {
                Error1 ("Network thread initialization failed!\nIs there already a server running?");
                delete netManager;
                netManager = NULL;
                initDone.NotifyAll();
                return;
            }
            initDone.NotifyAll();
        }

        /* run the network loop */
        netManager->Run();
    }
开发者ID:garinh,项目名称:planeshift,代码行数:21,代码来源:netmanager.cpp

示例4: RegisterWeakListener

csHandlerID RegisterWeakListener (iEventQueue *q, iEventHandler *listener,
  const csEventID ename[], csRef<iEventHandler> &handler)
{
  handler.AttachNew (new csWeakEventHandler (listener));
  return q->RegisterListener (handler, ename);
}
开发者ID:crystalspace,项目名称:CS,代码行数:6,代码来源:event.cpp

示例5: LoadPrerequisiteXML

bool LoadPrerequisiteXML(iDocumentNode * topNode, psQuest * self, csRef<psQuestPrereqOp>& prerequisite)
{
    // Recursively decode the xml document and generate prerequisite operators.

    if ( strcmp( topNode->GetValue(), "pre" ) == 0 )
    {
        // This is the top node. Only one node is legal.

        csRef<iDocumentNodeIterator> iter = topNode->GetNodes();

        while ( iter->HasNext() )
        {
            csRef<iDocumentNode> node = iter->Next();

            if ( node->GetType() != CS_NODE_ELEMENT )
                continue;

            if (!LoadPrerequisiteXML(node, self, prerequisite))
            {
                return false;
            }

            break;
        }
    }
    else if ( strcmp( topNode->GetValue(), "completed" ) == 0 )
    {
        if (topNode->GetAttributeValue("quest"))
        {
            csString name = topNode->GetAttributeValue("quest");
            psQuest * quest;
            if (name == "self")
            {
                quest = self;
            }
            else
            {
                quest = CacheManager::GetSingleton().GetQuestByName( name );
            }

            if (quest)
            {
                prerequisite.AttachNew(new psQuestPrereqOpQuestCompleted(quest));
            }
            else
            {
                Error2("Can't find quest %s while loading prerequisite script",
                       topNode->GetAttributeValue("quest"));
            }
        }
        else if (topNode->GetAttributeValue("category"))
        {
            int min = -1,max = -1;
            csString category = topNode->GetAttributeValue("category");
            if (topNode->GetAttributeValue("min")) min = topNode->GetAttributeValueAsInt("min");
            if (topNode->GetAttributeValue("max")) max = topNode->GetAttributeValueAsInt("max");
            if (min == -1 && max == -1)
            {
                Error1("Both min and max is -1, seting min to 1");
                min = 1;
            }
            prerequisite.AttachNew(new psQuestPrereqOpQuestCompletedCategory(category,min,max));
        }
        else
        {
            Error1("No attrib of quest or category in the completed node.");
            return false;
        }
    }
    else if ( strcmp( topNode->GetValue(), "assigned" ) == 0 )
    {
        csString name = topNode->GetAttributeValue("quest");
        psQuest * quest;
        if (name == "self")
        {
            quest = self;
        } else
        {
            quest = CacheManager::GetSingleton().GetQuestByName( name );
        }
        if (quest)
        {
            prerequisite.AttachNew(new psQuestPrereqOpQuestAssigned(quest));
        }
        else
        {
            Error2("Can't find quest %s while loading prerequisite script",
                   topNode->GetAttributeValue("quest"));
            return false;
        }
    }
    else if ( strcmp( topNode->GetValue(), "and" ) == 0 )
    {
        csRef<psQuestPrereqOpList> list;
        list.AttachNew(new psQuestPrereqOpAnd());
        prerequisite = list;

        csRef<iDocumentNodeIterator> iter = topNode->GetNodes();

        while ( iter->HasNext() )
//.........这里部分代码省略.........
开发者ID:garinh,项目名称:planeshift,代码行数:101,代码来源:psquest.cpp


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