Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert garmin_fs functions from char* -> QString #1202

Merged
merged 5 commits into from
Oct 30, 2023

Conversation

tsteven4
Copy link
Collaborator

also

  • move gpx specific garmin_fs_xml_convert to GpxFormat.
  • covert GpxFormat::tag_type to a class enum.

Copy link
Collaborator

@robertlipe robertlipe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice modernization.

void
garmin_fs_xml_convert(const int base_tag, int tag, const QString& qstr, Waypoint* waypt)
bool
garmin_fs_convert_category(const QString& category_name, uint16_t* category)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we phase this stye of calling convention out in favor of returning an optional category ans then testing has_value() in the caller?

Not a blocker for this - I don't want to punish rearrangement...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-out-multi
or in this case as you point out an optional will do.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, but I'm moving on to bigger fish.

// Is the name "Category" followed by a number? Use that number.
if (category_name.startsWith(u"Category ", Qt::CaseInsensitive)) {
bool ok;
int i = category_name.mid(9).toInt(&ok);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...toInt() would probably do that if it were written today.
Also, this could be toUint() and save one test below.

@tsteven4 tsteven4 merged commit 1fcdf28 into GPSBabel:master Oct 30, 2023
19 checks passed
@tsteven4 tsteven4 deleted the garminfsqstring branch October 30, 2023 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants