-
Notifications
You must be signed in to change notification settings - Fork 128
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
Conversation
There was a problem hiding this 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) |
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
also