From f645939a6ac20dbcae1acc77311dd3de8c49fec6 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Wed, 1 Nov 2023 07:16:44 -0600 Subject: [PATCH] refactor garmin_fs class (#1203) * use container for garmin_fs ilinks. and leave memory management up to the copy on write container. * make gmsd const for read only usage. this prevents the possiblity of detachment of the ilinks list. * incorporate some variables and functions into garmin_fs_t * unify garmin category conversions. * fiddle with test time zone sensitivity. * add utc option for garmin_txt reader. * correct sign of adjustment * update garmin_txt includes. --- xcsv.cc | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/xcsv.cc b/xcsv.cc index f206f44f9..21ed34d85 100644 --- a/xcsv.cc +++ b/xcsv.cc @@ -1578,6 +1578,43 @@ XcsvFormat::xcsv_waypt_pr(const Waypoint* wpt) break; case XT_EMAIL: { garmin_fs_t* gmsd = garmin_fs_t::find(wpt); + case XcsvStyle::XT_COUNTRY: { + const garmin_fs_t* gmsd = garmin_fs_t::find(wpt); + buff = QString::asprintf(fmp.printfc.constData(), CSTR(garmin_fs_t::get_country(gmsd, ""))); + } + break; + case XcsvStyle::XT_STATE: { + const garmin_fs_t* gmsd = garmin_fs_t::find(wpt); + buff = QString::asprintf(fmp.printfc.constData(), CSTR(garmin_fs_t::get_state(gmsd, ""))); + } + break; + case XcsvStyle::XT_CITY: { + const garmin_fs_t* gmsd = garmin_fs_t::find(wpt); + buff = QString::asprintf(fmp.printfc.constData(), CSTR(garmin_fs_t::get_city(gmsd, ""))); + } + break; + case XcsvStyle::XT_POSTAL_CODE: { + const garmin_fs_t* gmsd = garmin_fs_t::find(wpt); + buff = QString::asprintf(fmp.printfc.constData(), CSTR(garmin_fs_t::get_postal_code(gmsd, ""))); + } + break; + case XcsvStyle::XT_STREET_ADDR: { + const garmin_fs_t* gmsd = garmin_fs_t::find(wpt); + buff = QString::asprintf(fmp.printfc.constData(), CSTR(garmin_fs_t::get_addr(gmsd, ""))); + } + break; + case XcsvStyle::XT_PHONE_NR: { + const garmin_fs_t* gmsd = garmin_fs_t::find(wpt); + buff = QString::asprintf(fmp.printfc.constData(), CSTR(garmin_fs_t::get_phone_nr(gmsd, ""))); + } + break; + case XcsvStyle::XT_FACILITY: { + const garmin_fs_t* gmsd = garmin_fs_t::find(wpt); + buff = QString::asprintf(fmp.printfc.constData(), CSTR(garmin_fs_t::get_facility(gmsd, ""))); + } + break; + case XcsvStyle::XT_EMAIL: { + const garmin_fs_t* gmsd = garmin_fs_t::find(wpt); buff = QString::asprintf(fmp.printfc.constData(), CSTR(garmin_fs_t::get_email(gmsd, ""))); } break;