本文整理汇总了C++中vfs::Path::toString方法的典型用法代码示例。如果您正苦于以下问题:C++ Path::toString方法的具体用法?C++ Path::toString怎么用?C++ Path::toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vfs::Path
的用法示例。
在下文中一共展示了Path::toString方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ConstructFromFile
IniFilePtr IniFile::ConstructFromFile(vfs::Path filename)
{
// Start parsing
std::ifstream iniFile(filename.toString().c_str());
if (!iniFile)
{
Logger::warning( "[IniFile]: Cannot open file " + filename.toString() );
return IniFilePtr();
}
return ConstructFromStream(iniFile);
}
示例2: ExportToFile
void IniFile::ExportToFile(vfs::Path file, const std::string& headerComments) const
{
std::ofstream stream(file.toString().c_str());
if (!headerComments.empty())
{
// Split the header text into lines and export it as INI comment
std::vector<std::string> lines = StringHelper::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;
}
}
示例3: load
VariantMap SaveAdapter::load( const vfs::Path& filename )
{
Logger::warning( "SaveAdapter: try load model from " + filename.toString() );
NFile f = NFile::open( filename );
return load( f );
}
示例4: open
bool Addon::open(vfs::Path path)
{
# ifdef CAESARIA_PLATFORM_WIN
_d->library = ::LoadLibraryA(path.toString().c_str());
# else
_d->library = ::dlopen(path.toString().c_str(), RTLD_LAZY);
# endif
if( _d->library != 0 )
{
_d->isOpened = true;
_d->funcInit = _d->initFunction<addonInitFunctor>( "initialize" );
_d->funcGetVersion = _d->initFunction<addonGetVersionFunctor>( "getVersion" );
_d->funcGetLevel = _d->initFunction<addonGetLevelFunctor>( "getLevel" );
}
return _d->isOpened;
}
示例5: start
void PictureBank::Impl::loadAtlas(const vfs::Path& filePath)
{
if( !filePath.exist() )
{
Logger::warning( "PictureBank: cant find atlas " + filePath.toString() );
return;
}
VariantMap info = config::load( filePath );
vfs::Path texturePath = info.get( "texture" ).toString();
vfs::NFile file = vfs::NFile::open( texturePath );
Picture mainTexture;
if( file.isOpen() )
{
mainTexture = PictureLoader::instance().load( file );
}
else
{
Logger::warning( "PictureBank: load atlas failed for texture" + texturePath.toString() );
mainTexture = Picture::getInvalid();
}
//SizeF mainRectSize = mainTexture.size().toSizeF();
if( !info.empty() )
{
VariantMap items = info.get( framesSection ).toMap();
for( auto& i : items )
{
VariantList rInfo = i.second.toList();
Picture pic = mainTexture;
Point start( rInfo.get( 0 ).toInt(), rInfo.get( 1 ).toInt() );
Size size( rInfo.get( 2 ).toInt(), rInfo.get( 3 ).toInt() );
pic.setOriginRect( Rect( start, size ) );
setPicture( i.first, pic );
}
}
}
示例6: initialize
void PictureInfoBank::initialize(vfs::Path filename)
{
Logger::warning( "PictureInfoBank: start load offsets from " + filename.toString() );
VariantMap m = config::load( filename );
foreach( it, m )
{
Variant v = it->second;
Logger::warning( "Set offset for " + it->first );
if( v.type() == Variant::Map )
{
VariantMap vm = v.toMap();
int startIndex = vm[ "start" ];
int stopIndex = vm[ "stop" ];
std::string rc = vm[ "rc" ].toString();
Point offset = vm[ "offset" ].toPoint();
_d->setRange( rc.empty() ? it->first : rc, startIndex, stopIndex, offset );
}
else if( v.type() == Variant::List )
{
VariantList vl = v.toList();
_d->setOne( it->first, vl.get( idxIndex ), vl.get( idxXOffset ), vl.get( idxYOffset ) );
}
}
示例7:
void Game::Impl::initFontCollection( vfs::Path resourcePath )
{
Logger::warning( "Game: load fonts" );
std::string fontname = SETTINGS_STR( font );
FontCollection::instance().initialize( resourcePath.toString(), fontname );
}