Beispiel #1
0
void LLCommonUtils::computeDifference(
	const uuid_vec_t& vnew,
	const uuid_vec_t& vcur,
	uuid_vec_t& vadded,
	uuid_vec_t& vremoved)
{
	uuid_vec_t vnew_copy(vnew);
	uuid_vec_t vcur_copy(vcur);

	std::sort(vnew_copy.begin(), vnew_copy.end());
	std::sort(vcur_copy.begin(), vcur_copy.end());

	size_t maxsize = llmax(vnew_copy.size(), vcur_copy.size());
	vadded.resize(maxsize);
	vremoved.resize(maxsize);

	uuid_vec_t::iterator it;
	// what was removed
	it = set_difference(vcur_copy.begin(), vcur_copy.end(), vnew_copy.begin(), vnew_copy.end(), vremoved.begin());
	vremoved.erase(it, vremoved.end());

	// what was added
	it = set_difference(vnew_copy.begin(), vnew_copy.end(), vcur_copy.begin(), vcur_copy.end(), vadded.begin());
	vadded.erase(it, vadded.end());
}
void LLOutfitsList::getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const
{
	// Collect selected items from all selected lists.
	for (wearables_lists_map_t::const_iterator iter = mSelectedListsMap.begin();
			iter != mSelectedListsMap.end();
			++iter)
	{
		uuid_vec_t uuids;
		(*iter).second->getSelectedUUIDs(uuids);

		S32 prev_size = selected_uuids.size();
		selected_uuids.resize(prev_size + uuids.size());
		std::copy(uuids.begin(), uuids.end(), selected_uuids.begin() + prev_size);
	}
}