本文整理汇总了C++中set_property函数的典型用法代码示例。如果您正苦于以下问题:C++ set_property函数的具体用法?C++ set_property怎么用?C++ set_property使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_property函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: systemd_start_unit
int systemd_start_unit(struct container *ct, int pid)
{
static const char *mode = "fail";
char *slice = "system.slice";
char unit_name[PATH_MAX], *name = unit_name;
char desc[1024], *pdesc = desc;
dbus_bool_t yes = true;
DBusConnection *conn;
DBusMessage *msg, *reply;
DBusMessageIter args, props, aux;
if (ct->slice)
slice = ct->slice;
snprintf(unit_name, sizeof(unit_name), "%s-%s.scope", slice, ct->name);
snprintf(desc, sizeof(desc), "docker container %s", ct->name);
msg = dbus_message_new_method_call("org.freedesktop.systemd1",
"/org/freedesktop/systemd1",
"org.freedesktop.systemd1.Manager",
"StartTransientUnit");
if (!msg) {
pr_err("can't allocate new method call");
return -1;
}
dbus_message_append_args(msg, 's', &name, 's', &mode, 0);
dbus_message_iter_init_append(msg, &args);
dbus_message_iter_open_container(&args, 'a', "(sv)", &props);
set_property(&props, "Description", 's', &pdesc);
set_property(&props, "Slice", 's', &slice);
set_property(&props, "MemoryAccounting", 'b', &yes);
set_property(&props, "CPUAccounting", 'b', &yes);
set_property(&props, "BlockIOAccounting", 'b', &yes);
set_pid(&props, pid);
dbus_message_iter_close_container(&args, &props);
dbus_message_iter_open_container(&args, 'a', "(sa(sv))", &aux);
dbus_message_iter_close_container(&args, &aux);
conn = get_connection(DBUS_BUS_SYSTEM);
if (conn == NULL)
return -1;
reply = dbus_send_message(conn, msg);
dbus_message_unref(msg);
if (reply == NULL)
return -1;
dbus_message_unref(reply);
return 0;
}
示例2: set_property
void PannerEditor::set_properties(Property *p_pos,Property *p_depth) {
pos=p_pos;
depth=p_depth;
set_property(PROP_PAN,p_pos);
set_property(PROP_DEPTH,p_depth);
update();
}
示例3: powermgt_init
static void
powermgt_init(char *path)
{
phandle_t ph;
char buf[64];
snprintf(buf, sizeof(buf), "%s/power-mgt", path);
REGISTER_NAMED_NODE(rtc, buf);
ph = find_dev(buf);
set_property(ph, "device_type", "power-mgt", 10);
set_property(ph, "mgt-kind", "min-consumption-pwm-led", strlen("min-consumption-pwm-led") + 1);
set_property(ph, "compatible", "cuda", strlen("cuda") + 1);
}
示例4: create
void create() {
set_property("light", 2);
set_property("indoors", 1);
set_property("no castle", 1);
set("short", "%^YELLOW%^Entry to the Hall of Monks");
set_long("%^YELLOW%^The Quixxiol monastery is a place where monks gather and initiate new believers. A passage to the east if filled with a shimmering light. <preview> will tell you about becoming a monk.");
set_items(
(["candles" : "They are all over the monastery.",
"candle" : "It burns brightly and helps light the room.",
"passage" : "You sense that only monks may pass that way."]) );
set_exits(
(["west" : GCITY "gcity10.c",
"southeast" : "(: southeast :)"]) );
}
示例5: chest_shatter_msg
static void
chest_shatter_msg(struct obj *otmp)
{
const char *disposition;
const char *thing;
long save_Blinded;
if (otmp->oclass == POTION_CLASS) {
pline(msgc_itemloss, "You %s %s shatter!", Blind ? "hear" : "see",
an(bottlename()));
if (!breathless(youmonst.data) || haseyes(youmonst.data))
potionbreathe(&youmonst, otmp);
return;
}
/* We have functions for distant and singular names, but not one
which does _both_...
TODO: fix this blindness kludge (it doesn't even work -- see eoto) */
save_Blinded = property_timeout(&youmonst, BLINDED);
set_property(&youmonst, BLINDED, 1, TRUE);
thing = singular(otmp, xname);
if (save_Blinded)
set_property(&youmonst, BLINDED, save_Blinded, TRUE);
switch (objects[otmp->otyp].oc_material) {
case PAPER:
disposition = "is torn to shreds";
break;
case WAX:
disposition = "is crushed";
break;
case VEGGY:
disposition = "is pulped";
break;
case FLESH:
disposition = "is mashed";
break;
case GLASS:
disposition = "shatters";
break;
case WOOD:
disposition = "splinters to fragments";
break;
default:
disposition = "is destroyed";
break;
}
pline(msgc_itemloss, "%s %s!", An(thing), disposition);
}