Beispiel #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;
}
Beispiel #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);
		}
	}
Beispiel #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());
}
Beispiel #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());
}
Beispiel #5
0
int Plugin::close (kdb::Key & errorKey)
{
	if (!plugin->kdbClose)
	{
		throw MissingSymbol("kdbClose");
	}

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

	return plugin->kdbOpen(plugin, errorKey.getKey());
}
	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;
	}