本文整理汇总了C++中ConstIndexedIOPtr::path方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstIndexedIOPtr::path方法的具体用法?C++ ConstIndexedIOPtr::path怎么用?C++ ConstIndexedIOPtr::path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConstIndexedIOPtr
的用法示例。
在下文中一共展示了ConstIndexedIOPtr::path方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tokens
ObjectPtr Object::LoadContext::loadObjectOrReference( const IndexedIO *container, const IndexedIO::EntryID &name )
{
IndexedIO::Entry e = container->entry( name );
if( e.entryType()==IndexedIO::File )
{
IndexedIO::EntryIDList pathParts;
if ( e.dataType() == IndexedIO::InternedStringArray )
{
pathParts.resize( e.arrayLength() );
InternedString *p = &(pathParts[0]);
container->read( name, p, e.arrayLength() );
}
else
{
// for backward compatibility...
string path;
container->read( name, path );
typedef boost::tokenizer<boost::char_separator<char> > Tokenizer;
// \todo: this would have trouble if the name of the object contains slashes...
Tokenizer tokens(path, boost::char_separator<char>("/"));
Tokenizer::iterator t = tokens.begin();
for ( ; t != tokens.end(); t++ )
{
pathParts.push_back( *t );
}
}
std::pair< LoadedObjectMap::iterator,bool > ret = m_loadedObjects->insert( std::pair<IndexedIO::EntryIDList, ObjectPtr>( pathParts, NULL ) );
if ( ret.second )
{
// jump to the path..
ConstIndexedIOPtr ioObject = m_ioInterface->directory( pathParts );
// add the loaded object to the map.
ret.first->second = loadObject( ioObject );
}
return ret.first->second;
}
else
{
ConstIndexedIOPtr ioObject = container->subdirectory( name );
IndexedIO::EntryIDList pathParts;
ioObject->path( pathParts );
std::pair< LoadedObjectMap::iterator,bool > ret = m_loadedObjects->insert( std::pair<IndexedIO::EntryIDList, ObjectPtr>( pathParts, NULL ) );
if ( ret.second )
{
// add the loaded object to the map.
ret.first->second = loadObject( ioObject );
}
return ret.first->second;
}
}