本文整理汇总了C++中KeySet::current方法的典型用法代码示例。如果您正苦于以下问题:C++ KeySet::current方法的具体用法?C++ KeySet::current怎么用?C++ KeySet::current使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeySet
的用法示例。
在下文中一共展示了KeySet::current方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: parentKey
TEST_F (Simple, SetSystemGetAppend2)
{
using namespace kdb;
KDB kdb;
KeySet ks;
Key parentKey (testRoot, KEY_END);
ks.append (Key ("system" + testRoot + "key", KEY_VALUE, "value1", KEY_END));
kdb.get (ks, parentKey);
ASSERT_EQ (ks.size (), 1) << "got keys from freshly mounted backends";
ks.rewind ();
ks.next ();
EXPECT_EQ (ks.current ().getName (), "system/tests/kdb/key") << "name of element in keyset wrong";
EXPECT_EQ (ks.current ().getString (), "value1") << "string of element in keyset wrong";
kdb.set (ks, parentKey);
kdb.close (parentKey);
KeySet ks2;
ks2.append (Key ("system" + testRoot + "key2", KEY_VALUE, "value2", KEY_END));
kdb.open (parentKey);
kdb.get (ks2, parentKey);
ks2.rewind ();
ks2.next ();
ASSERT_EQ (ks2.size (), 1) << "wrong size";
EXPECT_EQ (ks2.current ().getName (), "system/tests/kdb/key") << "name of element in keyset wrong";
EXPECT_EQ (ks2.current ().getString (), "value1") << "string of element in keyset wrong";
}
示例2:
TEST_F (Simple, GetAppendNamespaces)
{
using namespace kdb;
for (size_t i = 0; i < namespaces.size (); ++i)
{
KDB kdb;
KeySet ks;
ks.append (Key (namespaces[i].name + testRoot + "key", KEY_END));
kdb.get (ks, testRoot);
ASSERT_EQ (ks.size (), 1) << "did not got key appended first with namespace " << namespaces[i].name;
ks.rewind ();
ks.next ();
EXPECT_EQ (ks.current ().getName (), namespaces[i].name + "/tests/kdb/key") << "name of element in keyset wrong";
EXPECT_EQ (ks.current ().getString (), "") << "string of element in keyset wrong";
}
}
示例3: b
TEST(MergeResult, ResolveConflictDeletesConflictMeta)
{
using namespace kdb;
using namespace kdb::tools;
Backend b("my_backend", "/");
b.addPlugin("resolver");
b.addPlugin("dump");
b.validated();
Key rootKey(Backends::mountpointsPath, KEY_END);
KeySet mountConfig;
b.serialise(rootKey, mountConfig);
// outputGTest(mountConfig, "mountConfig");
mountConfig.rewind();
mountConfig.next();
EXPECT_TRUE(mountConfig.current().getName() == "system/elektra/mountpoints/my_backend") << "name of element in keyset wrong";
EXPECT_TRUE(mountConfig.current().getString() == "serialised Backend") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_TRUE(mountConfig.current().getName() == "system/elektra/mountpoints/my_backend/errorplugins") << "name of element in keyset wrong";
EXPECT_TRUE(mountConfig.current().getString() == "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_TRUE(mountConfig.current().getName() == "system/elektra/mountpoints/my_backend/errorplugins/#5#resolver#resolver#") << "name of element in keyset wrong";
EXPECT_TRUE(mountConfig.current().getString() == "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_TRUE(mountConfig.current().getName() == "system/elektra/mountpoints/my_backend/getplugins") << "name of element in keyset wrong";
EXPECT_TRUE(mountConfig.current().getString() == "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_TRUE(mountConfig.current().getName() == "system/elektra/mountpoints/my_backend/getplugins/#0#resolver") << "name of element in keyset wrong";
EXPECT_TRUE(mountConfig.current().getString() == "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_TRUE(mountConfig.current().getName() == "system/elektra/mountpoints/my_backend/getplugins/#5#dump#dump#") << "name of element in keyset wrong";
EXPECT_TRUE(mountConfig.current().getString() == "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_TRUE(mountConfig.current().getName() == "system/elektra/mountpoints/my_backend/mountpoint") << "name of element in keyset wrong";
EXPECT_TRUE(mountConfig.current().getString() == "/") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_TRUE(mountConfig.current().getName() == "system/elektra/mountpoints/my_backend/setplugins") << "name of element in keyset wrong";
EXPECT_TRUE(mountConfig.current().getString() == "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_TRUE(mountConfig.current().getName() == "system/elektra/mountpoints/my_backend/setplugins/#0#resolver") << "name of element in keyset wrong";
EXPECT_TRUE(mountConfig.current().getString() == "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_TRUE(mountConfig.current().getName() == "system/elektra/mountpoints/my_backend/setplugins/#5#dump") << "name of element in keyset wrong";
EXPECT_TRUE(mountConfig.current().getString() == "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_TRUE(mountConfig.current().getName() == "system/elektra/mountpoints/my_backend/setplugins/#7#resolver") << "name of element in keyset wrong";
EXPECT_TRUE(mountConfig.current().getString() == "") << "string of element in keyset wrong";
}
示例4: KeySet
TEST(Backend, SimpleBackend)
{
using namespace kdb;
using namespace kdb::tools;
Backend b;
b.setMountpoint(Key("/", KEY_CASCADING_NAME, KEY_END), KeySet(0, KS_END));
EXPECT_EQ(b.getMountpoint(), "/");
b.addPlugin("resolver");
b.addPlugin("dump");
b.useConfigFile("abc");
EXPECT_TRUE(b.validated());
KeySet mountConfig;
b.serialize(mountConfig);
// outputGTest(mountConfig, "mountConfig");
mountConfig.rewind();
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/\\/") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "This is a configuration for a backend, see subkeys for more information") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/\\//config") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/\\//config/path") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "abc") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/\\//errorplugins") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/\\//errorplugins/#5#resolver#resolver#") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/\\//getplugins") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/\\//getplugins/#0#resolver") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/\\//getplugins/#5#dump#dump#") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/\\//mountpoint") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "/") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/\\//setplugins") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/\\//setplugins/#0#resolver") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/\\//setplugins/#5#dump") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/\\//setplugins/#7#resolver") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
}
示例5: backendConf
TEST(Backend, SimpleBackendWithConf)
{
using namespace kdb;
using namespace kdb::tools;
Backend b;
b.setMountpoint(Key("user/somewhere", KEY_END), KeySet(0, KS_END));
EXPECT_EQ(b.getMountpoint(), "user/somewhere");
KeySet backendConf(5,
*Key("system/globalConf", KEY_VALUE, "for everywhere", KEY_END),
*Key("system/other_global_conf", KEY_VALUE, "more", KEY_END),
KS_END);
b.setBackendConfig(backendConf);
KeySet resConf(5,
*Key("user/res_conf", KEY_VALUE, "do resolving", KEY_END),
*Key("user/other_res_conf", KEY_VALUE, "do resolving too", KEY_END),
KS_END);
b.addPlugin("resolver", resConf);
KeySet dumpConf(5,
*Key("user/file_format", KEY_VALUE, "1", KEY_END),
*Key("user/other_dump_conf", KEY_VALUE, "some dump config", KEY_END),
KS_END);
b.addPlugin("dump", dumpConf);
b.useConfigFile("abc");
EXPECT_TRUE(b.validated());
KeySet mountConfig;
b.serialize(mountConfig);
// outputGTest(mountConfig, "mountConfig");
mountConfig.rewind();
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "This is a configuration for a backend, see subkeys for more information") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/config") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/config/globalConf") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "for everywhere") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/config/other_global_conf") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "more") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/config/path") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "abc") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/errorplugins") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/errorplugins/#5#resolver#resolver#") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/errorplugins/#5#resolver#resolver#/config") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/errorplugins/#5#resolver#resolver#/config/other_res_conf") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "do resolving too") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/errorplugins/#5#resolver#resolver#/config/res_conf") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "do resolving") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/getplugins") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/getplugins/#0#resolver") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/getplugins/#5#dump#dump#") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/getplugins/#5#dump#dump#/config") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/getplugins/#5#dump#dump#/config/file_format") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "1") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/getplugins/#5#dump#dump#/config/other_dump_conf") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "some dump config") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/mountpoint") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "user/somewhere") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/setplugins") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/setplugins/#0#resolver") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/setplugins/#5#dump") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
mountConfig.next();
EXPECT_EQ(mountConfig.current().getName(), "system/elektra/mountpoints/user\\/somewhere/setplugins/#7#resolver") << "name of element in keyset wrong";
EXPECT_EQ(mountConfig.current().getString(), "") << "string of element in keyset wrong";
}