本文整理汇总了C++中vfs::Path::toCString方法的典型用法代码示例。如果您正苦于以下问题:C++ Path::toCString方法的具体用法?C++ Path::toCString怎么用?C++ Path::toCString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vfs::Path
的用法示例。
在下文中一共展示了Path::toCString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ExportToFile
void IniFile::ExportToFile(vfs::Path file, const std::string& headerComments) const
{
std::ofstream stream(file.toCString());
if (!headerComments.empty())
{
// Split the header text into lines and export it as INI comment
std::vector<std::string> lines = utils::split( headerComments, "\n" );
for (std::size_t i = 0; i < lines.size(); ++i)
{
stream << "# " << lines[i] << std::endl;
}
// add some additional line break after the header
stream << std::endl;
}
for (Sections::const_iterator i = _settings.begin(); i != _settings.end(); ++i)
{
stream << "[" << i->first << "]" << std::endl;
for (Options::const_iterator kv = i->second.begin(); kv != i->second.end(); ++kv)
{
stream << kv->key << " = " << kv->value << std::endl;
}
stream << std::endl;
}
}
示例2: addFont
void FontCollection::addFont(const int key, const std::string& name, vfs::Path pathFont, const int size, const NColor& color )
{
TTF_Font* ttf = TTF_OpenFont(pathFont.toCString(), size);
if( ttf == NULL )
{
std::string errorStr( TTF_GetError() );
#ifdef CAESARIA_PLATFORM_WIN
errorStr += "\n Is it only latin symbols in path to game?";
#endif
OSystem::error( "CRITICAL!!! ", errorStr );
THROW( errorStr );
}
Font font0;
font0._d->ttfFont = ttf;
SDL_Color c = { color.red(), color.green(), color.blue(), color.alpha() };
font0._d->color = c;
setFont( key, name, font0);
}