本文整理汇总了C++中qdict_haskey函数的典型用法代码示例。如果您正苦于以下问题:C++ qdict_haskey函数的具体用法?C++ qdict_haskey怎么用?C++ qdict_haskey使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qdict_haskey函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vxhs_parse_filename
static void vxhs_parse_filename(const char *filename, QDict *options,
Error **errp)
{
if (qdict_haskey(options, "vdisk-id") || qdict_haskey(options, "server")) {
error_setg(errp, "vdisk-id/server and a file name may not be specified "
"at the same time");
return;
}
if (strstr(filename, "://")) {
int ret = vxhs_parse_uri(filename, options);
if (ret < 0) {
error_setg(errp, "Invalid URI. URI should be of the form "
" vxhs://<host_ip>:<port>/<vdisk-id>");
}
}
}
示例2: do_info_migrate_print
void do_info_migrate_print(Monitor *mon, const QObject *data)
{
QDict *qdict;
qdict = qobject_to_qdict(data);
monitor_printf(mon, "Migration status: %s\n",
qdict_get_str(qdict, "status"));
if (qdict_haskey(qdict, "ram")) {
migrate_print_status(mon, "ram", qdict);
}
if (qdict_haskey(qdict, "disk")) {
migrate_print_status(mon, "disk", qdict);
}
}
示例3: migrate_start_postcopy
static void migrate_start_postcopy(QTestState *who)
{
QDict *rsp;
rsp = wait_command(who, "{ 'execute': 'migrate-start-postcopy' }");
g_assert(qdict_haskey(rsp, "return"));
qobject_unref(rsp);
}
示例4: test_panic
static void test_panic(void)
{
uint8_t val;
QDict *response, *data;
val = inb(0x505);
g_assert_cmpuint(val, ==, 1);
outb(0x505, 0x1);
response = qmp_receive();
g_assert(qdict_haskey(response, "event"));
g_assert_cmpstr(qdict_get_str(response, "event"), ==, "GUEST_PANICKED");
g_assert(qdict_haskey(response, "data"));
data = qdict_get_qdict(response, "data");
g_assert(qdict_haskey(data, "action"));
g_assert_cmpstr(qdict_get_str(data, "action"), ==, "pause");
}
示例5: read_blocktime
static void read_blocktime(QTestState *who)
{
QDict *rsp, *rsp_return;
rsp = wait_command(who, "{ 'execute': 'query-migrate' }");
rsp_return = qdict_get_qdict(rsp, "return");
g_assert(qdict_haskey(rsp_return, "postcopy-blocktime"));
qobject_unref(rsp);
}
示例6: process_event
/* handle requests/control events coming in over the channel */
static void process_event(JSONMessageParser *parser, GQueue *tokens)
{
GAState *s = container_of(parser, GAState, parser);
QDict *qdict;
Error *err = NULL;
int ret;
g_assert(s && parser);
g_debug("process_event: called");
qdict = qobject_to_qdict(json_parser_parse_err(tokens, NULL, &err));
if (err || !qdict) {
QDECREF(qdict);
qdict = qdict_new();
if (!err) {
g_warning("failed to parse event: unknown error");
error_setg(&err, QERR_JSON_PARSING);
} else {
g_warning("failed to parse event: %s", error_get_pretty(err));
}
qdict_put_obj(qdict, "error", qmp_build_error_object(err));
error_free(err);
}
/* handle host->guest commands */
if (qdict_haskey(qdict, "execute")) {
process_command(s, qdict);
} else {
if (!qdict_haskey(qdict, "error")) {
QDECREF(qdict);
qdict = qdict_new();
g_warning("unrecognized payload format");
error_setg(&err, QERR_UNSUPPORTED);
qdict_put_obj(qdict, "error", qmp_build_error_object(err));
error_free(err);
}
ret = send_response(s, QOBJECT(qdict));
if (ret < 0) {
g_warning("error sending error response: %s", strerror(-ret));
}
}
QDECREF(qdict);
}
示例7: archipelago_parse_filename
static void archipelago_parse_filename(const char *filename, QDict *options,
Error **errp)
{
const char *start;
char *volume = NULL, *segment_name = NULL;
xport mport = NoPort, vport = NoPort;
if (qdict_haskey(options, ARCHIPELAGO_OPT_VOLUME)
|| qdict_haskey(options, ARCHIPELAGO_OPT_SEGMENT)
|| qdict_haskey(options, ARCHIPELAGO_OPT_MPORT)
|| qdict_haskey(options, ARCHIPELAGO_OPT_VPORT)) {
error_setg(errp, "volume/mport/vport/segment and a file name may not"
" be specified at the same time");
return;
}
if (!strstart(filename, "archipelago:", &start)) {
error_setg(errp, "File name must start with 'archipelago:'");
return;
}
if (!strlen(start) || strstart(start, "/", NULL)) {
error_setg(errp, "volume name must be specified");
return;
}
parse_filename_opts(filename, errp, &volume, &segment_name, &mport, &vport);
if (volume) {
qdict_put(options, ARCHIPELAGO_OPT_VOLUME, qstring_from_str(volume));
g_free(volume);
}
if (segment_name) {
qdict_put(options, ARCHIPELAGO_OPT_SEGMENT,
qstring_from_str(segment_name));
g_free(segment_name);
}
if (mport != NoPort) {
qdict_put(options, ARCHIPELAGO_OPT_MPORT, qint_from_int(mport));
}
if (vport != NoPort) {
qdict_put(options, ARCHIPELAGO_OPT_VPORT, qint_from_int(vport));
}
}
示例8: qdict_haskey_test
static void qdict_haskey_test(void)
{
const char *key = "test";
QDict *tests_dict = qdict_new();
qdict_put(tests_dict, key, qint_from_int(0));
g_assert(qdict_haskey(tests_dict, key) == 1);
QDECREF(tests_dict);
}
示例9: test_qga_get_vcpus
static void test_qga_get_vcpus(gconstpointer fix)
{
const TestFixture *fixture = fix;
QDict *ret;
QList *list;
const QListEntry *entry;
ret = qmp_fd(fixture->fd, "{'execute': 'guest-get-vcpus'}");
g_assert_nonnull(ret);
qmp_assert_no_error(ret);
/* check there is at least a cpu */
list = qdict_get_qlist(ret, "return");
entry = qlist_first(list);
g_assert(qdict_haskey(qobject_to_qdict(entry->value), "online"));
g_assert(qdict_haskey(qobject_to_qdict(entry->value), "logical-id"));
QDECREF(ret);
}
示例10: do_instruction_trace
void do_instruction_trace(Monitor* monitor, const QDict* qdict)
{
if (target_cr3 != 0) {
return;
}
DECAF_printf("do_instruction_trace\n");
if ((qdict != NULL) && (qdict_haskey(qdict, DICT_KEY_PROCNAME))) {
strncpy(target_name, qdict_get_str(qdict, DICT_KEY_PROCNAME), TARGET_NAME_BUF_SIZE);
target_name_len = strlen(target_name);
}
target_name[TARGET_NAME_BUF_SIZE - 1] = '\0';
}
示例11: test_qga_get_fsinfo
static void test_qga_get_fsinfo(gconstpointer fix)
{
const TestFixture *fixture = fix;
QDict *ret;
QList *list;
const QListEntry *entry;
ret = qmp_fd(fixture->fd, "{'execute': 'guest-get-fsinfo'}");
g_assert_nonnull(ret);
qmp_assert_no_error(ret);
/* check there is at least a fs */
list = qdict_get_qlist(ret, "return");
entry = qlist_first(list);
g_assert(qdict_haskey(qobject_to_qdict(entry->value), "name"));
g_assert(qdict_haskey(qobject_to_qdict(entry->value), "mountpoint"));
g_assert(qdict_haskey(qobject_to_qdict(entry->value), "type"));
g_assert(qdict_haskey(qobject_to_qdict(entry->value), "disk"));
QDECREF(ret);
}
示例12: monitor_print_balloon
void monitor_print_balloon(Monitor *mon, const QObject *data)
{
QDict *qdict;
qdict = qobject_to_qdict(data);
if (!qdict_haskey(qdict, "actual")) {
return;
}
monitor_printf(mon, "balloon: actual=%" PRId64,
qdict_get_int(qdict, "actual") >> 20);
qdict_iter(qdict, print_balloon_stat, mon);
monitor_printf(mon, "\n");
}
示例13: deprecated_set_speed
static void deprecated_set_speed(QTestState *who, const char *value)
{
QDict *rsp;
gchar *cmd;
cmd = g_strdup_printf("{ 'execute': 'migrate_set_speed',"
"'arguments': { 'value': %s } }", value);
rsp = qtest_qmp(who, cmd);
g_free(cmd);
g_assert(qdict_haskey(rsp, "return"));
qobject_unref(rsp);
migrate_check_parameter(who, "max-bandwidth", value);
}
示例14: migrate
static void migrate(QTestState *who, const char *uri)
{
QDict *rsp;
gchar *cmd;
cmd = g_strdup_printf("{ 'execute': 'migrate',"
"'arguments': { 'uri': '%s' } }",
uri);
rsp = qtest_qmp(who, cmd);
g_free(cmd);
g_assert(qdict_haskey(rsp, "return"));
qobject_unref(rsp);
}
示例15: qmp_dispatch
static QObject *test_qmp_dispatch(QDict *req)
{
QDict *resp;
QObject *ret;
resp = qmp_dispatch(&qmp_commands, QOBJECT(req), false);
assert(resp && !qdict_haskey(resp, "error"));
ret = qdict_get(resp, "return");
assert(ret);
qobject_ref(ret);
qobject_unref(resp);
return ret;
}