Exemplo n.º 1
0
/** @return a renamed key
  */
inline kdb::Key rename_key (kdb::Key k, std::string sourceName, std::string newDirName, bool verbose)
{
	std::string otherName = k.getName ();
	std::string baseName = otherName.substr (sourceName.length ());
	if (verbose) std::cout << "key: " << otherName << " will be renamed to: " << newDirName + baseName << std::endl;

	kdb::Key newKey = k.dup ();
	newKey.setName (newDirName + baseName);
	return newKey;
}
Exemplo n.º 2
0
	/**
	 * @brief attempts to add a subkey to the entry key
	 * 
	 * If the secure flag is set, does check if the given
	 * key is really a sub key. If not, nothing is added.
	 * 
	 * @param key The key do be added as sub key
	 * @param secure Whether to check if @p k is real subkey
     */
	void addSubkey (kdb::Key k, bool secure = false)
	{
		if (!secure || k.isBelow (static_cast<kdb::Key &> (*this)))
		{
			m_subkeys.append (k);
		}
	}
Exemplo n.º 3
0
int Plugin::error (kdb::KeySet & ks, kdb::Key & parentKey)
{
	if (!plugin->kdbError)
	{
		throw MissingSymbol("kdbError");
	}

	return plugin->kdbError(plugin, ks.getKeySet(), parentKey.getKey());
}
Exemplo n.º 4
0
int Plugin::set (kdb::KeySet & ks, kdb::Key & parentKey)
{
	if (!plugin->kdbSet)
	{
		throw MissingSymbol("kdbSet");
	}

	return plugin->kdbSet(plugin, ks.getKeySet(), parentKey.getKey());
}
Exemplo n.º 5
0
int Plugin::close (kdb::Key & errorKey)
{
	if (!plugin->kdbClose)
	{
		throw MissingSymbol("kdbClose");
	}

	return plugin->kdbClose(plugin, errorKey.getKey());
}
Exemplo n.º 6
0
int Plugin::open (kdb::Key & errorKey)
{
	if (!plugin->kdbOpen)
	{
		throw MissingSymbol("kdbOpen");
	}

	return plugin->kdbOpen(plugin, errorKey.getKey());
}
Exemplo n.º 7
0
	void visit(std::string name, unsigned long depth, kdb::Key k)
	{
		for (unsigned long i = 0; i<depth; ++i)
		{
			std::cout << "   ";
		}

		std::cout << name;

		if (k)
		{
			std::cout
				<< "(" << k.getName() << ") = "
				<< k.getString();
		}

		std::cout << std::endl;
	}