本文整理汇总了C++中NzString::Reserve方法的典型用法代码示例。如果您正苦于以下问题:C++ NzString::Reserve方法的具体用法?C++ NzString::Reserve怎么用?C++ NzString::Reserve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NzString
的用法示例。
在下文中一共展示了NzString::Reserve方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ToString
NzString NzStringStream::ToString() const
{
NzString string;
string.Reserve(m_bufferSize);
for (const NzString& str : m_strings)
string += str;
return string;
}
示例2: Mount
bool NzPluginManager::Mount(const NzString& pluginPath, bool appendExtension)
{
if (!Initialize())
{
NazaraError("Failed to initialize PluginManager");
return false;
}
NzString path = pluginPath;
if (appendExtension && !path.EndsWith(NAZARA_DYNLIB_EXTENSION))
path += NAZARA_DYNLIB_EXTENSION;
bool exists = false;
if (!NzFile::IsAbsolute(path))
{
for (const NzString& dir : s_directories)
{
NzString testPath;
testPath.Reserve(dir.GetSize() + path.GetSize() + 10);
testPath = dir;
testPath += NAZARA_DIRECTORY_SEPARATOR;
testPath += path;
if (NzFile::Exists(testPath))
{
path = testPath;
exists = true;
break;
}
}
}
else if (NzFile::Exists(path))
exists = true;
if (!exists)
{
NazaraError("Failed to find plugin file");
return false;
}
std::unique_ptr<NzDynLib> library(new NzDynLib);
if (!library->Load(path))
{
NazaraError("Failed to load plugin");
return false;
}
PluginLoad func = reinterpret_cast<PluginLoad>(library->GetSymbol("NzPluginLoad"));
if (!func)
{
NazaraError("Failed to get symbol NzPluginLoad");
return false;
}
if (!func())
{
NazaraError("Plugin failed to load");
return false;
}
s_plugins[pluginPath] = library.release();
return true;
}