本文整理汇总了C++中IS_TRUE函数的典型用法代码示例。如果您正苦于以下问题:C++ IS_TRUE函数的具体用法?C++ IS_TRUE怎么用?C++ IS_TRUE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IS_TRUE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: test_receive_stream
int test_receive_stream() {
IT("receives a streamed callback message");
reset_callback();
Stream stream;
stream.expect((uint8_t*)"payload",7);
ShimClient shimClient;
shimClient.setAllowConnect(true);
byte connack[] = { 0x20, 0x02, 0x00, 0x00 };
shimClient.respond(connack,4);
PubSubClient client(server, 1883, callback, shimClient, stream);
int rc = client.connect((char*)"client_test1");
IS_TRUE(rc);
byte publish[] = {0x30,0xe,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64};
shimClient.respond(publish,16);
rc = client.loop();
IS_TRUE(rc);
IS_TRUE(callback_called);
IS_TRUE(strcmp(lastTopic,"topic")==0);
IS_TRUE(lastLength == 7);
IS_FALSE(stream.error());
IS_FALSE(shimClient.error());
END_IT
}
开发者ID:4refr0nt,项目名称:ESPEasy-full-source,代码行数:33,代码来源:receive_spec.cpp
示例2: sensors_config
static int sensors_config(const char *key, const char *value) {
if (sensor_list == NULL)
sensor_list = ignorelist_create(1);
/* TODO: This setting exists for compatibility with old versions of
* lm-sensors. Remove support for those ancient versions in the next
* major release. */
if (strcasecmp(key, "SensorConfigFile") == 0) {
char *tmp = strdup(value);
if (tmp != NULL) {
sfree(conffile);
conffile = tmp;
}
} else if (strcasecmp(key, "Sensor") == 0) {
if (ignorelist_add(sensor_list, value)) {
ERROR("sensors plugin: "
"Cannot add value to ignorelist.");
return 1;
}
} else if (strcasecmp(key, "IgnoreSelected") == 0) {
ignorelist_set_invert(sensor_list, 1);
if (IS_TRUE(value))
ignorelist_set_invert(sensor_list, 0);
}
#if (SENSORS_API_VERSION >= 0x400) && (SENSORS_API_VERSION < 0x500)
else if (strcasecmp(key, "UseLabels") == 0) {
use_labels = IS_TRUE(value);
}
#endif
else {
return -1;
}
return 0;
}
开发者ID:rpv-tomsk,项目名称:collectd,代码行数:35,代码来源:sensors.c
示例3: while
/* Hoist det of loop.
e.g: while (a=10,b+=3,c<a) {
IR-LIST;
}
be replaced by
a = 10;
b += 3;
while (c<a) {
IR-LIST;
a = 10;
b += 3;
} */
bool IR_CFS_OPT::hoist_loop(IR ** head, IR * ir)
{
IS_TRUE(IR_type(ir)==IR_DO_WHILE ||
IR_type(ir)==IR_WHILE_DO ||
IR_type(ir)==IR_DO_LOOP, ("need LOOP"));
IS_TRUE(LOOP_det(ir), ("DET is NULL"));
IR * det = LOOP_det(ir);
INT i = 0;
while (det != NULL) {
i++;
det = IR_next(det);
}
IR * new_list = NULL, * new_body_list = NULL;
if (i > 1) {
det = LOOP_det(ir);
while (i > 1) {
IR * c = det;
IS_TRUE(c->is_stmt(), ("Non-stmt ir should be remove "
"during reshape_ir_tree()"));
det = IR_next(det);
remove(&LOOP_det(ir), c);
add_next(&new_list, c);
i--;
}
new_body_list = m_ru->dup_irs_list(new_list);
insertbefore(head, ir, new_list);
add_next(&LOOP_body(ir), new_body_list);
return true;
}
return false;
}
开发者ID:Grainspring,项目名称:xoc,代码行数:47,代码来源:cfs_opt.cpp
示例4: test_receive_oversized_message
int test_receive_oversized_message() {
IT("drops an oversized message");
reset_callback();
ShimClient shimClient;
shimClient.setAllowConnect(true);
byte connack[] = { 0x20, 0x02, 0x00, 0x00 };
shimClient.respond(connack,4);
PubSubClient client(server, 1883, callback, shimClient);
int rc = client.connect((char*)"client_test1");
IS_TRUE(rc);
byte length = MQTT_MAX_PACKET_SIZE+1;
byte publish[] = {0x30,length-2,0x0,0x5,0x74,0x6f,0x70,0x69,0x63,0x70,0x61,0x79,0x6c,0x6f,0x61,0x64};
byte bigPublish[length];
memset(bigPublish,'A',length);
bigPublish[length] = 'B';
memcpy(bigPublish,publish,16);
shimClient.respond(bigPublish,length);
rc = client.loop();
IS_TRUE(rc);
IS_FALSE(callback_called);
IS_FALSE(shimClient.error());
END_IT
}
开发者ID:4refr0nt,项目名称:ESPEasy-full-source,代码行数:32,代码来源:receive_spec.cpp
示例5:
//----------------------------------------------------------//
// CFileDirectTextReader::Open
//----------------------------------------------------------//
CFile::Error::Enum CFileDirectTextReader::Open(void)
{
if (IS_TRUE(Validate()))
{
if (IS_FALSE(IsOpen()))
{
m_pFile = SysFileIO::Fopen(m_strFileName.ConstBuffer(), "rt");
m_nSize = 0;
if (IS_TRUE(IsOpen()))
{
SysFileIO::Fseek(m_pFile, 0, SEEK_END);
m_nSize = SysFileIO::Ftell(m_pFile);
SysFileIO::Fseek(m_pFile, 0, SEEK_SET);
return Error::Ok;
}
return Error::FileOpenFailed;
}
return Error::FileAlreadyOpen;
}
return Error::Failed;
}
开发者ID:lemmingrad,项目名称:NEVista,代码行数:29,代码来源:FileDirectTextReader.cpp
示例6: if
/* Canonicalize det of IF.
e.g: if (a=10,b+=3,c<a) {...}
be replaced by
a = 10;
b += 3;
if (c<a) {...} */
bool IR_CFS_OPT::hoist_if(IR ** head, IR * ir)
{
IS_TRUE(IR_type(ir) == IR_IF, ("need IF"));
IS_TRUE(IF_det(ir), ("DET is NULL"));
IR * det = IF_det(ir);
INT i = 0;
while (det != NULL) {
i++;
det = IR_next(det);
}
IR * new_list = NULL;
if (i > 1) {
det = IF_det(ir);
while (i > 1) {
IR * c = det;
IS_TRUE(c->is_stmt(),
("Non-stmt ir should be remove during reshape_ir_tree()"));
det = IR_next(det);
remove(&IF_det(ir), c);
add_next(&new_list, c);
i--;
}
insertbefore(head, ir, new_list);
return true;
}
return false;
}
开发者ID:Grainspring,项目名称:xoc,代码行数:35,代码来源:cfs_opt.cpp
示例7: interface_config
static int interface_config(const char *key, const char *value) {
if (ignorelist == NULL)
ignorelist = ignorelist_create(/* invert = */ 1);
if (strcasecmp(key, "Interface") == 0) {
ignorelist_add(ignorelist, value);
} else if (strcasecmp(key, "IgnoreSelected") == 0) {
int invert = 1;
if (IS_TRUE(value))
invert = 0;
ignorelist_set_invert(ignorelist, invert);
} else if (strcasecmp(key, "ReportInactive") == 0)
report_inactive = IS_TRUE(value);
else if (strcasecmp(key, "UniqueName") == 0) {
#ifdef HAVE_LIBKSTAT
if (IS_TRUE(value))
unique_name = true;
#else
WARNING("interface plugin: the \"UniqueName\" option is only valid on "
"Solaris.");
#endif /* HAVE_LIBKSTAT */
} else {
return -1;
}
return 0;
}
开发者ID:collectd,项目名称:collectd,代码行数:27,代码来源:interface.c
示例8: df_config
static int df_config (const char *key, const char *value)
{
df_init ();
if (strcasecmp (key, "Device") == 0)
{
if (ignorelist_add (il_device, value))
return (1);
return (0);
}
else if (strcasecmp (key, "MountPoint") == 0)
{
if (ignorelist_add (il_mountpoint, value))
return (1);
return (0);
}
else if (strcasecmp (key, "FSType") == 0)
{
if (ignorelist_add (il_fstype, value))
return (1);
return (0);
}
else if (strcasecmp (key, "IgnoreSelected") == 0)
{
if (IS_TRUE (value))
{
ignorelist_set_invert (il_device, 0);
ignorelist_set_invert (il_mountpoint, 0);
ignorelist_set_invert (il_fstype, 0);
}
else
{
ignorelist_set_invert (il_device, 1);
ignorelist_set_invert (il_mountpoint, 1);
ignorelist_set_invert (il_fstype, 1);
}
return (0);
}
else if (strcasecmp (key, "ReportByDevice") == 0)
{
if (IS_TRUE (value))
by_device = 1;
return (0);
}
else if (strcasecmp (key, "ReportInodes") == 0)
{
if (IS_TRUE (value))
report_inodes = 1;
else
report_inodes = 0;
return (0);
}
return (-1);
}
开发者ID:bangel79,项目名称:collectd,代码行数:58,代码来源:df.c
示例9: IS_TRUE
//----------------------------------------------------------//
// CFileDirectTextReader::GetString
//----------------------------------------------------------//
//-- Description
// Read a string from an open direct access file.
// A string is determined as terminated by a newline
// character or the end of file. Any trailing newline will be
// stripped from the output string.
//----------------------------------------------------------//
s8* CFileDirectTextReader::GetString(s8* pDstBuffer, size_t nDstBufferSize)
{
if ( IS_TRUE(Validate())
&& IS_TRUE(IsOpen())
&& IS_PTR(pDstBuffer)
&& (nDstBufferSize > 0) )
{
return SysFileIO::Fgets(m_pFile, pDstBuffer, nDstBufferSize);
}
return NULL;
}
开发者ID:lemmingrad,项目名称:NEVista,代码行数:21,代码来源:FileDirectTextReader.cpp
示例10: IS_TRUE
//Reverse edge direction
EDGE * GRAPH::rev_edge(EDGE * e)
{
IS_TRUE(m_pool != NULL, ("not yet initialized."));
IS_TRUE(m_is_direction, ("graph is indirection"));
void * einfo = EDGE_info(e);
VERTEX * from = EDGE_from(e);
VERTEX * to = EDGE_to(e);
remove_edge(e);
e = add_edge(VERTEX_id(to), VERTEX_id(from));
EDGE_info(e) = einfo;
return e;
}
开发者ID:bruce2008github,项目名称:xocfe,代码行数:13,代码来源:sgraph.cpp
示例11: cpu_config
static int cpu_config (char const *key, char const *value) /* {{{ */
{
if (strcasecmp (key, "ReportByCpu") == 0)
report_by_cpu = IS_TRUE (value) ? 1 : 0;
else if (strcasecmp (key, "ValuesPercentage") == 0)
report_percent = IS_TRUE (value) ? 1 : 0;
else if (strcasecmp (key, "ReportByState") == 0)
report_by_state = IS_TRUE (value) ? 1 : 0;
else
return (-1);
return (0);
} /* }}} int cpu_config */
开发者ID:Chronial,项目名称:collectd,代码行数:13,代码来源:cpu.c
示例12: disk_config
static int disk_config (const char *key, const char *value)
{
if (ignorelist == NULL)
ignorelist = ignorelist_create (/* invert = */ 1);
if (ignorelist == NULL)
return (1);
if (strcasecmp ("Disk", key) == 0)
{
ignorelist_add (ignorelist, value);
}
else if (strcasecmp ("IgnoreSelected", key) == 0)
{
int invert = 1;
if (IS_TRUE (value))
invert = 0;
ignorelist_set_invert (ignorelist, invert);
}
else if (strcasecmp ("UseBSDName", key) == 0)
{
#if HAVE_IOKIT_IOKITLIB_H
use_bsd_name = IS_TRUE (value) ? 1 : 0;
#else
WARNING ("disk plugin: The \"UseBSDName\" option is only supported "
"on Mach / Mac OS X and will be ignored.");
#endif
}
else if (strcasecmp ("UdevNameAttr", key) == 0)
{
#if HAVE_LIBUDEV
if (conf_udev_name_attr != NULL)
{
free (conf_udev_name_attr);
conf_udev_name_attr = NULL;
}
if ((conf_udev_name_attr = strdup (value)) == NULL)
return (1);
#else
WARNING ("disk plugin: The \"UdevNameAttr\" option is only supported "
"if collectd is built with libudev support");
#endif
}
else
{
return (-1);
}
return (0);
} /* int disk_config */
开发者ID:zach14c,项目名称:collectd,代码行数:49,代码来源:disk.c
示例13: huge_config_callback
static int huge_config_callback(const char *key, const char *val)
{
DEBUG("%s: HugePages config key='%s', val='%s'", g_plugin_name, key, val);
if (strcasecmp(key, g_cfg_rpt_numa) == 0) {
g_flag_rpt_numa = IS_TRUE(val);
return 0;
}
if (strcasecmp(key, g_cfg_rpt_mm) == 0) {
g_flag_rpt_mm = IS_TRUE(val);
return 0;
}
return -1;
}
开发者ID:bzed,项目名称:collectd,代码行数:15,代码来源:hugepages.c
示例14: test_keepalive_disconnects_hung
int test_keepalive_disconnects_hung() {
IT("disconnects a hung connection");
ShimClient shimClient;
shimClient.setAllowConnect(true);
byte connack[] = { 0x20, 0x02, 0x00, 0x00 };
shimClient.respond(connack,4);
PubSubClient client(server, 1883, callback, shimClient);
int rc = client.connect((char*)"client_test1");
IS_TRUE(rc);
byte pingreq[] = { 0xC0,0x0 };
shimClient.expect(pingreq,2);
for (int i = 0; i < 32; i++) {
sleep(1);
rc = client.loop();
}
IS_FALSE(rc);
IS_FALSE(shimClient.error());
END_IT
}
开发者ID:4refr0nt,项目名称:ESPEasy-full-source,代码行数:26,代码来源:keepalive_spec.cpp
示例15: switch
void IR_GVN::dump_bb_labs(LIST<LABEL_INFO*> & lst)
{
for (LABEL_INFO * li = lst.get_head(); li != NULL; li = lst.get_next()) {
switch (LABEL_INFO_type(li)) {
case L_CLABEL:
note(CLABEL_STR_FORMAT, CLABEL_CONT(li));
break;
case L_ILABEL:
note(ILABEL_STR_FORMAT, ILABEL_CONT(li));
break;
case L_PRAGMA:
note("%s", LABEL_INFO_pragma(li));
break;
default: IS_TRUE(0,("unsupport"));
}
if (LABEL_INFO_is_try_start(li) ||
LABEL_INFO_is_try_end(li) ||
LABEL_INFO_is_catch_start(li)) {
fprintf(g_tfile, "(");
if (LABEL_INFO_is_try_start(li)) {
fprintf(g_tfile, "try_start,");
}
if (LABEL_INFO_is_try_end(li)) {
fprintf(g_tfile, "try_end,");
}
if (LABEL_INFO_is_catch_start(li)) {
fprintf(g_tfile, "catch_start");
}
fprintf(g_tfile, ")");
}
fprintf(g_tfile, " ");
}
}
开发者ID:Grainspring,项目名称:xoc,代码行数:33,代码来源:ir_gvn.cpp
示例16: mysql_config_set_boolean
static int mysql_config_set_boolean (int *ret_boolean, /* {{{ */
oconfig_item_t *ci)
{
int status = 0;
if (ci->values_num != 1)
status = -1;
if (status == 0)
{
if (ci->values[0].type == OCONFIG_TYPE_BOOLEAN)
*ret_boolean = ci->values[0].value.boolean;
else if (ci->values[0].type == OCONFIG_TYPE_STRING)
{
if (IS_TRUE (ci->values[0].value.string))
*ret_boolean = 1;
else if (IS_FALSE (ci->values[0].value.string))
*ret_boolean = 0;
else
status = -1;
}
else
status = -1;
}
if (status != 0)
{
WARNING ("mysql plugin: The `%s' config option "
"needs exactly one boolean argument.", ci->key);
return (-1);
}
return (0);
} /* }}} mysql_config_set_boolean */
开发者ID:nkazzaz,项目名称:collectd-freeswitch,代码行数:33,代码来源:mysql.c
示例17: unlink
void GRAPH::dump_dot(CHAR const* name)
{
if (name == NULL) {
name = "graph.dot";
}
unlink(name);
FILE * h = fopen(name, "a+");
IS_TRUE(h, ("%s create failed!!!", name));
fprintf(h, "digraph G {\n");
//Print node
INT c;
for (VERTEX const* v = m_vertexs.get_first(c);
v != NULL; v = m_vertexs.get_next(c)) {
fprintf(h, "\nnode%d [shape = Mrecord, label=\"{BB%d}\"];",
VERTEX_id(v), VERTEX_id(v));
}
//Print edge
for (EDGE const* e = m_edges.get_first(c);
e != NULL; e = m_edges.get_next(c)) {
fprintf(h, "\nnode%d->node%d[label=\"%s\"]",
VERTEX_id(EDGE_from(e)),
VERTEX_id(EDGE_to(e)),
"");
}
fprintf(h, "\n}\n");
fclose(h);
}
开发者ID:bruce2008github,项目名称:xocfe,代码行数:29,代码来源:sgraph.cpp
示例18: apcups_config
static int apcups_config (const char *key, const char *value)
{
if (strcasecmp (key, "host") == 0)
{
if (conf_host != NULL)
{
free (conf_host);
conf_host = NULL;
}
if ((conf_host = strdup (value)) == NULL)
return (1);
}
else if (strcasecmp (key, "Port") == 0)
{
int port_tmp = atoi (value);
if (port_tmp < 1 || port_tmp > 65535)
{
WARNING ("apcups plugin: Invalid port: %i", port_tmp);
return (1);
}
conf_port = port_tmp;
}
else if (strcasecmp (key, "ReportSeconds") == 0)
{
if (IS_TRUE (value))
conf_report_seconds = 1;
else
conf_report_seconds = 0;
}
else
{
return (-1);
}
return (0);
}
开发者ID:BrianB2,项目名称:collectd,代码行数:35,代码来源:apcups.c
示例19: smart_config
static int smart_config (const char *key, const char *value)
{
if (ignorelist == NULL)
ignorelist = ignorelist_create (/* invert = */ 1);
if (ignorelist == NULL)
return (1);
if (strcasecmp ("Disk", key) == 0)
{
ignorelist_add (ignorelist, value);
}
else if (strcasecmp ("IgnoreSelected", key) == 0)
{
int invert = 1;
if (IS_TRUE (value))
invert = 0;
ignorelist_set_invert (ignorelist, invert);
}
else
{
return (-1);
}
return (0);
} /* int smart_config */
开发者ID:skarlsson,项目名称:collectd,代码行数:25,代码来源:smart.c
示例20: cpu_config
static int cpu_config (const char *key, const char *value)
{
if (strcasecmp (key, "ReportByCpu") == 0) {
report_by_cpu = IS_TRUE (value) ? 1 : 0;
if (!report_by_cpu)
report_percent = 1;
}
if (strcasecmp (key, "ValuesPercentage") == 0) {
report_percent = IS_TRUE (value) ? 1 : 0;
if (!report_percent)
report_by_cpu = 1;
}
if (strcasecmp (key, "ReportActive") == 0)
report_active = IS_TRUE (value) ? 1 : 0;
return (-1);
}
开发者ID:JaseFace,项目名称:collectd,代码行数:16,代码来源:cpu.c
注:本文中的IS_TRUE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论