本文整理汇总了C++中FlarmId类的典型用法代码示例。如果您正苦于以下问题:C++ FlarmId类的具体用法?C++ FlarmId怎么用?C++ FlarmId使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FlarmId类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnFlarmLockClicked
static void
OnFlarmLockClicked(gcc_unused WndButton &button)
{
TCHAR newTeamFlarmCNTarget[4];
_tcsncpy(newTeamFlarmCNTarget,
XCSoarInterface::SetSettingsComputer().TeamFlarmCNTarget, 4);
if (!dlgTextEntryShowModal(newTeamFlarmCNTarget, 4))
return;
_tcsncpy(XCSoarInterface::SetSettingsComputer().TeamFlarmCNTarget,
newTeamFlarmCNTarget, 4);
XCSoarInterface::SetSettingsComputer().TeammateCodeValid = false;
if (string_is_empty(XCSoarInterface::SettingsComputer().TeamFlarmCNTarget)) {
XCSoarInterface::SetSettingsComputer().TeamFlarmTracking = false;
XCSoarInterface::SetSettingsComputer().TeamFlarmIdTarget.clear();
return;
}
FlarmId flarmId = FlarmDetails::LookupId(
XCSoarInterface::SettingsComputer().TeamFlarmCNTarget);
if (!flarmId.defined()) {
MessageBoxX(_("Unknown Competition Number"),
_("Not Found"), MB_OK | MB_ICONINFORMATION);
XCSoarInterface::SetSettingsComputer().TeamFlarmTracking = false;
XCSoarInterface::SetSettingsComputer().TeamFlarmIdTarget.clear();
XCSoarInterface::SetSettingsComputer().TeamFlarmCNTarget[0] = 0;
} else {
XCSoarInterface::SetSettingsComputer().TeamFlarmIdTarget = flarmId;
XCSoarInterface::SetSettingsComputer().TeamFlarmTracking = true;
}
}
示例2:
FlarmId
FLARMNetRecord::GetId() const
{
FlarmId id;
id.parse(this->id, NULL);
return id;
};
示例3: OnFlarmLockClicked
static void
OnFlarmLockClicked()
{
TeamCodeSettings &settings =
CommonInterface::SetComputerSettings().team_code;
TCHAR newTeamFlarmCNTarget[settings.team_flarm_callsign.MAX_SIZE];
_tcscpy(newTeamFlarmCNTarget, settings.team_flarm_callsign.c_str());
if (!dlgTextEntryShowModal(newTeamFlarmCNTarget, 4))
return;
if (StringIsEmpty(newTeamFlarmCNTarget)) {
settings.team_flarm_id.Clear();
settings.team_flarm_callsign.clear();
return;
}
LoadFlarmDatabases();
FlarmId ids[30];
unsigned count =
FlarmDetails::FindIdsByCallSign(newTeamFlarmCNTarget, ids, 30);
if (count == 0) {
ShowMessageBox(_("Unknown Competition Number"),
_("Not Found"), MB_OK | MB_ICONINFORMATION);
return;
}
const FlarmId id = PickFlarmTraffic(_("Set new teammate"), ids, count);
if (!id.IsDefined())
return;
TeamActions::TrackFlarm(id, newTeamFlarmCNTarget);
}
示例4: LoadFlarmDatabases
void
InputEvents::eventFlarmDetails(gcc_unused const TCHAR *misc)
{
LoadFlarmDatabases();
StaticString<4> callsign;
callsign.clear();
if (!TextEntryDialog(CommonInterface::main_window, callsign,
_("Competition ID")) ||
callsign.empty())
return;
FlarmId ids[30];
unsigned count = FlarmDetails::FindIdsByCallSign(callsign, ids, 30);
if (count > 0) {
FlarmId id = dlgFlarmDetailsListShowModal(
XCSoarInterface::main_window, _("Show details:"), ids, count);
if (id.IsDefined())
dlgFlarmTrafficDetailsShowModal(id);
} else {
ShowMessageBox(_("Unknown competition number"),
_("Not found"), MB_OK | MB_ICONINFORMATION);
}
}
示例5:
void
FlarmDatabase::Insert(const FlarmRecord &record)
{
FlarmId id = record.GetId();
if (!id.IsDefined())
/* ignore malformed records */
return;
map.insert(std::make_pair(id, record));
}
示例6: LoadSecondaryFile
static void
LoadSecondaryFile(TLineReader &reader)
{
TCHAR *line;
while ((line = reader.read()) != NULL) {
TCHAR *endptr;
FlarmId id;
id.parse(line, &endptr);
if (endptr > line && endptr[0] == _T('=') && endptr[1] != _T('\0')) {
TCHAR *Name = endptr + 1;
TrimRight(Name);
if (!FlarmDetails::AddSecondaryItem(id, Name))
break; // cant add anymore items !
}
}
}
示例7: FindItem
/**
* Find an existing item by its FLARM id. This is a simple linear
* search that doesn't scale well with a large list.
*/
gcc_pure
ItemList::iterator FindItem(FlarmId id) {
assert(id.IsDefined());
return std::find_if(items.begin(), items.end(),
[id](const Item &item) { return item.id == id; });
}
示例8: LookupFLARMDetails
// Used by TeamCode, to select a CN and get back the Id
int LookupFLARMDetails(TCHAR *cn)
{
// try to find flarm from userFile
int index = LookupSecondaryFLARMId(cn);
if (index != -1)
{
return FLARM_Names[index].ID;
}
// try to find flarm from FLARMNet.org File
FlarmId* flarmId = file.GetFlarmIdItem(cn);
if (flarmId != NULL)
{
return flarmId->GetId();
}
return 0;
}
示例9: assert
bool
FlarmDetails::AddSecondaryItem(FlarmId id, const TCHAR *name)
{
assert(id.IsDefined());
assert(traffic_databases != nullptr);
return traffic_databases->flarm_names.Set(id, name);
}
示例10: LookupSecondaryIndex
FlarmId
FlarmDetails::LookupId(const TCHAR *cn)
{
// try to find flarm from userFile
int index = LookupSecondaryIndex(cn);
if (index != -1)
return FLARM_Names[index].ID;
// try to find flarm from FlarmNet.org File
const FlarmNet::Record *record = FlarmNet::FindFirstRecordByCallSign(cn);
if (record != NULL)
return record->GetId();
FlarmId id;
id.clear();
return id;
}
示例11: assert
FlarmId
TrafficDatabases::FindIdByName(const TCHAR *name) const
{
assert(name != nullptr);
assert(!StringIsEmpty(name));
// try to find flarm from userFile
const FlarmId id = flarm_names.Get(name);
if (id.IsDefined())
return id;
// try to find flarm from FlarmNet.org File
const FlarmNetRecord *record = flarm_net.FindFirstRecordByCallSign(name);
if (record != NULL)
return record->GetId();
return FlarmId::Undefined();
}
示例12: LKSound
FlarmIdFile::FlarmIdFile(void)
{
TCHAR path[MAX_PATH];
LKSound(_T("LK_CONNECT.WAV"));
TCHAR flarmIdFileName[MAX_PATH] = TEXT("\0");
#if NOSIM
if (SIMMODE) return;
#else
#ifdef _SIM_
return;
#endif
#endif
LocalPath(path);
wsprintf(flarmIdFileName, TEXT("%s\\%s\\%s"), path, TEXT(LKD_CONF), TEXT(LKF_FLARMNET));
FILE* hFile = _wfopen(flarmIdFileName, TEXT("rt"));
if (hFile == NULL) {
wsprintf(flarmIdFileName, TEXT("%s\\%s\\data.fln"), path, TEXT(LKD_CONF));
hFile = _wfopen(flarmIdFileName, TEXT("rt"));
if (hFile == NULL) return;
}
DWORD fileLength;
fseek (hFile , 0 , SEEK_END);
fileLength = ftell (hFile);
fseek (hFile , 7 , SEEK_SET);
int itemCount = 0;
while( ( (signed)fileLength - ftell(hFile)) > 87) {
FlarmId *flarmId = new FlarmId;
GetItem(hFile, flarmId);
flarmIds[flarmId->GetId()] = flarmId;
itemCount++;
}
FlarmNetCount=itemCount;
fclose(hFile);
}
示例13: LoadFlarmNameFile
void
LoadFlarmNameFile(TLineReader &reader, FlarmNameDatabase &db)
{
TCHAR *line;
while ((line = reader.ReadLine()) != NULL) {
TCHAR *endptr;
FlarmId id = FlarmId::Parse(line, &endptr);
if (!id.IsDefined())
/* ignore malformed records */
continue;
if (endptr > line && endptr[0] == _T('=') && endptr[1] != _T('\0')) {
TCHAR *Name = endptr + 1;
TrimRight(Name);
if (!db.Set(id, Name))
break; // cant add anymore items !
}
}
}
示例14: TEXT
FlarmIdFile::FlarmIdFile(void)
{
TCHAR path[MAX_PATH];
TCHAR flarmIdFileName[MAX_PATH] = TEXT("\0");
LocalPath(path);
_stprintf(flarmIdFileName, TEXT("%s%s%s%s%s"), path, _T(DIRSEP), TEXT(LKD_CONF), _T(DIRSEP), TEXT(LKF_FLARMNET));
FILE* hFile = _tfopen(flarmIdFileName, TEXT("rt"));
if (hFile == NULL) {
_stprintf(flarmIdFileName, TEXT("%s%s%s%sdata.fln"), path, _T(DIRSEP), TEXT(LKD_CONF), _T(DIRSEP));
hFile = _tfopen(flarmIdFileName, TEXT("rt"));
if (hFile == NULL) return;
}
fseek (hFile , 0 , SEEK_END);
long int fileLength = ftell (hFile);
fseek (hFile , 7 , SEEK_SET);
int itemCount = 0;
while( ( fileLength - ftell(hFile)) > 87) {
FlarmId *flarmId = new FlarmId;
_tcscpy(flarmId->id,_T(""));
_tcscpy(flarmId->name,_T(""));
_tcscpy(flarmId->airfield,_T(""));
_tcscpy(flarmId->type,_T(""));
_tcscpy(flarmId->reg,_T(""));
_tcscpy(flarmId->cn,_T(""));
_tcscpy(flarmId->freq,_T(""));
GetItem(hFile, flarmId);
flarmIds[flarmId->GetId()] = flarmId;
itemCount++;
}
FlarmNetCount=itemCount;
fclose(hFile);
}
示例15: LoadColor
static void
LoadColor(FlarmColorDatabase &db, const char *key, FlarmColor color)
{
const char *ids = Profile::Get(key);
if (ids == nullptr)
return;
const char *p = ids;
while (true) {
char *endptr;
FlarmId id = FlarmId::Parse(p, &endptr);
if (id.IsDefined())
db.Set(id, color);
p = strchr(endptr, ',');
if (p == nullptr)
break;
++p;
}
}