本文整理汇总了C++中StringList::End方法的典型用法代码示例。如果您正苦于以下问题:C++ StringList::End方法的具体用法?C++ StringList::End怎么用?C++ StringList::End使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringList
的用法示例。
在下文中一共展示了StringList::End方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FromString
bool FileDataCacheItem::FromString( const String& s )
{
path.Clear();
lastUsed = 0;
time.year = 0;
StringList tokens;
s.Break( tokens, char16_type( '\n' ) );
for ( StringList::const_iterator i = tokens.Begin(); i != tokens.End(); )
{
if ( *i == "path" )
{
if ( ++i == tokens.End() )
return false;
path = i->Trimmed();
++i;
}
else if ( *i == "lastUsed" )
{
if ( ++i == tokens.End() )
return false;
lastUsed = i->ToUInt();
++i;
}
else if ( *i == "time" )
{
if ( tokens.End() - i < 3 )
return false;
int y, m, d; double f;
JDToComplexTime( y, m, d, f, i[1].ToUInt()+0.5 );
unsigned t = i[2].ToUInt();
time.year = y;
time.month = m;
time.day = d;
time.milliseconds = t - 86399000;
time.hour = TruncI( (t = TruncI( t/1000.0 ))/3600.0 );
time.minute = TruncI( (t -= time.hour*3600)/60.0 );
time.second = t - time.minute*60;
i += 3;
}
else if ( *i == "data" )
{
if ( !GetDataFromTokens( tokens ) )
return false;
++i;
}
else
{
++i;
}
}
return !path.IsEmpty() && lastUsed > 0 && time.year > 0 && ValidateData();
}
示例2: GetVector
bool FileDataCacheItem::GetVector( DVector& v, StringList::const_iterator& i, const StringList& s )
{
if ( i == s.End() )
return false;
int n = i->ToInt();
if ( n < 0 || s.End() - i <= n )
return false;
++i;
v = DVector( n );
for ( int j = 0; j < n; ++j, ++i )
v[j] = i->ToDouble();
return true;
}
示例3: Error
void PixInsightX11Installer::DirectorySearch_Recursive( StringList& foundItems, const String& dirPath, const String& baseDir )
{
if ( dirPath.Has( ".." ) )
throw Error( "SearchDirectory(): Attempt to redirect outside the base directory." );
if ( !dirPath.BeginsWith( baseDir ) )
throw Error( "SearchDirectory(): Attempt to redirect outside the base directory." );
if ( !File::DirectoryExists( dirPath ) )
throw Error( "SearchDirectory(): Attempt to search a nonexistent directory." );
String currentDir = dirPath;
if ( !currentDir.EndsWith( '/' ) )
currentDir += '/';
StringList directories;
FindFileInfo info;
for ( File::Find f( currentDir + "*" ); f.NextItem( info ); )
if ( info.IsDirectory() )
{
if ( info.name != "." && info.name != ".." )
{
directories.Add( info.name );
foundItems.Add( currentDir + info.name + '/' );
}
}
else
foundItems.Add( currentDir + info.name );
for ( StringList::const_iterator i = directories.Begin(); i != directories.End(); ++i )
DirectorySearch_Recursive( foundItems, currentDir + *i, baseDir );
}
示例4: SearchDirectory_Recursive
static void SearchDirectory_Recursive( StringList& fileNames, const String& fileName, bool recursive )
{
String fileDir = File::ExtractDrive( fileName ) + File::ExtractDirectory( fileName );
String wildSpec = File::ExtractName( fileName ) + File::ExtractExtension( fileName );
FindFileInfo info;
for ( File::Find f( fileName ); f.NextItem( info ); )
if ( !info.IsDirectory() )
if ( info.name.WildMatch( wildSpec ) )
{
String path = fileDir + '/' + info.name;
if ( !fileNames.Contains( path ) )
fileNames.Add( path );
}
if ( recursive )
{
StringList directories;
for ( File::Find f( fileDir + "/*" ); f.NextItem( info ); )
if ( info.IsDirectory() && info.name != "." && info.name != ".." )
directories.Add( info.name );
for ( StringList::const_iterator i = directories.Begin(); i != directories.End(); ++i )
SearchDirectory_Recursive( fileNames, fileDir + '/' + *i + '/' + wildSpec, true );
}
}
示例5: 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" );
}
示例6: 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" );
}
示例7: TR
static String TR( const StringList& cols )
{
String tr( "<tr style=\"background:" + ((tableRow & 1) ? oddBgColor : evenBgColor) + "\">" );
for ( StringList::const_iterator i = cols.Begin(); i != cols.End(); ++i )
tr += TD( *i );
tr += "</tr>";
++tableRow;
return tr;
}
示例8: RemoveItalicFonts
void FontComboBox::RemoveItalicFonts()
{
StringList installedFaces = Font::AvailableFonts();
SortedStringList faces = GetFaceList( this );
for ( StringList::const_iterator i = installedFaces.Begin(); i != installedFaces.End(); ++i )
if ( Font::IsItalicFont( *i ) )
faces.Remove( *i );
SetFaceList( this, faces );
}
示例9: 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;
}
示例10: AddFixedPitchFonts
void FontComboBox::AddFixedPitchFonts()
{
StringList installedFaces = Font::AvailableFonts();
SortedStringList faces = GetFaceList( this );
for ( StringList::const_iterator i = installedFaces.Begin(); i != installedFaces.End(); ++i )
if ( !faces.Has( *i ) )
if ( Font::IsFixedPitchFont( *i ) )
faces.Add( *i );
SetFaceList( this, faces );
}
示例11: StartProgram
ExternalProcess::pid_type ExternalProcess::StartProgram( const String& program, const StringList& arguments, const String& workingDirectory )
{
Array<const char16_type*> argv;
for ( StringList::const_iterator i = arguments.Begin(); i != arguments.End(); ++i )
argv.Add( i->c_str() );
uint64 pid = 0;
api_bool ok = (*API->ExternalProcess->StartProgram)( program.c_str(), argv.Begin(), argv.Length(), workingDirectory.c_str(), &pid );
if ( ok == api_false || pid == 0 )
ExternalProcessPrivate::Throw( ExternalProcessContext::FailedToStart );
return pid_type( pid );
}
示例12: RemoveWritingSystem
void FontComboBox::RemoveWritingSystem( const String& writingSystem )
{
StringList installedFaces = Font::AvailableFonts();
SortedStringList faces = GetFaceList( this );
for ( StringList::const_iterator i = installedFaces.Begin(); i != installedFaces.End(); ++i )
{
StringList supportedSystems = Font::AvailableFontWritingSystems( *i );
if ( supportedSystems.Has( writingSystem ) )
faces.Remove( *i );
}
SetFaceList( this, faces );
}
示例13: LoadFiltersFromGlobalString
void LoadFiltersFromGlobalString( const IsoString& globalKey )
{
filters.Clear();
String s = PixInsightSettings::GlobalString( globalKey );
if ( !s.IsEmpty() )
{
for ( size_type p = 0; ; )
{
size_type p1 = s.Find( '(', p );
if ( p1 == String::notFound )
break;
size_type p2 = s.Find( ')', p1 );
if ( p2 == String::notFound )
break;
String extStr = s.Substring( p1, p2-p1 );
if ( !extStr.IsEmpty() )
{
StringList extLst;
extStr.Break( extLst, ' ', true );
if ( !extLst.IsEmpty() )
{
FileFilter filter;
for ( StringList::const_iterator i = extLst.Begin(); i != extLst.End(); ++i )
{
size_type d = i->Find( '.' );
if ( d != String::notFound )
filter.AddExtension( i->Substring( d ) );
}
if ( !filter.Extensions().IsEmpty() )
{
String desc = s.Substring( p, p1-p );
desc.Trim();
filter.SetDescription( desc );
filters.Add( filter );
}
}
}
p = p2 + 1;
}
}
}
示例14: 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 )
{
//.........这里部分代码省略.........
示例15: ProcessCommandLine
int AssignICCProfileProcess::ProcessCommandLine( const StringList& argv ) const
{
ArgumentList arguments =
ExtractArguments( argv,
ArgumentItemMode::AsViews,
ArgumentOption::AllowWildcards|ArgumentOption::NoPreviews );
AssignICCProfileInstance instance( this );
bool launchInterface = false;
int count = 0;
for ( ArgumentList::const_iterator i = arguments.Begin(); i != arguments.End(); ++i )
{
const Argument& arg = *i;
if ( arg.IsNumeric() )
throw Error( "Unknown numeric argument: " + arg.Token() );
else if ( arg.IsString() )
{
if ( arg.Id() == "profile" )
{
instance.targetProfile = arg.StringValue();
instance.targetProfile.Trim();
if ( instance.targetProfile.IsEmpty() )
throw Error( "Empty profile identifier: " + arg.Token() );
}
else if ( arg.Id() == "filename" )
{
String filename = arg.StringValue();
filename.Trim();
if ( filename.IsEmpty() )
throw Error( "Empty file name: " + arg.Token() );
instance.targetProfile.Clear();
StringList dirs = ICCProfile::ProfileDirectories();
for ( StringList::const_iterator i = dirs.Begin(); i != dirs.End(); ++i )
{
String path = *i + '/' + filename;
if ( File::Exists( path ) )
{
ICCProfile icc( path );
if ( icc.IsProfile() )
{
instance.targetProfile = icc.Description();
break;
}
}
}
if ( instance.targetProfile.IsEmpty() )
throw Error( "The specified file name does not correspond to a valid ICC profile: " + filename );
}
else
throw Error( "Unknown string argument: " + arg.Token() );
}
else if ( arg.IsSwitch() )
{
if ( arg.Id() == "default" )
instance.mode = arg.SwitchState() ? AssignMode::AssignDefaultProfile : AssignMode::AssignNewProfile;
else if ( arg.Id() == "untag" )
instance.mode = arg.SwitchState() ? AssignMode::LeaveUntagged : AssignMode::AssignNewProfile;
else
throw Error( "Unknown switch argument: " + arg.Token() );
}
else if ( arg.IsLiteral() )
{
if ( arg.Id() == "default" )
instance.mode = AssignMode::AssignDefaultProfile;
else if ( arg.Id() == "untag" )
instance.mode = AssignMode::LeaveUntagged;
else if ( arg.Id() == "-interface" )
launchInterface = true;
else if ( arg.Id() == "-help" )
{
ShowHelp();
return 0;
}
else
throw Error( "Unknown argument: " + arg.Token() );
}
else if ( arg.IsItemList() )
{
++count;
if ( arg.Items().IsEmpty() )
{
Console().WriteLn( "No view(s) found: " + arg.Token() );
continue;
}
for ( StringList::const_iterator j = arg.Items().Begin(); j != arg.Items().End(); ++j )
{
View v = View::ViewById( *j );
if ( v.IsNull() )
throw Error( "No such view: " + *j );
instance.LaunchOn( v );
}
}
//.........这里部分代码省略.........