本文整理汇总了C++中stringlist::const_iterator::StartsWith方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::StartsWith方法的具体用法?C++ const_iterator::StartsWith怎么用?C++ const_iterator::StartsWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stringlist::const_iterator
的用法示例。
在下文中一共展示了const_iterator::StartsWith方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MakeAPIFilter
String FileFilter::MakeAPIFilter() const
{
String filter;
if ( !extensions.IsEmpty() )
{
if ( !description.IsEmpty() )
{
filter += description;
filter += " (";
}
for ( StringList::const_iterator i = extensions.Begin();
i != extensions.End();
++i )
{
if ( i != extensions.Begin() )
filter += ' '; // also legal are ';' and ','
if ( i->StartsWith( '.' ) )
filter += '*';
filter += *i;
}
if ( !description.IsEmpty() )
filter += ')';
}
return filter;
}
示例2: ExtractArguments
ArgumentList ExtractArguments( const StringList& argv, argument_item_mode mode, ArgumentOptions options )
{
bool noItems = mode == ArgumentItemMode::NoItems;
bool itemsAsFiles = mode == ArgumentItemMode::AsFiles;
bool itemsAsViews = mode == ArgumentItemMode::AsViews;
bool allowWildcards = !noItems && options.IsFlagSet( ArgumentOption::AllowWildcards );
bool noPreviews = itemsAsViews && options.IsFlagSet( ArgumentOption::NoPreviews );
bool recursiveDirSearch = itemsAsFiles && allowWildcards && options.IsFlagSet( ArgumentOption::RecursiveDirSearch );
bool recursiveSearchArgs = recursiveDirSearch && options.IsFlagSet( ArgumentOption::RecursiveSearchArgs );
// This is the recursive search mode flag, controlled by --r[+|-]
bool recursiveSearch = false;
// The list of existing view identifiers, in case itemsAsViews = true.
SortedStringList imageIds;
// The list of extracted arguments
ArgumentList arguments;
for ( StringList::const_iterator i = argv.Begin(); i != argv.End(); ++i )
{
if ( i->StartsWith( '-' ) )
{
Argument arg( i->At( 1 ) );
if ( recursiveSearchArgs && arg.Id() == s_recursiveSearchArg )
{
if ( arg.IsSwitch() )
recursiveSearch = arg.SwitchState();
else if ( arg.IsLiteral() )
recursiveSearch = true;
else
arguments.Add( arg );
}
else
arguments.Add( arg );
}
else
{
if ( noItems )
throw ParseError( "Non-parametric arguments are not allowed", *i );
StringList items;
if ( itemsAsFiles )
{
String fileName = *i;
if ( fileName.StartsWith( '\"' ) )
fileName.Delete( 0 );
if ( fileName.EndsWith( '\"' ) )
fileName.Delete( fileName.UpperBound() );
fileName.Trim();
if ( fileName.IsEmpty() )
throw ParseError( "Empty path specification", *i );
fileName = File::FullPath( fileName );
if ( fileName.HasWildcards() )
{
if ( !allowWildcards )
throw ParseError( "Wildcards not allowed", fileName );
items = SearchDirectory( fileName, recursiveSearch );
}
else
items.Add( fileName );
}
else if ( itemsAsViews )
{
String viewId = *i;
if ( !allowWildcards )
if ( viewId.HasWildcards() )
throw ParseError( "Wildcards not allowed", viewId );
size_type p = viewId.Find( "->" );
if ( p != String::notFound )
{
if ( noPreviews )
throw ParseError( "Preview identifiers not allowed", viewId );
String imageId = viewId.Left( p );
if ( imageId.IsEmpty() )
throw ParseError( "Missing image identifier", viewId );
String previewId = viewId.Substring( p+2 );
if ( previewId.IsEmpty() )
throw ParseError( "Missing preview identifier", viewId );
FindPreviews( items, imageId, previewId );
}
else
{
if ( viewId.HasWildcards() )
{
Array<ImageWindow> W = ImageWindow::AllWindows();
for ( size_type i = 0; i < W.Length(); ++i )
{
//.........这里部分代码省略.........