本文整理汇总了C++中StringArray::Add方法的典型用法代码示例。如果您正苦于以下问题:C++ StringArray::Add方法的具体用法?C++ StringArray::Add怎么用?C++ StringArray::Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringArray
的用法示例。
在下文中一共展示了StringArray::Add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Split
DKStringW::StringArray DKStringW::Split(const DKStringW& delimiter, bool ignoreEmptyString) const
{
StringArray strings;
size_t len = Length();
size_t dlen = delimiter.Length();
if (dlen == 0)
{
strings.Add(*this);
return strings;
}
long begin = 0;
while (begin < len)
{
long next = this->Find(delimiter, begin);
if (next >= begin)
{
DKStringW subString = this->Mid(begin, next - begin);
if (ignoreEmptyString == false || subString.Length() > 0)
strings.Add(this->Mid(begin, next - begin));
begin = next + dlen;
}
else
{
DKStringW subString = this->Right(begin);
if (subString.Length() > 0)
strings.Add(subString);
break;
}
}
return strings;
}
示例2: SplitByCharactersInSet
DKStringW::StringArray DKStringW::SplitByCharactersInSet(const CharacterSet& cs, bool ignoreEmptyString) const
{
StringArray strings;
size_t len = Length();
size_t numCs = cs.Count();
if (numCs == 0)
{
strings.Add(*this);
return strings;
}
long begin = 0;
while (begin < len)
{
long next = this->FindAnyCharactersInSet(cs, begin);
if (next >= begin)
{
DKStringW subString = this->Mid(begin, next - begin);
if (ignoreEmptyString == false || subString.Length() > 0)
strings.Add(subString);
begin = next + 1;
}
else
{
DKStringW subString = this->Right(begin);
if (subString.Length() > 0)
strings.Add(subString);
break;
}
}
return strings;
}
示例3: AfxFindDictionaries
void AfxFindDictionaries(StringArray &aLanguage,
StringArray &aDialect)
{
CString dicFileMatch = CConfiguration::GetInstance()->m_strSpellDictionaryPath + _T("\\*.dic");
WIN32_FIND_DATA dirInfo;
HANDLE hFile;
BOOL bNext = TRUE;
hFile = FindFirstFile(dicFileMatch,&dirInfo);
while (hFile != INVALID_HANDLE_VALUE && bNext)
{
// Dictionary file format LANG_DIALACT{-extra}?.dic
// Example: de_DE.dic en_US-slang.dic
// Get the language and dialect of all installed dictionaries.
TCHAR* dash;
TCHAR* dot;
dash = _tcschr(dirInfo.cFileName,_T('_'));
if (dash != NULL)
dot = _tcschr(dash,_T('.'));
else
dot = NULL;
if ((dash != NULL) && (dot != NULL))
{
CString lang(dirInfo.cFileName,dash - dirInfo.cFileName);
CString dialect(dash + 1,dot - dash - 1);
aDialect.Add(dialect);
aLanguage.Add(lang);
}
bNext = FindNextFile(hFile,&dirInfo);
}
FindClose(hFile);
}
示例4: GetFileNames
///////////////////////////////////////////////////////////////////////////////
// [in] fullPath : true to get paths as dir+name instead of name only
StringArray Directory::GetFileNames(const String& dirPath, const String& joker,
bool fullPaths)
{
StringArray filePaths;
StringArray jokerPatterns;
Array<Joker> jokers;
if( !joker.IsEmpty() )
{
jokerPatterns = joker.Split('|');
}
else
{
jokerPatterns.Add("*");
}
jokers.EnsureCapacity(jokerPatterns.GetSize());
foreach(jokerPatterns, i)
{
jokers.Add( Joker(jokerPatterns[i]) );
}
示例5: main
// Use the legacy main on Linux and assume UTF-8
int main(int argc, char** argv)
#endif
{
String cmdLine = Process::GetCommandLine();
ArgvParser ap(argc, argv);
if( !ap.HasFlag("file") )
{
// Display usage
String version = "PngOptimizerCL 2.4.1";
#if defined(_M_X64)
version = version + String(" (x64)");
#elif defined(_M_IX86)
version = version + String(" (x86)");
#endif
Console::WriteLine(version + " \xA9 2002/2014 Hadrien Nilsson - psydk.org");
Console::WriteLine("Converts GIF, BMP and TGA files to optimized PNG files.");
Console::WriteLine("Optimizes and cleans PNG files.");
Console::WriteLine("");
Console::WriteLine("Usage: PngOptimizerCL -file:\"yourfile.png\" [-recurs]");
POEngineSettings::WriteArgvUsage(" ");
Console::WriteLine("");
Console::WriteLine("Values enclosed with [] are optional.");
Console::WriteLine("Chunk option meaning: R=Remove, K=Keep, F=Force. 0|1|2 can be used too.");
Console::WriteLine("");
Console::WriteLine("Input examples:");
Console::WriteLine("Handle a specific file:");
Console::WriteLine(" PngOptimizerCL -file:\"icon.png\"");
Console::WriteLine("Handle specific file types in the current directory:");
Console::WriteLine(" PngOptimizerCL -file:\"*.png|*.bmp\"");
Console::WriteLine("Handle any supported file in the current directory:");
Console::WriteLine(" PngOptimizerCL -file:\"*\"");
Console::WriteLine("Handle specific file types in the current directory (recursive):");
Console::WriteLine(" PngOptimizerCL -file:\".png|*.bmp\" -recurs");
Console::WriteLine("Handle a specific directory (recursive):");
Console::WriteLine(" PngOptimizerCL -file:\"gfx/\"");
Console::WriteLine("");
if( Console::IsOwned() )
{
Console::Write("Press any key to continue");
Console::WaitForKey();
}
return 0;
}
POApplicationConsole app;
// PngOptimizer.exe -file:"myfile.png"
POEngine engine;
if( !engine.WarmUp() )
{
Console::WriteLine("Warm-up failed");
return 1;
}
engine.Progressing.Handle(&app, &POApplicationConsole::OnEngineProgressing);
engine.m_settings.LoadFromArgv(ap);
//////////////////////////////////////////////////////////////////
String filePath = ap.GetFlagString("file");
String dir, fileName;
FilePath::Split(filePath, dir, fileName);
StringArray filePaths;
String joker;
if( ap.HasFlag("recurs") )
{
filePaths.Add(dir);
joker = fileName;
}
else
{
filePaths = Directory::GetFileNames(dir, fileName, true);
if( filePaths.IsEmpty() )
{
// For PngOptimizerCL, it is an error if we have nothing to optimize
Color32 col = POEngine::ColorFromTextType(POEngine::TT_ErrorMsg);
Console::SetTextColor(col);
Console::WriteLine("File not found: " + filePath);
Console::ResetTextColor();
return 1;
}
}
if( !engine.OptimizeFiles(filePaths, joker) )
{
return 1;
}
return 0;
}