本文整理汇总了C++中DataFieldEnum::GetAsInteger方法的典型用法代码示例。如果您正苦于以下问题:C++ DataFieldEnum::GetAsInteger方法的具体用法?C++ DataFieldEnum::GetAsInteger怎么用?C++ DataFieldEnum::GetAsInteger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataFieldEnum
的用法示例。
在下文中一共展示了DataFieldEnum::GetAsInteger方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadDialog
void
dlgWeatherShowModal()
{
wf = LoadDialog(CallBackTable, UIGlobals::GetMainWindow(),
_T("IDR_XML_WEATHER"));
if (wf == NULL)
return;
WndProperty* wp;
wp = (WndProperty*)wf->FindByName(_T("prpTime"));
if (wp) {
DataFieldEnum* dfe;
dfe = (DataFieldEnum*)wp->GetDataField();
dfe->addEnumText(_T("Now"));
for (unsigned i = 1; i < RasterWeather::MAX_WEATHER_TIMES; i++) {
if (RASP.isWeatherAvailable(i)) {
TCHAR timetext[10];
_stprintf(timetext, _T("%04d"), RASP.IndexToTime(i));
dfe->addEnumText(timetext, i);
}
}
dfe->Set(RASP.GetTime());
wp->RefreshDisplay();
}
wp = (WndProperty*)wf->FindByName(_T("prpDisplayItem"));
DataFieldEnum* dfe;
if (wp) {
dfe = (DataFieldEnum*)wp->GetDataField();
dfe->addEnumText(_("Terrain"));
for (int i = 1; i <= 15; i++) {
const TCHAR *label = RASP.ItemLabel(i);
if (label != NULL)
dfe->addEnumText(label, i);
}
dfe->Set(RASP.GetParameter());
wp->RefreshDisplay();
}
wf->ShowModal();
wp = (WndProperty*)wf->FindByName(_T("prpTime"));
if (wp) {
DataFieldEnum* dfe;
dfe = (DataFieldEnum*)wp->GetDataField();
RASP.SetTime(dfe->GetAsInteger());
}
wp = (WndProperty*)wf->FindByName(_T("prpDisplayItem"));
if (wp)
RASP.SetParameter(wp->GetDataField()->GetAsInteger());
delete wf;
}
示例2: switch
/**
* @return true if the value has changed
*/
static bool
FinishPortField(DeviceConfig &config, const DataFieldEnum &df)
{
unsigned value = df.GetAsInteger();
/* decode the port type from the upper 16 bits of the id; we don't
need the rest, because that's just some serial we don't care
about */
const DeviceConfig::PortType new_type =
(DeviceConfig::PortType)(value >> 16);
switch (new_type) {
case DeviceConfig::PortType::DISABLED:
case DeviceConfig::PortType::AUTO:
case DeviceConfig::PortType::INTERNAL:
case DeviceConfig::PortType::TCP_LISTENER:
if (new_type == config.port_type)
return false;
config.port_type = new_type;
return true;
case DeviceConfig::PortType::SERIAL:
/* Serial Port */
if (new_type == config.port_type &&
_tcscmp(config.path, df.GetAsString()) == 0)
return false;
config.port_type = new_type;
config.path = df.GetAsString();
return true;
case DeviceConfig::PortType::RFCOMM:
/* Bluetooth */
if (new_type == config.port_type &&
_tcscmp(config.bluetooth_mac, df.GetAsString()) == 0)
return false;
config.port_type = new_type;
config.bluetooth_mac = df.GetAsString();
return true;
case DeviceConfig::PortType::IOIOUART:
/* IOIO UART */
if (new_type == config.port_type &&
config.ioio_uart_id == (unsigned)_ttoi(df.GetAsString()))
return false;
config.port_type = new_type;
config.ioio_uart_id = (unsigned)_ttoi(df.GetAsString());
return true;
}
/* unreachable */
assert(false);
return false;
}
示例3: ReadValues
void
TaskPropertiesPanel::OnTaskTypeChange(DataFieldEnum &df)
{
const TaskFactoryType newtype =
(TaskFactoryType)df.GetAsInteger();
if (newtype != ordered_task->GetFactoryType()) {
ReadValues();
ordered_task->SetFactory(newtype);
*task_changed =true;
RefreshView();
}
}
示例4: GetValues
static void GetValues(void) {
WndProperty* wp;
double num=0, mm = 0, ss = 0; // mm,ss are numerators (division) so don't want to lose decimals
if(Units::CoordinateFormat==4) {
int utmXZone=0;
char utmYZone='\0';;
double easting=0, northing=0;
wp = (WndProperty*)wf->FindByName(TEXT("prpUTMzoneX"));
if (wp) {
utmXZone = wp->GetDataField()->GetAsInteger();
}
wp = (WndProperty*)wf->FindByName(TEXT("prpUTMzoneY"));
if (wp) {
DataFieldEnum* dfe = (DataFieldEnum*)wp->GetDataField();
if(dfe){
utmYZone = enumToYZone(dfe->GetAsInteger());
}
}
wp = (WndProperty*)wf->FindByName(TEXT("prpUTMeast"));
if (wp) {
easting = wp->GetDataField()->GetAsFloat();
}
wp = (WndProperty*)wf->FindByName(TEXT("prpUTMnorth"));
if (wp) {
northing = wp->GetDataField()->GetAsFloat();
}
UtmToLatLonWGS84(utmXZone, utmYZone, easting, northing, global_wpt->Latitude, global_wpt->Longitude );
} else {
bool sign = false;
int dd = 0;
wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudeSign"));
if (wp) {
sign = (wp->GetDataField()->GetAsInteger()==1);
}
wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudeD"));
if (wp) {
dd = wp->GetDataField()->GetAsInteger();
}
switch (Units::CoordinateFormat) {
case 0: // ("DDMMSS");
case 1: // ("DDMMSS.ss");
wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudeM"));
if (wp) {
mm = wp->GetDataField()->GetAsInteger();
}
wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudeS"));
if (wp) {
ss = wp->GetDataField()->GetAsInteger();
}
num = dd+mm/60.0+ss/3600.0;
break;
case 2: // ("DDMM.mmm");
wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudeM"));
if (wp) {
mm = wp->GetDataField()->GetAsInteger();
}
wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudemmm"));
if (wp) {
ss = wp->GetDataField()->GetAsInteger();
}
num = dd+(mm+ss/1000.0)/60.0;
break;
case 3: // ("DD.dddd");
wp = (WndProperty*)wf->FindByName(TEXT("prpLongitudeDDDD"));
if (wp) {
mm = wp->GetDataField()->GetAsInteger();
}
num = dd+mm/10000;
break;
case 4:
break;
}
if (!sign) {
num = -num;
}
global_wpt->Longitude = num;
wp = (WndProperty*)wf->FindByName(TEXT("prpLatitudeSign"));
if (wp) {
sign = (wp->GetDataField()->GetAsInteger()==1);
}
wp = (WndProperty*)wf->FindByName(TEXT("prpLatitudeD"));
if (wp) {
dd = wp->GetDataField()->GetAsInteger();
}
switch (Units::CoordinateFormat) {
case 0: // ("DDMMSS");
case 1: // ("DDMMSS.ss");
wp = (WndProperty*)wf->FindByName(TEXT("prpLatitudeM"));
if (wp) {
mm = wp->GetDataField()->GetAsInteger();
}
wp = (WndProperty*)wf->FindByName(TEXT("prpLatitudeS"));
//.........这里部分代码省略.........
示例5: OnSend
void OnSend(WndButton* pWnd) {
if(ItemIndex < FileList.size()) {
StartHourglassCursor();
//Start Bluetooth if needed...
#ifdef UNDER_CE
CObexPush Obex;
if(Obex.Startup()) {
StartupStore(_T("Startup OK \n"));
size_t nDevice = Obex.LookupDevice();
StartupStore(_T("LookupDevice OK \n"));
if(nDevice == 0) {
StopHourglassCursor();
MessageBoxX(_T("No Device"), _T("Error"), mbOk);
StartHourglassCursor();
} else {
WndProperty* wp = (WndProperty*)wfDlg->FindByName(TEXT("prpDeviceList"));
DataFieldEnum* dfe = NULL;
if (wp) {
dfe = (DataFieldEnum*)wp->GetDataField();
}
if(dfe) {
dfe->Clear();
dfe->addEnumText(_T("none"));
}
for(size_t i = 0; i < nDevice; ++i) {
TCHAR szDeviceName[100] = {0};
if(!Obex.GetDeviceName(i, szDeviceName, array_size(szDeviceName))) {
_stprintf(szDeviceName, _T("Unknown device <%d>"), i);
}
StartupStore(_T("GetDeviceName <%d><%s> \n"), i, szDeviceName);
if(dfe) {
dfe->addEnumText(szDeviceName);
}
}
if(wp) {
if(dfe) {
dfe->SetAsInteger(0);
}
wp->SetReadOnly(false);
wp->RefreshDisplay();
}
StopHourglassCursor();
size_t DeviceIndex = 0;
if(dfe && wp) {
dlgComboPicker(wp);
DeviceIndex = dfe->GetAsInteger();
}
StartHourglassCursor();
if(DeviceIndex != 0) {
DeviceIndex--;
TCHAR szFileFullPath[MAX_PATH] = _T("\0");
LocalPath(szFileFullPath, _T(LKD_LOGS));
size_t nLen = _tcslen(szFileFullPath);
if (szFileFullPath[nLen - 1] != _T('\\')) {
_tcscat(szFileFullPath, _T("\\"));
}
FileList_t::const_iterator ItFileName = FileList.begin();
std::advance(ItFileName, ItemIndex);
_tcscat(szFileFullPath, ItFileName->c_str());
if(!Obex.SendFile(DeviceIndex, szFileFullPath)) {
StopHourglassCursor();
MessageBoxX(_T("Send Failed"), _T("Error"), mbOk);
StartHourglassCursor();
} else {
StopHourglassCursor();
MessageBoxX(_T("File sent!"), _T("Success"), mbOk);
StartHourglassCursor();
}
}
}
Obex.Shutdown();
} else {
MessageBoxX(_T("Unsupported on this device"), _T("Error"), mbOk);
}
#else
MessageBoxX(_T("Unsupported on this device"), _T("Error"), mbOk);
#endif
StopHourglassCursor();
}
}