本文整理汇总了C++中DataFieldEnum::Count方法的典型用法代码示例。如果您正苦于以下问题:C++ DataFieldEnum::Count方法的具体用法?C++ DataFieldEnum::Count怎么用?C++ DataFieldEnum::Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataFieldEnum
的用法示例。
在下文中一共展示了DataFieldEnum::Count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
static void
LoadGUI()
{
assert(!locked);
locked = true;
WndProperty* wp;
wp = (WndProperty*)wf->FindByName(_T("prpFontName"));
if (wp) {
DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField();
if (dfe) {
dfe->Set(0);
unsigned i;
for (i = 0; i < dfe->Count(); i++) {
if (_tcsncmp(dfe->GetAsString(), NewLogFont.lfFaceName, LF_FACESIZE)
== 0)
break;
dfe->Inc();
}
if (i == dfe->Count())
dfe->Set(dfe->addEnumText(NewLogFont.lfFaceName));
}
wp->RefreshDisplay();
}
wp = (WndProperty*)wf->FindByName(_T("prpFontHeight"));
if (wp) {
DataFieldInteger* dfi = (DataFieldInteger*)wp->GetDataField();
if (dfi)
dfi->Set(NewLogFont.lfHeight);
wp->RefreshDisplay();
}
wp = (WndProperty*)wf->FindByName(_T("prpFontWeight"));
if (wp) {
DataFieldBoolean* dfi = (DataFieldBoolean*)wp->GetDataField();
if (dfi)
dfi->Set(NewLogFont.lfWeight > 500);
wp->RefreshDisplay();
}
wp = (WndProperty*)wf->FindByName(_T("prpFontItalic"));
if (wp) {
DataFieldBoolean* dfb = (DataFieldBoolean*)wp->GetDataField();
if (dfb)
dfb->Set(NewLogFont.lfItalic);
wp->RefreshDisplay();
}
locked = false;
RedrawSampleFont();
}
示例2: while
static bool
DetectSerialPorts(DataFieldEnum &df)
{
TTYEnumerator enumerator;
if (enumerator.HasFailed())
return false;
unsigned sort_start = df.Count();
bool found = false;
const char *path;
while ((path = enumerator.Next()) != nullptr) {
const char *display_string = path;
if (memcmp(path, "/dev/", 5) == 0)
display_string = path + 5;
AddPort(df, DeviceConfig::PortType::SERIAL, path, display_string);
found = true;
}
if (found)
df.Sort(sort_start);
return found;
}
示例3:
static unsigned
AddPort(DataFieldEnum &df, DeviceConfig::PortType type,
const TCHAR *text, const TCHAR *display_string=NULL,
const TCHAR *help=NULL)
{
/* the uppper 16 bit is the port type, and the lower 16 bit is a
serial number to make the enum id unique */
unsigned id = ((unsigned)type << 16) + df.Count();
df.AddChoice(id, text, display_string, help);
return id;
}
示例4: opendir
static bool
DetectSerialPorts(DataFieldEnum &df)
{
DIR *dir = opendir("/dev");
if (dir == NULL)
return false;
unsigned sort_start = df.Count();
bool found = false;
struct dirent *ent;
while ((ent = readdir(dir)) != NULL) {
/* filter "/dev/tty*" */
if (memcmp(ent->d_name, "tty", 3) == 0) {
/* filter out "/dev/tty0", ... (valid integer after "tty") */
char *endptr;
strtoul(ent->d_name + 3, &endptr, 10);
if (*endptr == 0)
continue;
} else if (memcmp(ent->d_name, "rfcomm", 6) != 0)
continue;
char path[64];
snprintf(path, sizeof(path), "/dev/%s", ent->d_name);
if (access(path, R_OK|W_OK) == 0 && access(path, X_OK) < 0) {
AddPort(df, DeviceConfig::PortType::SERIAL, path);
found = true;
}
}
closedir(dir);
if (found)
df.Sort(sort_start);
return found;
}