Exemplo n.º 1
0
void ListChecker::buildup (Factory &f, std::string const& templateParameter)
{
	structure = f.get(templateParameter);
	CheckerPtr c = f.get(templateParameter);
	if (!c.get()) throw "Could not create structure of template Parameter";

	// recursive handling code would belong here, but we don't have config
	// at the moment in ListChecker...
	c->buildup(f, "");

	structure = move(c);
}
Exemplo n.º 2
0
static inline Checker* buildChecker(kdb::KeySet config)
{
	kdb::Key k = config.lookup ("/struct");
	if (!k) throw "No Key describing the struct found";

	Factory f (config.cut(k));

	std::stringstream ss (k.getString());

	std::string whichChecker;
	ss >> whichChecker;

	CheckerPtr c = f.get(whichChecker);
	if (!c.get()) throw "Could not create list";

	std::string whichParameter;
	ss >> whichParameter;

	c->buildup(f, whichParameter);
	return c.release();
}
Exemplo n.º 3
0
	void check (kdb::KeySet &ks) override
	{
		kdb::Key k;
		kdb::KeySet ks2 (ks.dup());

		ks2.rewind();
		kdb::Key root = ks2.next();
		if (!root) throw "ListChecker: no root key found";

		while ((k = ks2.next()))
		{
			if (!root.isDirectBelow(k)) throw "ListChecker: key is not direct below";

			kdb::KeySet cks(ks2.cut(k));

			structure->check(cks);
		}
	}