• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ VArray类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __glob_gdn

 void __glob_gdn( const char* a_path, const char* a_fnpattern, 
                  VArray &a_va ) // glob getdirname
 {
   VString pat = a_fnpattern;
   pat += "*";
   
   a_va.undef();
   DIR *dir;
   dirent *de; 
   if ( !a_path || a_path[0] == 0 ) 
     dir = opendir(".");
   else 
     dir = opendir( a_path );
   if (dir) 
     { 
     while ( (de = readdir(dir)) )
       { 
       if ( strcmp( de->d_name, "." ) == 0 || 
            strcmp( de->d_name, ".." ) == 0 ) continue;
       if ( a_fnpattern[0] == 0 || FNMATCH( pat, de->d_name)==0 )
         { 
         VString str; // = a_path;
         str += de->d_name;
         if ( file_is_dir( a_path + str ) ) 
           {
           str += "/";
           a_va.push(str);
           }
         } 
       } 
     closedir(dir); 
     } 
 }
开发者ID:svilendobrev,项目名称:svd_bin,代码行数:33,代码来源:vfudir.cpp


示例2: str_split_simple

  // split `source' with exact string `delimiter_str'
  VArray str_split_simple( const char* delimiter_str, const char* source, int maxcount )
  {
    VArray arr;
    const char* ps = source;
    const char* fs;

    int rl = strlen( delimiter_str );

    VString s;
    while( (fs = strstr( ps, delimiter_str )) )
      {
      if ( maxcount != -1 )
        {
        maxcount--;
        if ( maxcount == 0 ) break;
        }
      int l = fs - ps;
      s.setn( ps, l );
      arr.push( s );
      ps = (const char *)(ps + l + rl);
      }
    if ( ps && ps[0] )
      arr.push( ps );
    return arr;
  }
开发者ID:cade-vs,项目名称:vstring,代码行数:26,代码来源:vstrlib.cpp


示例3: str_split

  // split `source' with `regexp_str' regexp
  VArray str_split( const char* regexp_str, const char* source, int maxcount )
  {
    VArray arr;
    VRegexp re;
    int z = re.comp( regexp_str );
    ASSERT( z );
    if ( ! z ) return arr;

    const char* ps = source;

    while( ps && ps[0] && re.m( ps ) )
      {
      if ( maxcount != -1 )
        {
        maxcount--;
        if ( maxcount == 0 ) break;
        }
      VString s;
      s.setn( ps, re.sub_sp( 0 ) );
      arr.push( s );
      ps += re.sub_ep( 0 );
      }
    if ( ps && ps[0] )
      arr.push( ps );
    return arr;
  }
开发者ID:cade-vs,项目名称:vstring,代码行数:27,代码来源:vstrlib.cpp


示例4: vfu_load_dir_colors

void vfu_load_dir_colors()
{
  #ifdef _TARGET_UNIX_

  VArray va;
  va.fload( "/etc/DIR_COLORS" );
  if (va.count() == 0) return;

  while( va.count() )
    {
    VString str = va[0];
    va.del( 0 );
    int comment = str_find( str, '#' );
    if ( comment != -1 ) str_sleft( str, comment );
    str_cut( str, " \t" );
    if ( str_len( str ) == 0 ) continue;

    if ( strncmp( str, "TERM "   , 5 ) == 0 ) continue;
    if ( strncmp( str, "COLOR "  , 6 ) == 0 ) continue;
    if ( strncmp( str, "OPTIONS ", 8 ) == 0 ) continue;

    int pos = -1;
    if ( str_find( str, "31" ) != -1 ) pos = cRED; else
    if ( str_find( str, "32" ) != -1 ) pos = cGREEN; else
    if ( str_find( str, "33" ) != -1 ) pos = cYELLOW; else
    if ( str_find( str, "34" ) != -1 ) pos = cBLUE; else
    if ( str_find( str, "35" ) != -1 ) pos = cMAGENTA; else
    if ( str_find( str, "36" ) != -1 ) pos = cCYAN; else
    if ( str_find( str, "37" ) != -1 ) pos = cWHITE; else
    ;

    int spc = str_find( str, ' ' );
    if ( spc == -1 || pos == -1 ) continue;
    str_sleft( str, spc );

    str_replace( str, "DIR", ".[].<>" );
    str_replace( str, "LINK", ".->" );
    str_replace( str, "FIFO", ".()" );
    str_replace( str, "SOCK", ".##" );
    str_replace( str, "BLK", ".==" );
    str_replace( str, "CHR", ".++" );
    str_replace( str, "EXEC", ".**" );

    str_ins( ext_colors[pos], 0, str );

    };

  for ( int z = 0; z < 16; z++ )
    if( str_len( ext_colors[z] ) > 0 )
      {
      ext_colors[z] += ".";
      if ( opt.lower_case_ext_config )
        str_low( ext_colors[z] );
      }

  #endif /* _TARGET_UNIX_ */
}
开发者ID:bbonev,项目名称:vfu,代码行数:57,代码来源:vfuopt.cpp


示例5: str_join

 // join array data to single string with `glue' string
 // returns the result string or store to optional `dest'
 VString str_join( VArray array, const char* glue )
 {
   VString str;
   for( int z = 0; z < array.count()-1; z++ )
     {
     str += array.get( z );
     str += glue;
     }
   str += array.get( array.count()-1 );
   return str;
 }
开发者ID:cade-vs,项目名称:vstring,代码行数:13,代码来源:vstrlib.cpp


示例6: set_arr

int set_arr( const char *line, const char *keyword, VArray &target )
{
  VRegexp re("^[ \011]*([a-zA-Z0-9]+)[ \011]*=[ \011]*(.+)");
  if ( ! re.m( line ) ) return 0;
  if ( str_low( re[1] ) != keyword ) return 0;
  target.push( re[2] );
  return 1;
}
开发者ID:bbonev,项目名称:vfu,代码行数:8,代码来源:vfuopt.cpp


示例7: if

void VThumbnailManager::ProcessPendingThumbnails()
{
  if (s_PendingTasks.GetSize() == 0)
    return;

  PendingThumbnail& pendingThumbnail = s_PendingTasks[0];
  VLoadingTask* pTask = pendingThumbnail.spTask;

  if (pTask->GetState() == TASKSTATE_UNASSIGNED)
  {
    pTask->ScheduleLoadingTask();
  }
  else if (pTask->GetState() == TASKSTATE_FINISHED)
  {
    VArray<VSceneListEntry>& list = pendingThumbnail.pDataProvider->GetData();
    int iEntryIndex = list.Find(pendingThumbnail.entry); // entry might have been moved or deleted in the meantime
    
    if (iEntryIndex >= 0)
    {
      VSceneListEntry& entry = list[iEntryIndex];

      if (pTask->IsValid())
      {
        VASSERT(pTask->IsLoaded());

        entry.spThumbnail = Vision::TextureManager.Load2DTexture(pendingThumbnail.sFileName, 
          VTM_FLAG_DEFAULT_NON_MIPMAPPED|VTM_FLAG_NO_DOWNSCALE);
      }
      else
      {
        entry.spThumbnail = s_spDefaultThumbnail;
      }

      VSceneListEvent data(&pendingThumbnail.pDataProvider->m_OnDataChanged, -1, iEntryIndex, VSceneListEvent::DATA_CHANGED);
      data.Trigger();
    }

    s_PendingTasks.RemoveAt(0);
  }
}
开发者ID:guozanhua,项目名称:projectanarchy,代码行数:40,代码来源:vThumbnailManager.cpp


示例8: ComputePath

bool vHavokAiModule::ComputePath(hkvVec3* startPoint, hkvVec3* endPoint, float radius, VArray<hkvVec3>& pathPoints) const
{
	hkaiPathfindingUtil::FindPathInput input(1);
	hkaiPathfindingUtil::FindPathOutput output;
	if(!_ComputePath(m_aiWorld, startPoint, endPoint, radius, input, output))
		return false;

	for (int i = 0; i < output.m_pathOut.getSize(); i++)
	{
		const hkaiPath::PathPoint& pt = output.m_pathOut[i];
		hkvVec3 vPos; vHavokConversionUtils::PhysVecToVisVecWorld(pt.m_position, vPos); 
		pathPoints.Add(vPos);
	}

	return true;
}
开发者ID:RexBaribal,项目名称:projectanarchy,代码行数:16,代码来源:vHavokAiModule.cpp


示例9: havokStreamReader

bool vHavokAiModule::LoadNavMeshDeprecated(const char* filename, VArray<vHavokAiNavMeshInstance*>* navMeshInstancesOut)
{
	if (!Vision::File.Exists(filename))
	{
		return false;
	}

	vHavokStreamReader havokStreamReader(filename);
	if (!havokStreamReader.isOk())
	{
		return false;
	}

	hkBufferedStreamReader bufferedStreamReader(&havokStreamReader);
	if (!bufferedStreamReader.isOk())
	{
		return false;
	}

	VArray<vHavokAiNavMeshResource*> navMeshResources;
	{
		hkArray< hkRefPtr<hkaiNavMesh> > navMeshes;
		hkArray< hkRefPtr<hkaiNavMeshQueryMediator> > mediators;
		hkObjectResource* res = hkSerializeUtil::loadOnHeap(&bufferedStreamReader);
		hkRootLevelContainer* container = res->getContents<hkRootLevelContainer>();
		if (container)
		{
			hkaiNavMesh* navMesh = container->findObject<hkaiNavMesh>();
			hkaiNavMeshQueryMediator* mediator = container->findObject<hkaiStaticTreeNavMeshQueryMediator>();

			while(navMesh)
			{
				navMeshes.pushBack(navMesh);
				mediators.pushBack(mediator);

				navMesh = container->findObject<hkaiNavMesh>(navMesh);
				mediator = container->findObject<hkaiStaticTreeNavMeshQueryMediator>(mediator);
			}
		}
		else
		{
			// dkw.note: loading legacy asset that didn't use a hkRootLevelContainer
			hkaiNavMesh* navMesh = res->getContents<hkaiNavMesh>();

			if (navMesh == HK_NULL)
			{
				return false;
			}

			navMeshes.pushBack(navMesh);
			mediators.pushBack(HK_NULL);
		}

		res->removeReference();
		if (navMeshes.getSize() == 0)
		{
			return false;
		}

		for (int i = 0; i < navMeshes.getSize(); i++)
		{
			if (mediators[i] == HK_NULL)
			{
				VASSERT(navMeshes[i]->getReferenceCount() == 1);
				mediators[i].setAndDontIncrementRefCount(hkaiNavMeshUtils::setupQueryMediator( *navMeshes[i] ));
			}
			else
			{
				VASSERT(navMeshes[i]->getReferenceCount() == 2);
			}

			VASSERT(mediators[i]->getReferenceCount() == 1);
			vHavokAiNavMeshResource* resource = new vHavokAiNavMeshResource(navMeshes[i], mediators[i]);
			VASSERT(navMeshes[i]->getReferenceCount() == 3);
			VASSERT(mediators[i]->getReferenceCount() == 2);
			navMeshResources.Add(resource);
		}
	}

	VArray<vHavokAiNavMeshInstance*> navMeshInstancesLocal;
	VArray<vHavokAiNavMeshInstance*>* navMeshInstancesPtr;
	if (navMeshInstancesOut != HK_NULL)
	{
		navMeshInstancesPtr = navMeshInstancesOut;
	}
	else
	{
		navMeshInstancesPtr = &navMeshInstancesLocal;
	}

	hkaiWorld* aiWorld = GetAiWorld();
	for (int i = 0; i < navMeshResources.GetLength(); i++)
	{
		VASSERT(navMeshResources[i]->GetNavMesh()->getReferenceCount() == 2);
		VASSERT(navMeshResources[i]->GetNavMeshQueryMediator()->getReferenceCount() == 1);
		vHavokAiNavMeshInstance* navMeshInstance = new vHavokAiNavMeshInstance(navMeshResources[i], i);
		VASSERT(navMeshResources[i]->GetNavMesh()->getReferenceCount() == 3);
		VASSERT(navMeshResources[i]->GetNavMeshQueryMediator()->getReferenceCount() == 1);

		navMeshInstance->AddNavMeshToWorld(aiWorld);
//.........这里部分代码省略.........
开发者ID:RexBaribal,项目名称:projectanarchy,代码行数:101,代码来源:vHavokAiModule.cpp


示例10: Update

 void Update(VArray<float>& values) { values.Append(Vision::GetTimer()->GetTimeDifference()); }
开发者ID:guozanhua,项目名称:projectanarchy,代码行数:1,代码来源:VDebugOptions.cpp


示例11: vfu_extract_files

void vfu_extract_files( int one )
{
  if ( sel_count == 0 && one == 0 ) one = 1;
  char t[MAX_PATH];
  VString target;

  if ( one == 0 )
    sprintf( t, "EXTRACT SELECTION to: " );
  else
    sprintf( t, "EXTRACT `%s' to:", files_list[FLI]->full_name() );

  target = opt.last_copy_path[ CM_COPY ];
  if ( !vfu_get_dir_name( t, target ) ) return;

  strcpy( opt.last_copy_path[ CM_COPY ], target );

  VArray va;

  int z;
  for( z = 0; z < files_count; z++ )
    if ((files_list[z]->sel && one == 0) || (z == FLI && one != 0))
      va.push( files_list[z]->full_name() );

  if (chdir(target))
    {
    sprintf( t, "Cannot chdir to: %s", target.data() );
    say1( t );
    say2errno();
    return;
    }

  VString tmpfile = vfu_temp();
  if (va.fsave( tmpfile ))
    {
    sprintf( t, "Error writing list file: %s", tmpfile.data() );
    say1( t );
    return;
    }
  chmod( tmpfile, S_IRUSR|S_IWUSR );

  VString s;
  s = "rx_auto x \"";
  s += work_path;
  s += archive_name;
  s += "\" @";
  s += tmpfile;
  s += " 2> /dev/null";

  vfu_shell( s, "" );

  if (unlink( tmpfile ))
    {
    /*
    sprintf( t, "Cannot unlink/erase temp file: %s", tmpfile );
    say2( t );
    */
    }
  if (chdir(work_path))
    {
    sprintf( t, "Cannot chdir back to to: %s", work_path.data() );
    say1( t );
    say2errno();
    return;
    }
  say1( "EXTRACT ok." );
};
开发者ID:svilendobrev,项目名称:svd_bin,代码行数:66,代码来源:vfuarc.cpp


示例12: if

 // Comparison operators.
 inline bool operator==(const VArray& rhs)   { int n=GetLength(); if(n!=rhs.GetLength()) return false; for(int i=0; i<n; ++i) { if((*this)[i] != rhs[i]) return false; } return true; }
开发者ID:cDoru,项目名称:projectanarchy,代码行数:2,代码来源:VArray.hpp


示例13: accumRect

TERRAIN_IMPEXP int VTextureWeightmapChannelCollection::GetMostRelevantChannels(const hkvRect& region, VTextureWeightmapChannel **pDestList, int iMaxCount, float fTolerance/*=1.f/255.f*/ )
{
  fTolerance *= region.getWidth() * region.getHeight();

  hkvRect accumRect(0, 0, region.getWidth(), region.getHeight());

  VLuminanceChannelPtr spAccum = new VLuminanceChannel(region.getWidth(), region.getHeight(), 0);

  // Compute visibility for each channel
  VArray<ChannelAndKey> channels;

  DynArray_cl<bool> channelUsed(Count(), false);

  for(int channelIdx = Count() - 1; channelIdx >= 0; channelIdx--)
  {
    ChannelAndKey channelAndKey;
    channelAndKey.m_index = channelIdx;
    channelAndKey.m_channel = GetAt(channelIdx);

    if(channelAndKey.m_channel->IsBlack() || channelAndKey.m_channel->m_spResource->IsHidden())
    {
      continue;
    }

    channelAndKey.m_key = channelAndKey.m_channel->AlphaMaskCompare(region, accumRect, spAccum);

    if(channelAndKey.m_key < fTolerance)
    {
      continue;
    }

    channels.Append(channelAndKey);

    if (channelIdx > 0)
    {
      spAccum->Blend(accumRect, region, channelAndKey.m_channel);
    }
  }

  qsort(channels.GetData(), channels.GetSize(), sizeof(ChannelAndKey), ChannelAndKey::Compare);

  // Mark at most maxChannels channels in order of relevance
  for(int listIdx = 0; listIdx < channels.GetSize(); listIdx++)
  {
    if(listIdx >= iMaxCount)
    {
      break;
    }

    channelUsed[channels[listIdx].m_index] = true;
  }

  // Write out the marked channels in original order
  int numUsedChannels = 0;
  for(int channelIdx = 0; channelIdx < Count(); channelIdx++)
  {
    if(channelUsed[channelIdx])
    {
      pDestList[numUsedChannels] = GetAt(channelIdx);
      numUsedChannels++;
    }
  }

  return numUsedChannels;
}
开发者ID:Alagong,项目名称:projectanarchy,代码行数:65,代码来源:TextureWeightmapChannel.cpp


示例14: AddRenderStateContainerToWrite

  int AddRenderStateContainerToWrite (VRenderStateContainer* pRenderState)
  {
    int i = 0;
    for (; i < m_RenderStateContainersToWrite.GetLength (); ++i)
    {
      if (m_RenderStateContainersToWrite[i] == pRenderState)
        return (i);
    }

    m_RenderStateContainersToWrite.Add (pRenderState);
    return (i);
  }
开发者ID:Alagong,项目名称:projectanarchy,代码行数:12,代码来源:vShaderEffectLib.hpp


示例15: DeInit

void VThumbnailManager::DeInit()
{
  if (s_PendingTasks.GetSize() > 0)
  {
    VLoadingTask* pTask = s_PendingTasks[0].spTask;
    Vision::GetThreadManager()->WaitForTask(pTask, true);
  }

  s_PendingTasks.Reset();

  s_spDefaultThumbnail = NULL;
  s_spLoadingThumbnail = NULL;
}
开发者ID:guozanhua,项目名称:projectanarchy,代码行数:13,代码来源:vThumbnailManager.cpp


示例16: size_cache_set

void size_cache_set( const char *s, fsize_t size, int sort )
{
  int z = size_cache_index( s );
  if ( z != -1 )
    {
    size_cache.set( z, size_cache_compose_key( s, size ) );
    }
  else
    {
    size_cache.push( size_cache_compose_key( s, size ) );
    if( sort )
      size_cache.sort( 0, size_cache_cmp );
    }
}
开发者ID:svilendobrev,项目名称:svd_bin,代码行数:14,代码来源:vfudir.cpp


示例17: LoadThumbnail

void VThumbnailManager::LoadThumbnail(ISceneListDataProvider* pDataProvider, int iEntryIndex)
{
  VSceneListEntry& entry = pDataProvider->GetData()[iEntryIndex];
  entry.spThumbnail = s_spLoadingThumbnail;

  // search for thumbnail, only test the first search path
  char szFullPath[FS_MAX_PATH];
  char szThumbnailFileName[FS_MAX_PATH];

  VFileHelper::CombineDirAndFile(szFullPath, entry.sSearchPaths[0], entry.sScenePath);
  VFileHelper::ReplaceExtension(szThumbnailFileName, szFullPath, "tga");

  if (VTextureObject* pThumbnail = static_cast<VTextureObject*>(VTextureManager::GlobalManager().GetResourceByName(szThumbnailFileName)))
  {
    entry.spThumbnail = pThumbnail;
  }
  else
  {
    PendingThumbnail pendingThumbnail;
    pendingThumbnail.pDataProvider = pDataProvider;
    pendingThumbnail.entry = entry;
    pendingThumbnail.sFileName = szThumbnailFileName;
    pendingThumbnail.spTask = Vision::File.GetMemoryStreamManager().PrecacheFile(szThumbnailFileName);

    s_PendingTasks.Add(pendingThumbnail);
  }
  
}
开发者ID:guozanhua,项目名称:projectanarchy,代码行数:28,代码来源:vThumbnailManager.cpp


示例18: size_cache_clean

void size_cache_clean( const char *s )
{
  VString str = size_cache_compose_key( s, 0 );
  str_trim_left( str, SIZE_CACHE_OFFSET_CLEAN );
  int sl = str_len( str );
  int z = 0;
  while( z < size_cache.count() )
    {
    const char* ps = size_cache[z].data() + SIZE_CACHE_OFFSET_CLEAN;
    if ( ( strncmp( ps, str, sl ) == 0 && (ps[sl] == '/' || ps[sl] == 0) )
         ||
         ( size_cache[z][SIZE_CACHE_OFFSET_CLEAN] != '|' ) )
      size_cache.del( z );
    else
      z++;
    }
}
开发者ID:svilendobrev,项目名称:svd_bin,代码行数:17,代码来源:vfudir.cpp


示例19: size_cache_index

int size_cache_index( const char *s )
{
  if ( size_cache.count() == 0 ) return -1;
  VString str = size_cache_compose_key( s, 0 );
  int l = 0;
  int h = size_cache.count() - 1;
  int m = h;
  while(4)
    {
    int r =  size_cache_cmp( size_cache[m], str );
    if ( l == m && r != 0 )
      return -1;
    if ( r > 0 )
      h = m; else
    if ( r < 0 )
      l = m; 
    else
      return m;
    m = ( l + h ) / 2;
    }
}
开发者ID:svilendobrev,项目名称:svd_bin,代码行数:21,代码来源:vfudir.cpp


示例20: tree_rebuild

void tree_rebuild()
{
#ifdef _TARGET_GO32_
// we do need only files sizes -- so the other stuff under dos is unneeded :)
_djstat_flags = _STAT_INODE | _STAT_EXEC_EXT | _STAT_EXEC_MAGIC |
                _STAT_EXEC_MAGIC | _STAT_DIRSIZE | _STAT_ROOT_TIME |
                _STAT_WRITEBIT;
// _djstat_flags = 0;
#endif
  dir_tree.undef();
  size_cache.undef();
  say1( "Rebuilding tree..." );
  
  __tree_rebuild_process( "/" );
  
  tree_fix();
#ifdef _TARGET_GO32_
 _djstat_flags = 0;
#endif

  dir_tree_changed = 1;
  tree_save();
};
开发者ID:svilendobrev,项目名称:svd_bin,代码行数:23,代码来源:vfudir.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ VAttachIter类代码示例发布时间:2022-05-31
下一篇:
C++ VArchive类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap