本文整理汇总了C++中Array::Begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Array::Begin方法的具体用法?C++ Array::Begin怎么用?C++ Array::Begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Array
的用法示例。
在下文中一共展示了Array::Begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteSolutionFolderListings
// WriteSolutionConfigs
//------------------------------------------------------------------------------
void SLNGenerator::WriteSolutionFolderListings( const Array< SLNSolutionFolder > & folders,
Array< AString > & solutionFolderPaths )
{
// Create every intermediate path
const SLNSolutionFolder * const foldersEnd = folders.End();
for( const SLNSolutionFolder * it = folders.Begin() ; it != foldersEnd ; ++it )
{
if ( solutionFolderPaths.Find( it->m_Path ) == nullptr )
{
solutionFolderPaths.Append( it->m_Path );
}
const char * pathEnd = it->m_Path.Find( NATIVE_SLASH );
while ( pathEnd )
{
AStackString<> solutionFolderPath( it->m_Path.Get(), pathEnd );
if ( solutionFolderPaths.Find( solutionFolderPath ) == nullptr )
{
solutionFolderPaths.Append( solutionFolderPath );
}
pathEnd = it->m_Path.Find( NATIVE_SLASH, pathEnd + 1 );
}
}
solutionFolderPaths.Sort();
// Solution Folders Listings
const AString * const solutionFolderPathsEnd = solutionFolderPaths.End();
for( const AString * it = solutionFolderPaths.Begin() ; it != solutionFolderPathsEnd ; ++it )
{
// parse solution folder name
const char * solutionFolderName = it->FindLast( NATIVE_SLASH );
solutionFolderName = solutionFolderName ? solutionFolderName + 1 : it->Get();
// generate a guid for the solution folder
AStackString<> solutionFolderGuid;
VSProjectGenerator::FormatDeterministicProjectGUID( solutionFolderGuid, *it );
// Guid must be uppercase (like visual)
solutionFolderGuid.ToUpper();
Write( "Project(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"%s\", \"%s\", \"%s\"\r\n",
solutionFolderName, solutionFolderName, solutionFolderGuid.Get() );
Write( "EndProject\r\n" );
}
}
示例2: __TargetImages_NodeActivated
void GradientsMergeMosaicInterface::__TargetImages_NodeActivated( TreeBox& sender, TreeBox::Node& node, int col )
{
int index = sender.ChildIndex( &node );
if ( index < 0 || size_type( index ) >= instance.targetFrames.Length() )
throw Error( "GradientsMergeMosaicInterface: *Warning* Corrupted interface structures" );
GradientsMergeMosaicInstance::ImageItem& item = instance.targetFrames[index];
switch ( col )
{
case 0:
// Activate the item's index number: ignore.
break;
case 1:
// Activate the item's checkmark: toggle item's enabled state.
item.enabled = !item.enabled;
UpdateTargetImageItem( index );
break;
case 2:
{
// Activate the item's path: open the image.
Array<ImageWindow> w = ImageWindow::Open( item.path );
for ( Array<ImageWindow>::iterator i = w.Begin(); i != w.End(); ++i )
i->Show();
}
break;
}
}
示例3: OcclusionCull
void Renderer::OcclusionCull(const Scene * scene, const Array<SceneObject*> & scene_objects) {
if (!scene->GetOcclusionCulling()) {
return;
}
for (auto it = scene_objects.Begin(); it != scene_objects.End(); ++it) {
RenderData* render_data = (*it)->GetRenderData();
if (render_data == nullptr) {
continue;
}
if (render_data->GetMaterial() == nullptr) {
continue;
}
//If a query was issued on an earlier or same frame and if results are
//available, then update the same. If results are unavailable, do nothing
if (!(*it)->IsQueryIssued()) {
continue;
}
GLuint query_result = GL_FALSE;
GLuint *query = (*it)->GetOcclusionArray();
glGetQueryObjectuiv(query[0], GL_QUERY_RESULT_AVAILABLE, &query_result);
if (query_result) {
GLuint pixel_count;
glGetQueryObjectuiv(query[0], GL_QUERY_RESULT, &pixel_count);
bool visibility = ((pixel_count & GL_TRUE) == GL_TRUE);
(*it)->SetVisible(visibility);
(*it)->SetQueryIssued(false);
}
}
}
示例4: GetObjectListNodes
// GetObjectListNodes
//------------------------------------------------------------------------------
bool Function::GetObjectListNodes( const BFFIterator & iter,
const Array< AString > & objectLists,
const char * inputVarName,
Dependencies & nodes ) const
{
NodeGraph & ng = FBuild::Get().GetDependencyGraph();
const AString * const end = objectLists.End();
for ( const AString * it = objectLists.Begin(); it != end; ++it )
{
const AString & objectList = *it;
// get node for the dir we depend on
Node * node = ng.FindNode( objectList );
if ( node == nullptr )
{
Error::Error_1104_TargetNotDefined( iter, this, inputVarName, objectList );
return false;
}
else if ( node->GetType() != Node::OBJECT_LIST_NODE )
{
Error::Error_1102_UnexpectedType( iter, this, inputVarName, node->GetName(), node->GetType(), Node::OBJECT_LIST_NODE );
return false;
}
nodes.Append( Dependency( node ) );
}
return true;
}
示例5: GetImportLibName
// GetImportLibName
//------------------------------------------------------------------------------
void LinkerNode::GetImportLibName( const AString & args, AString & importLibName ) const
{
// split to individual tokens
Array< AString > tokens;
args.Tokenize( tokens );
const AString * const end = tokens.End();
for ( const AString * it = tokens.Begin(); it != end; ++it )
{
if ( LinkerNode::IsStartOfLinkerArg_MSVC( *it, "IMPLIB:" ) )
{
const char * impStart = it->Get() + 8;
const char * impEnd = it->GetEnd();
// if token is exactly /IMPLIB: then value is next token
if ( impStart == impEnd )
{
++it;
// handle missing next value
if ( it == end )
{
return; // we just pretend it doesn't exist and let the linker complain
}
impStart = it->Get();
impEnd = it->GetEnd();
}
Args::StripQuotes( impStart, impEnd, importLibName );
}
}
}
示例6: Destroy
void ResourceManager::Destroy()
{
ProcessRequests();
#if defined( CARBON_DEBUG )
if ( resourceTable.Count() )
{
Array< Resource *, FrameAllocator > unreleased;
resourceTable.Dump( unreleased );
Char res_msg[512];
CARBON_TRACE( "====================================================\n" );
CARBON_TRACE( "# Some resources are leaking\n\n" );
Array< Resource * >::Iterator it = unreleased.Begin();
Array< Resource * >::ConstIterator end = unreleased.End();
for ( ; it != end; ++it )
{
Resource * res = *it;
StringUtils::FormatString( res_msg, sizeof(res_msg), "# %s | ref count : %d\n", res->GetName(), res->GetRefCount() );
CARBON_TRACE( res_msg );
}
CARBON_TRACE( "\n====================================================\n" );
}
#endif
CARBON_ASSERT( resourceTable.Count() == 0 );
}
示例7: __InputImages_NodeActivated
void HDRCompositionInterface::__InputImages_NodeActivated( TreeBox& sender, TreeBox::Node& node, int col )
{
int index = sender.ChildIndex( &node );
if ( index < 0 || size_type( index ) >= instance.images.Length() )
throw Error( "HDRCompositionInterface: *Warning* Corrupted interface structures" );
HDRCompositionInstance::ImageItem& item = instance.images[index];
switch ( col )
{
case 0:
break;
case 1:
item.enabled = !item.enabled;
UpdateInputImagesItem( index );
break;
case 2:
{
Array<ImageWindow> w = ImageWindow::Open( item.path );
for ( Array<ImageWindow>::iterator i = w.Begin(); i != w.End(); ++i )
i->Show();
}
break;
}
}
示例8: WriteNestedProjects
// WriteNestedProjects
//------------------------------------------------------------------------------
void SLNGenerator::WriteNestedProjects( const Array< AString > & solutionProjectsToFolder,
const Array< AString > & solutionFolderPaths )
{
if ( solutionProjectsToFolder.GetSize() == 0 &&
solutionFolderPaths.GetSize() == 0 )
{
return; // skip global section
}
Write( "\tGlobalSection(NestedProjects) = preSolution\r\n" );
// Write every project to solution folder relationships
const AString * const solutionProjectsToFolderEnd = solutionProjectsToFolder.End();
for( const AString * it = solutionProjectsToFolder.Begin() ; it != solutionProjectsToFolderEnd ; ++it )
{
Write( it->Get() );
}
// Write every intermediate path
const AString * const solutionFolderPathsEnd = solutionFolderPaths.End();
for( const AString * it = solutionFolderPaths.Begin() ; it != solutionFolderPathsEnd ; ++it )
{
// parse solution folder parent path
AStackString<> solutionFolderParentGuid;
const char * lastSlash = it->FindLast( NATIVE_SLASH );
if ( lastSlash )
{
AStackString<> solutionFolderParentPath( it->Get(), lastSlash );
VSProjectGenerator::FormatDeterministicProjectGUID( solutionFolderParentGuid, solutionFolderParentPath );
}
if ( solutionFolderParentGuid.GetLength() > 0 )
{
// generate a guid for the solution folder
AStackString<> solutionFolderGuid;
VSProjectGenerator::FormatDeterministicProjectGUID( solutionFolderGuid, *it );
solutionFolderGuid.ToUpper();
solutionFolderParentGuid.ToUpper();
// write parent solution folder relationship
Write( "\t\t%s = %s\r\n", solutionFolderGuid.Get(), solutionFolderParentGuid.Get() );
}
}
Write( "\tEndGlobalSection\r\n" );
}
示例9: SetEnvironment
void ExternalProcess::SetEnvironment( const StringList& environment )
{
Array<const char16_type*> vars;
for ( StringList::const_iterator i = environment.Begin(); i != environment.End(); ++i )
vars.Add( i->c_str() );
if ( (*API->ExternalProcess->SetExternalProcessEnvironment)( handle, vars.Begin(), vars.Length() ) == api_false )
throw APIFunctionError( "SetExternalProcessEnvironment" );
}
示例10: Start
void ExternalProcess::Start( const String& program, const StringList& arguments )
{
Array<const char16_type*> argv;
for ( StringList::const_iterator i = arguments.Begin(); i != arguments.End(); ++i )
argv.Add( i->c_str() );
if ( (*API->ExternalProcess->StartExternalProcess)( handle, program.c_str(), argv.Begin(), argv.Length() ) == api_false )
throw APIFunctionError( "StartExternalProcess" );
}
示例11:
// FormatName
//------------------------------------------------------------------------------
/*static*/ void DirectoryListNode::FormatName( const AString & path,
const Array< AString > * patterns,
bool recursive,
const Array< AString > & excludePaths,
const Array< AString > & excludeFiles,
AString & result )
{
ASSERT( path.EndsWith( NATIVE_SLASH ) );
AStackString<> patternString;
if ( patterns )
{
const size_t numPatterns = patterns->GetSize();
for ( size_t i=0; i<numPatterns; ++i )
{
if ( i > 0 )
{
patternString += '<';
}
patternString += (*patterns)[ i ];
}
}
result.Format( "%s|%s|%s|", path.Get(),
patternString.Get(),
recursive ? "true" : "false" );
const AString * const end = excludePaths.End();
for ( const AString * it = excludePaths.Begin(); it!=end; ++it )
{
const AString & excludePath = *it;
ASSERT( excludePath.EndsWith( NATIVE_SLASH ) );
result += excludePath;
result += '<';
}
if ( !excludeFiles.IsEmpty() )
{
result += '|';
const AString * const endFiles = excludeFiles.End();
for ( const AString * itFiles = excludeFiles.Begin(); itFiles != endFiles; ++itFiles )
{
const AString & excludedFile = *itFiles;
result += excludedFile;
result += '<';
}
}
}
示例12: AddFiles
// AddFiles
//------------------------------------------------------------------------------
void VSProjectGenerator::AddFiles( const Array< AString > & files, bool filterByExtension )
{
const AString * const fEnd = files.End();
for ( const AString * fIt = files.Begin(); fIt!=fEnd; ++fIt )
{
AddFile( *fIt, filterByExtension );
}
}
示例13: AddFiles
// AddFiles
//------------------------------------------------------------------------------
void VSProjectGenerator::AddFiles( const Array< AString > & files )
{
const AString * const fEnd = files.End();
for ( const AString * fIt = files.Begin(); fIt!=fEnd; ++fIt )
{
AddFile( *fIt );
}
}
示例14: GetDirectoryListNodeList
// GetDirectoryNodeList
//------------------------------------------------------------------------------
bool Function::GetDirectoryListNodeList( const BFFIterator & iter,
const Array< AString > & paths,
const Array< AString > & excludePaths,
const Array< AString > & filesToExclude,
bool recurse,
const Array< AString > * patterns,
const char * inputVarName,
Dependencies & nodes ) const
{
NodeGraph & ng = FBuild::Get().GetDependencyGraph();
// Handle special case of excluded files beginning with ../
// Since they can be used seinsibly by matching just the end
// of a path, assume they are relative to the working dir.
// TODO:C Move this during bff parsing when everything is using reflection
Array< AString > filesToExcludeCleaned( filesToExclude.GetSize(), true );
for ( const AString& file : filesToExclude )
{
if ( file.BeginsWith( ".." ) )
{
AStackString<> fullPath;
NodeGraph::CleanPath( file, fullPath );
filesToExcludeCleaned.Append( fullPath );
}
else
{
filesToExcludeCleaned.Append( file );
}
}
const AString * const end = paths.End();
for ( const AString * it = paths.Begin(); it != end; ++it )
{
const AString & path = *it;
// get node for the dir we depend on
AStackString<> name;
DirectoryListNode::FormatName( path, patterns, recurse, excludePaths, filesToExcludeCleaned, name );
Node * node = ng.FindNode( name );
if ( node == nullptr )
{
node = ng.CreateDirectoryListNode( name,
path,
patterns,
recurse,
excludePaths,
filesToExcludeCleaned );
}
else if ( node->GetType() != Node::DIRECTORY_LIST_NODE )
{
Error::Error_1102_UnexpectedType( iter, this, inputVarName, node->GetName(), node->GetType(), Node::DIRECTORY_LIST_NODE );
return false;
}
nodes.Append( Dependency( node ) );
}
return true;
}
示例15: ExecuteProgram
int ExternalProcess::ExecuteProgram( const String& program, const StringList& arguments )
{
Array<const char16_type*> argv;
for ( StringList::const_iterator i = arguments.Begin(); i != arguments.End(); ++i )
argv.Add( i->c_str() );
int retVal = (*API->ExternalProcess->ExecuteProgram)( program.c_str(), argv.Begin(), argv.Length() );
if ( retVal < -1 )
ExternalProcessPrivate::Throw( ExternalProcessContext::FailedToStart );
return retVal;
}