本文整理汇总了C++中HeapString::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ HeapString::IsEmpty方法的具体用法?C++ HeapString::IsEmpty怎么用?C++ HeapString::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HeapString
的用法示例。
在下文中一共展示了HeapString::IsEmpty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SearchDirectoriesToAdd
bool FileStorage::SearchDirectoriesToAdd(const StringRef& searchPath, DirectoryEntry* destDir /*= nullptr*/, bool recursively /*= true*/)
{
if (destDir == nullptr)
{
destDir = &mRootDir;
}
List<HeapString> dirList;
Directory::SearchDirectories(searchPath, dirList, recursively);
HeapString searchDir = Path::GetDirectory(searchPath);
for (auto& dir : dirList)
{
StringRef subDir;
if (searchDir.IsEmpty())
{
subDir = dir;
}
else
{
subDir = dir.ToString().SubString(searchDir.Length() + 1); //+1 to skip '/'
}
auto* dirEntry = FindOrCreateDirectoryEntry(subDir, destDir);
if (dirEntry == nullptr)
{
Log::FormatError("Cannot create dir:{}", subDir);
return false;
}
Log::FormatInfo("Add Dir:{}", dir);
}
return true;
}
示例2: Parse
PublishTarget PublishTarget::Parse(StringRef fileName)
{
if (!fileName.Contains('-'))
{
return MatchAll;
}
HeapString rawName = Path::GetFileNameWithoutExtension(fileName);
rawName.RemoveBeginExclude('-');
if (rawName.IsEmpty())
{
return MatchAll;
}
List<HeapString> outResults;
StringParser::Split<char>(rawName, "-", outResults);
if (outResults.IsEmpty())
{
return MatchAll;
}
int resultTag = 0;
FOR_EACH_COLLECTION(i, outResults)
{
const HeapString& str = *i;
int* tempTag = mTagDict.TryGetValue(str);
if (tempTag != nullptr)
{
resultTag |= *tempTag;
}
else if (!StdString::IsDigit(str.c_str()))
{
Log::FormatError("Invalid tag:{}", str.c_str());
}
}
PublishTarget tag = PublishTarget(resultTag);
if (tag.Version == PublishVersions::None)
{
tag.Version = PublishVersions::All;
}
if (tag.Device == PublishDevices::None)
{
tag.Device = PublishDevices::All;
}
if (tag.Language == PublishLanguages::None)
{
tag.Language = PublishLanguages::All;
}
return tag;
}
示例3: ParseFile
bool SirenTextParser::ParseFile(const FileIdRef& fileId)
{
HeapString text = FileSystem::Instance().ReadAllText(fileId);
if (text.IsEmpty())
{
Log::FormatError("Cannot find file:{}", fileId.Name);
return false;
}
Preprocess(text);
StringRef proto = text;
return Parse(proto);
}
示例4: SearchFilesToAdd
bool FileStorage::SearchFilesToAdd(const StringRef& searchPath, DirectoryEntry* destDir /*= nullptr*/, bool recursively /*= true*/, bool isReadonly /*= false*/, bool overwrite /*= true*/, bool deleteOriginalFile /*= false*/)
{
SearchDirectoriesToAdd(searchPath, destDir, recursively);
if (destDir == nullptr)
{
destDir = &mRootDir;
}
List<HeapString> fileList;
Directory::SearchFiles(searchPath, fileList, recursively);
HeapString searchDir = Path::GetDirectory(searchPath);
for (const auto& file : fileList)
{
auto fs = File::OpenBinaryReader(file);
if (!fs)
{
Log::FormatError("Cannot read file:{}", file);
return false;
}
StringRef destFile;
if (searchDir.IsEmpty())
{
destFile = file;
}
else
{
destFile = file.ToString().SubString(searchDir.Length() + 1); //+1 to skip '/'
}
bool overwriteFile = false;
if (overwrite)
{
if (RemoveFile(destFile))
{
overwriteFile = true;
}
}
else
{
if (ExistsFile(destFile))
{
Log::FormatInfo("NOT overwrite file:{}", destFile);
continue;
}
}
auto* fileEntry = SaveFile(*fs, destFile, destDir);
fileEntry->SetPermission(isReadonly ? FilePermission::Read : FilePermission::All);
Log::FormatInfo("Add file:{} to {}", destFile, file);
if (overwriteFile)
{
Log::FormatInfo("Overwrite file:{}", destFile);
}
}
if (deleteOriginalFile)
{
for (const auto& file : fileList)
{
File::Delete(file);
}
}
return true;
}