本文整理汇总了C++中StringList::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ StringList::Add方法的具体用法?C++ StringList::Add怎么用?C++ StringList::Add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringList
的用法示例。
在下文中一共展示了StringList::Add方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 );
}
示例2: 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 );
}
}
示例3: FillFormat
void FillFormat(const char *TypeName)
{
GetIniString(TypeName, "Start", "", StartText, sizeof(StartText));
GetIniString(TypeName, "End", "", EndText, sizeof(EndText));
int FormatNumber = 0;
delete Format;
Format = new StringList;
for(StringList * CurFormat = Format;; CurFormat = CurFormat->Add())
{
char FormatName[100];
SPrintf(FormatName, "Format%d", FormatNumber++);
GetIniString(TypeName, FormatName, "", CurFormat->Str(), PROF_STR_LEN);
if(*CurFormat->Str() == 0)
break;
}
int Number = 0;
delete IgnoreStrings;
IgnoreStrings = new StringList;
for(StringList * CurIgnoreString = IgnoreStrings;; CurIgnoreString = CurIgnoreString->Add())
{
char Name[100];
SPrintf(Name, "IgnoreString%d", Number++);
GetIniString(TypeName, Name, "", CurIgnoreString->Str(), PROF_STR_LEN);
if(*CurIgnoreString->Str() == 0)
break;
}
}
示例4: FindMatchedFSObjects
StringList CSxSParser::FindMatchedFSObjects(LPCTSTR szParentFolder, LPCTSTR szFilter, BOOL bIsFile) const
{
CString strParent(szParentFolder);
if(strParent[strParent.GetLength() - 1] != _T('\\'))
strParent += _T('\\');
CString strFilter(strParent);
strFilter += szFilter;
StringList listResult;
WIN32_FIND_DATA data;
HANDLE hFind = ::FindFirstFile(strFilter, &data);
if(hFind == INVALID_HANDLE_VALUE)
return listResult;
CString strFilePath;
do
{
if(_tcscmp(data.cFileName, _T(".")) == 0
|| _tcscmp(data.cFileName, _T("..")) == 0)
continue;
if(bIsFile && ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY))
continue;
if(!bIsFile && ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY))
continue;
strFilePath = data.cFileName;
listResult.Add(strFilePath);
} while (::FindNextFile(hFind, &data));
::FindClose(hFind);
return listResult;
}
示例5: ResetFonts
void FontComboBox::ResetFonts()
{
// ### TODO: Add item icons for standard, scalable, bitmapped and fixed-pitch fonts.
StringList faces = Font::AvailableFonts();
for ( size_type i = 0; i < ItemsInArray( s_standardFaces ); ++i )
if ( !faces.Has( s_standardFaces[i] ) )
faces.Add( s_standardFaces[i] );
faces.Sort();
SetFaceList( this, faces );
}
示例6: getSelectionListFromSettings
StringList getSelectionListFromSettings(const SimulationSettings& settings)
{
//read from settings the variables found in the amounts and concentrations lists
StringList theList;
TSelectionRecord record;
int nrOfVars = settings.mVariables.Count();
for(int i = 0; i < settings.mAmount.Count(); i++)
{
theList.Add("[" + settings.mAmount[i] + "]"); //In the setSelection list below, the [] selects the correct 'type'
}
for(int i = 0; i < settings.mConcentration.Count(); i++)
{
theList.Add(settings.mConcentration[i]);
}
//We may have variables
//A variable 'exists' only in "variables", not in the amount or concentration section
int currCount = theList.Count();
if( nrOfVars > currCount)
{
//Look for a variable that is not in the list
for(int i = 0; i < settings.mVariables.Count(); i++)
{
string aVar = settings.mVariables[i];
if(settings.mAmount.DontContain(aVar) && settings.mConcentration.DontContain(aVar))
{
theList.Add(settings.mVariables[i]);
}
}
}
theList.InsertAt(0, "time");
return theList;
}
示例7: GetCheckedSpecies
StringList TMForm::GetCheckedSpecies()
{
//Go trough the listbox and return checked items
StringList checked;
for(int i = 0; i < SelList->Count; i++)
{
if(SelList->Checked[i])
{
String anItem = SelList->Items->Strings[i];
checked.Add(ToSTDString(anItem));
}
}
return checked;
}
示例8: HandleSetSourcesOrder
json_t* OBSAPIMessageHandler::HandleSetSourcesOrder(OBSAPIMessageHandler* handler, json_t* message)
{
StringList sceneNames;
json_t* arry = json_object_get(message, "scene-names");
if(arry != NULL && json_typeof(arry) == JSON_ARRAY)
{
for(size_t i = 0; i < json_array_size(arry); i++)
{
json_t* sceneName = json_array_get(arry, i);
String name = json_string_value(sceneName);
sceneNames.Add(name);
}
OBSSetSourceOrder(sceneNames);
}
return GetOkResponse();
}
示例9: ProcessCommandLine
static int32 api_func ProcessCommandLine( meta_process_handle hp, int32 argc, const char16_type** argv )
{
bool wasConsoleOutput = Exception::IsConsoleOutputEnabled();
bool wasGUIOutput = Exception::IsGUIOutputEnabled();
try
{
StringList args;
for ( int i = 0; i < argc; ++i )
args.Add( String( argv[i] ) );
Exception::EnableConsoleOutput();
Exception::DisableGUIOutput();
int result = process->ProcessCommandLine( args );
Exception::EnableConsoleOutput( wasConsoleOutput );
Exception::EnableGUIOutput( wasGUIOutput );
return result;
}
catch ( Exception& x )
{
Console().WriteLn( "<end><cbr>" + x.FormatInfo() );
}
catch ( ... )
{
try
{
throw;
}
ERROR_HANDLER
}
Exception::EnableConsoleOutput( wasConsoleOutput );
Exception::EnableGUIOutput( wasGUIOutput );
return -1;
}
示例10: 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 )
{
//.........这里部分代码省略.........
示例11: AddView
static void AddView( StringList& items, const View& v )
{
String id( v.FullId() );
if ( !items.Contains( id ) )
items.Add( id );
}
示例12: html
ConvolutionFilterCodeDialog::ConvolutionFilterCodeDialog( String mode, const Filter& _filter ) : Dialog(), filter( _filter )
{
// ### TextBox
FilterCode_TextBox.SetScaledMinSize( 700, 300 );
FilterCode_TextBox.OnCaretPositionUpdated( (TextBox::caret_event_handler)&ConvolutionFilterCodeDialog::__TextBox_CaretPosition, *this );
if ( mode == "Edit" )
{
FilterCode_TextBox.SetReadWrite();
FilterCode_TextBox.SetText( filter.ToSource() );
}
tableRow = 0;
String s;
String html( "<html style=\"white-space:pre;text-align:right;\">"
"<table border=\"0\" cellspacing=\"0\" cellpadding=\"0\">" );
StringList cols;
UpdateTableColors();
if ( mode == "View" )
{
FilterCode_TextBox.SetReadOnly();
if ( filter.IsSeparable() )
{
SeparableFilter fs( filter.Separable() );
float element;
// Rows
for ( int i = 0; i < fs.Size(); ++i )
{
// Cols
for ( int j = 0; j < fs.Size(); ++j )
{
// Calculus of each coefficient of the separable filter
element = Round( fs.ColFilter()[i] * fs.RowFilter()[j], 6 );
cols.Add( String().Format( "%10.6f", element ) );
}
html += TR( cols );
cols.Clear();
}
}
else
{
KernelFilter k( filter.Kernel() );
for ( int i = 0; i < k.Size(); ++i )
{
for ( int j = 0; j < k.Size(); ++j )
{
float element = Round( k.Coefficients()[i][j], 6 );
// The elements of the KernelFilter can be accessed directly God thanks and the [] operator.
cols.Add( String().Format( "%10.6f", element ) );
}
html += TR( cols );
cols.Clear();
}
}
html += "</table></html>";
// We got it!! we set the TextBox text by passing the composed String s.
FilterCode_TextBox.SetText( html );
UpdateTableColors();
}
if ( mode == "View" )
LineCol_Label.Hide();
else
LineCol_Label.Show();
LineCol_Sizer.SetSpacing( 4 );
LineCol_Sizer.Add( LineCol_Label );
LineCol_Sizer.AddStretch();
// ### Save PushButton
Save_PushButton.SetText( "Save" );
Save_PushButton.SetCursor( StdCursor::Checkmark );
Save_PushButton.OnClick( (Button::click_event_handler)&ConvolutionFilterCodeDialog::__Button_Click, *this );
if ( mode == "View" )
Save_PushButton.Hide();
else
Save_PushButton.SetDefault();
if ( mode == "View" )
{
Cancel_PushButton.SetText( "Close" );
Cancel_PushButton.SetCursor( StdCursor::Checkmark );
Cancel_PushButton.SetDefault();
}
else
{
Cancel_PushButton.SetText( "Cancel" );
Cancel_PushButton.SetCursor( StdCursor::Crossmark );
}
Cancel_PushButton.OnClick( (Button::click_event_handler)&ConvolutionFilterCodeDialog::__Button_Click, *this );
DialogButtons_Sizer.SetSpacing( 8 );
DialogButtons_Sizer.AddStretch();
DialogButtons_Sizer.Add( Save_PushButton );
//.........这里部分代码省略.........
示例13: FileExtensions
StringList JPCFormat::FileExtensions() const
{
StringList exts;
exts.Add( ".jpc" ); exts.Add( ".j2c" );
return exts;
}
示例14:
StringList JP2Format::FileExtensions() const
{
StringList exts;
exts.Add( ".jp2" ); exts.Add( ".jpx" ); exts.Add( ".jpk" ); exts.Add( ".j2k" );
return exts;
}