/** @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; }
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; }