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


C++ Doc::urlModifier方法代码示例

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


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

示例1: load

bool VrmlScene::load(const char *url, const char *localCopy)
{
  // Look for '#Viewpoint' syntax. There ought to be a current
  // scene if this format is used.
  VrmlSFBool flag(true);
  if (*url == '#')
    {
      VrmlNode *vp = d_namespace ? d_namespace->findNode(url+1) : 0;

      // spec: ignore if named viewpoint not found
      if (vp)
	{
	  vp->eventIn( theSystem->time(), "set_bind", &flag );
	  setModified();
	}

      return true;
    }

  // Try to load a file. Prefer a local copy if available.
  Doc *tryUrl;
  if (localCopy)
    tryUrl = new Doc( localCopy, 0 );
  else
    tryUrl = new Doc( url, d_url);

  VrmlNamespace *newScope = new VrmlNamespace();
  VrmlMFNode *newNodes = readWrl( tryUrl, newScope );
  if ( newNodes )
    {
      Doc *sourceUrl = tryUrl, *urlLocal = 0;
      if (localCopy)
	{
	  sourceUrl = new Doc( url );
	  urlLocal = tryUrl;
	}
      
      replaceWorld( *newNodes, newScope, sourceUrl, urlLocal );
      delete newNodes;

      // Look for '#Viewpoint' syntax
      if ( sourceUrl->urlModifier() )
	{
	  VrmlNode *vp = d_namespace->findNode( sourceUrl->urlModifier()+1 );
	  double timeNow = theSystem->time();
	  if (vp)
	    vp->eventIn( timeNow, "set_bind", &flag );
	}

      return true;      // Success.
    }

  delete tryUrl;
  return false;
}
开发者ID:DimondTheCat,项目名称:xray,代码行数:55,代码来源:VrmlScene.cpp

示例2: readPROTO

VrmlNodeType* VrmlScene::readPROTO( VrmlMFString *urls, Doc *relative )
{
  // This is a problem. The nodeType of the EXTERNPROTO has a namespace
  // that refers back to this namespace (protos), which will be invalid
  // after we exit this function. I guess it needs to be allocated and
  // ref counted too...
  VrmlNamespace protos;
  Doc urlDoc;
  VrmlNodeType* def = 0;
  int i, n = urls->size();

  theSystem->debug("readPROTO\n");

  for (i=0; i<n; ++i)
    {
      //theSystem->debug("Trying to read url '%s'\n", urls->get(i));
      urlDoc.seturl( urls->get(i), relative );
      VrmlMFNode *kids = VrmlScene::readWrl( &urlDoc, &protos );
      if ( kids ) delete kids;

      // Grab the specified PROTO, or the first one.
      const char *whichProto = urlDoc.urlModifier();
      if (*whichProto)
	def = (VrmlNodeType*) protos.findType( whichProto+1 );
      else
	def = (VrmlNodeType*) protos.firstType();

      if (def)
	{
	  def->setActualUrl( urlDoc.url() );
	  break;
	}
      else if (i < n-1 && strncmp(urls->get(i),"urn:",4))
        theSystem->warn("Couldn't read EXTERNPROTO url '%s': %s\n",
			urls->get(i), strerror( errno));
    }

  return def;
}
开发者ID:DimondTheCat,项目名称:xray,代码行数:39,代码来源:VrmlScene.cpp


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