本文整理汇总了C++中HeapString类的典型用法代码示例。如果您正苦于以下问题:C++ HeapString类的具体用法?C++ HeapString怎么用?C++ HeapString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HeapString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Print
void CustomDrawMeshRenderBatch::Print(HeapString& ioStr, uint level)
{
ioStr.AppendFormat("{:x}", this);
ioStr.Append('\t', level);
ioStr.AppendFormat("{}:{}\t", mNode->Id(), mNode->Name());
ioStr.AppendLine();
}
示例2: 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;
}
示例3: CreateAtlasRegion
TextureAtlasRegion* MedusaTextureAtlas::CreateAtlasRegion(const IStream& stream)
{
HeapString outLine;
List<HeapString> outValues;
std::unique_ptr<TextureAtlasRegion> region(new TextureAtlasRegion());
//read source texture rect
Rect2U sourceRect;
Rect2U textureRect;
outLine.Clear();
RETURN_NULL_IF_FALSE(ReadLineToValues(stream, outLine, outValues));
region->SetName(outValues[0]);
region->SetRotate(StringParser::StringTo<bool>(outValues[1]));
sourceRect.Origin.X = StringParser::StringTo<uint>(outValues[2]);
sourceRect.Origin.Y = StringParser::StringTo<uint>(outValues[3]);
sourceRect.Size.Width = StringParser::StringTo<uint>(outValues[4]);
sourceRect.Size.Height = StringParser::StringTo<uint>(outValues[5]);
textureRect.Origin.X = StringParser::StringTo<uint>(outValues[6]);
textureRect.Origin.Y = StringParser::StringTo<uint>(outValues[7]);
textureRect.Size.Width = StringParser::StringTo<uint>(outValues[8]);
textureRect.Size.Height = StringParser::StringTo<uint>(outValues[9]);
region->SetSourceRect(sourceRect);
region->SetTextureRect(textureRect);
return region.release();
}
示例4: ReadDataToString
size_t IStream::ReadDataToString(HeapString& outString, int readCount/*=0*/, bool withNullTermitated /*= false*/)const
{
RETURN_ZERO_IF_FALSE(CanRead());
uintp readSize = 0;
if (readCount == 0)
{
readSize = Math::Min(outString.LeftLength(), LeftLength());
}
else if (readCount < 0)
{
readSize = LeftLength();
outString.ReserveLeftLength(readSize);
}
else
{
readSize = Math::Min((size_t)readCount, LeftLength());
outString.ReserveLeftLength(readSize);
}
MemoryData outData = MemoryData::FromStatic((const byte*)outString.LeftPtr(), readSize);
size_t count = ReadDataTo(outData, DataReadingMode::AlwaysCopy);
if (withNullTermitated)
{
--count;
}
outString.ForceAppendLength(count);
return count;
}
示例5: ReadAllLinesTo
size_t IStream::ReadAllLinesTo(List<HeapString>& outLines, size_t maxCount/*=1024*/, bool isTrim/*=true*/, bool ignoreEmptyLine/*=true*/)const
{
size_t count = 0;
HeapString temp;
temp.ReserveLength(maxCount);
while (true)
{
temp.Clear();
size_t readCount = ReadLineToString(temp);
count += readCount;
BREAK_IF_ZERO(readCount);
if (ignoreEmptyLine)
{
CONTINUE_IF_EMPTY(temp);
}
if (isTrim)
{
temp.TrimAll();
}
outLines.Add(temp);
temp.ForceSetLength(0);
}
return count;
}
示例6: RETURN_NULL_IF_NULL
ScriptObject* ScriptModule::NewObjectWithInt(StringRef className, int address)
{
asIObjectType* scriptObjectType = mScriptModule->GetObjectTypeByName(className.c_str());
if (scriptObjectType == nullptr)
{
Log::FormatError("Cannot find class by {}", className.c_str());
}
RETURN_NULL_IF_NULL(scriptObjectType);
HeapString factoryName = className;
factoryName += "@ ";
factoryName += className;
factoryName += "(int address)";
asIScriptFunction* factory = scriptObjectType->GetFactoryByDecl(factoryName.c_str());
if (factory == nullptr)
{
Log::FormatError("Cannot find class factory by {}", factoryName.c_str());
}
RETURN_NULL_IF_NULL(factory);
asIScriptContext* context = ScriptEngine::Instance().GetScriptContext();
context->Prepare(factory);
context->SetArgDWord(0, address);
context->Execute();
asIScriptObject* scriptObject = *(asIScriptObject**)context->GetAddressOfReturnValue();
return new ScriptObject(scriptObject);
}
示例7: Print
void EffectRenderGroup::Print(HeapString& ioStr, uint level)
{
ioStr.Append('\t', level);
ioStr.AppendLine(mEffect->Name().c_str());
for (auto materialRenderList : mGroups)
{
materialRenderList->Print(ioStr, level + 1);
}
}
示例8: ReadStringTo
size_t HashStream::ReadStringTo(HeapString& outString)const
{
size_t oldPos = outString.Length();
size_t readCount = mSourceStream->ReadStringTo(outString);
RETURN_ZERO_IF_ZERO(readCount);
mHasher->Process(outString.c_str() + oldPos, outString.Length() - oldPos);
return readCount;
}
示例9: PrintRenderQueue
void IRenderQueue::PrintRenderQueue(const RenderableNodeList& nodes)
{
HeapString testStr;
size_t count = nodes.Count();
FOR_EACH_SIZE(i, count)
{
IRenderable* node = (IRenderable*)nodes[i];
testStr.AppendFormat("{}:{}:{}\n", node->Id(), node->Material()->Name().c_str(), node->Name().c_str());
}
示例10: ReadLineToString
size_t HashStream::ReadLineToString(HeapString& outString, bool includeNewLine/*=true*/)const
{
size_t oldPos = outString.Length();
size_t readCount = mSourceStream->ReadLineToString(outString, includeNewLine);
RETURN_ZERO_IF_ZERO(readCount);
mHasher->Process(outString.c_str() + oldPos, (outString.Length() - oldPos)*sizeof(char));
return readCount;
}
示例11: PrintNodes
void BaseBufferRenderBatch::PrintNodes()const
{
HeapString testStr;
for (auto node : mNodes)
{
testStr.AppendFormat("{},", node->Name().c_str());
}
Log::Info(testStr);
}
示例12: trio_vcprintf
HeapString HeapString::FormatV(const char* format, va_list args)
{
int len = 0;
trio_vcprintf(CountAnsiHeapString, &len, format, args);
HeapString dest;
dest.AllocBuffer(len);
trio_vsnprintf(dest.m_string, len + 1, format, args);
return dest;
}
示例13: Start
bool EventLoopThreadPool::Start(uint threadCount, const StringRef& pollerName)
{
HeapString threadName;
FOR_EACH_SIZE(i, threadCount)
{
threadName.Format("EventLoopThread-{}", i);
EventLoopThread* thread = new EventLoopThread(threadName, pollerName);
mThreads.Add(thread);
thread->Start();
}
示例14: FOR_EACH_COLLECTION
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;
}
示例15: Print
void SceneRenderGroup::Print(HeapString& ioStr, uint level)
{
ioStr.AppendLine();
ioStr.Append('\t', level);
for (auto group : mGroups)
{
group->Print(ioStr, level + 1);
}
Log::Info(ioStr);
}