Exemple #1
0
void ZTBowl::Changed(ZTSoup::EChanged iChanged)
	{
	set<uint64> removedIDs;
	this->GetRemoved(removedIDs);

	if (!removedIDs.empty())
		{
		for (vector<ZRef<ZTCrouton> >::iterator i = fTCroutons.begin();
			i != fTCroutons.end(); /*no inc*/)
			{
			if (sContains(removedIDs, (*i)->GetID()))
				{
				ZRef<ZTCrouton> theTCrouton = *i;
				if (ZLOG(s, eDebug, "ZTBowl"))
					{
					s << "Changed, removing TCrouton, ID: "
						<< sStringf("%llX", theTCrouton->GetID())
						<< ", Address: " << sStringf("%p", theTCrouton.Get());
					}

				(*i).StaticCast<ZTCrouton_Bowl>()->fTBowl.Clear();
				i = fTCroutons.erase(i);
				}
			else
				{
				++i;
				}
			}
		}

	ZRef<ZTBowl> selfRef = this;
	set<uint64> addedIDs;
	this->GetAdded(addedIDs);
	for (set<uint64>::const_iterator i = addedIDs.begin(); i != addedIDs.end(); ++i)
		{
		ZRef<ZTCrouton_Bowl> newCrouton = this->MakeCrouton();
		newCrouton->fTBowl = selfRef;
		fTCroutons.push_back(newCrouton);

		if (ZLOG(s, eDebug, "ZTBowl"))
			{
			s << "Changed, added TCrouton, ID: " << sStringf("%llX", *i)
				<< ", Address: " << sStringf("%p", newCrouton.Get());
			}

		this->GetTSoup()->Register(newCrouton, *i);
		}
	}