Ejemplo n.º 1
0
void ProfileMapper::bindUpdate(statement::ptr s, Persistent::Ptr p) const
{
	Profile::Ptr o = downcast(p);

	if (o->dive())
		s->bind(2, o->dive()->id());
	else
		s->bind(2);

	if (o->computer())
		s->bind(3, o->computer()->id());
	else
		s->bind(3);

	if (o->profile().empty())
		s->bind(5);
	else
		s->bind(5, profileToJSON(o->profile()));

	s->bind(4, o->name());
	s->bind(6, o->vendor());
	s->bind(7, o->imported());
	s->bind(8, o->raw_profile());
}
Ejemplo n.º 2
0
std::list<Persistent::Ptr> ProfileMapper::cascade_add(Persistent::Ptr p)
{
	std::list<Persistent::Ptr> result;
	Profile::Ptr o = downcast(p);

	if (! o)
		return result;

	if (o->computer())
		result.push_back(o->computer());
	if (o->dive())
		result.push_back(o->dive());

	std::set<Mix::Ptr> mixes;
	std::list<waypoint>::const_iterator it;
	for (it = o->profile().begin(); it != o->profile().end(); it++)
		mixes.insert(it->mix);

	std::set<Mix::Ptr>::iterator it2;
	for (it2 = mixes.begin(); it2 != mixes.end(); it2++)
		result.push_back(* it2);

	return result;
}