示例#1
0
EXPORT_C TBool MBtreeLeafOrg::Search(const TAny* aNode,const TAny* aKey,const MBtreeKey& aComp,TBool aLast,TInt& aPos) const
//
// Default to using a binary search through the node, using KeyAt and the key's comparison.
// if aLast is 1, aEntry is the first > the key, return true if previous entry is a match
// if aLast is 0, aEntry is the first entry >= the key, return true is current entry is a match
//
	{
	TInt match=EFalse;
	TInt rr=LastEntry(aNode)-1;
	TInt ll=0;
	__ASSERT_DEBUG(rr>=-1,Panic(EBadEntryCount));
	while (ll<=rr)
		{
		TInt mm=(rr+ll)>>1;
		TInt res=aComp.Compare(aKey,aComp.Key(EntryPtr(aNode,mm)));
		if (res==0)
			match=ETrue;
		if (res+aLast<=0)
			rr=mm-1;		// compare < 0 or match and aLast=0
		else
			ll=mm+1;		// compare > 0 or match and aLast=1
		}
	aPos=ll;
	return match;
	}
示例#2
0
EntryPtr TastyDataCache::entry(int id) const
{
    auto entry = _entries.value(id);
    if (entry)
        return entry->sharedFromThis();

    return EntryPtr();
}
示例#3
0
	EntryPtr AIPaletteLoader::LoadEntry( std::string filename )
	{
		ContainerEntry<AIPalette>* entry = new ContainerEntry<AIPalette>(filename);
		entry->data = FactoryManager::GetSingleton()->GetAIPalette();

		entry->data->Load(filename);

		return EntryPtr(entry);
	}
示例#4
0
	EntryPtr FractionsLoader::LoadEntry( std::string filename )
	{
		ContainerEntry<FractionsPalette>* entry = new ContainerEntry<FractionsPalette>(filename);
		entry->data = FactoryManager::GetSingleton()->GetFractionsPalette();

        char* path = Engine::GetSingleton()->GetResourceManager()->ResourcePath(filename.c_str());
		TiXmlDocument document(path);
		document.LoadFile();

		LoadFractions(document.RootElement());

		return EntryPtr(entry);
	}
示例#5
0
FATArchive::EntryPtr FATArchive::find(const std::string& strFilename) const
{
	// TESTED BY: fmt_grp_duke3d_*
	for (VC_ENTRYPTR::const_iterator i = this->vcFAT.begin();
		i != this->vcFAT.end();
		i++
	) {
		const FATEntry *pFAT = dynamic_cast<const FATEntry *>(i->get());
		if (boost::iequals(pFAT->strName, strFilename)) {
			return *i;  // *i is the original shared_ptr
		}
	}
	return EntryPtr();
}
示例#6
0
EXPORT_C TBool MBtreeIndexOrg::Search(const TAny* aNode,const TAny* aKey,const MBtreeKey& aComp,TBool aLast,TInt& aPos) const
//
// Default to using a binary search through the node, using KeyAt and the key's comparison.
// if aLast is 1, aEntry is the first > the key
// if aLast is 0, aEntry is the first entry >= the key
//
	{
	TInt rr=LastEntry(aNode);
	TInt ll=-1;
	__ASSERT_DEBUG(rr>0,Panic(EBadEntryCount));
	while (rr>ll+1)
		{
		TInt mm=(rr+ll)>>1;
		if (aComp.Compare(aKey,EntryPtr(aNode,mm))+aLast<=0)
			rr=mm;		// compare < 0 or match and aLast=0
		else
			ll=mm;		// compare > 0 or match and aLast=1
		}
	aPos=rr;
	return EFalse;		// return not used
	}
示例#7
0
EXPORT_C TPtrC8 TBtreeInlineIndexOrg::Entry(const TAny* aNode,TInt aPos) const
	{
	return TPtrC8((const TUint8*)EntryPtr(aNode,aPos),KeySize());
	}
示例#8
0
EXPORT_C TPtrC8 TBtreeInlineLeafOrg::Entry(const TAny* aNode,TInt aPos) const
	{
	return TPtrC8((const TUint8*)EntryPtr(aNode,aPos),iEntrySize);
	}