-
Notifications
You must be signed in to change notification settings - Fork 349
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
Support for size values (640 KB) and numbers with unit in general #253
Conversation
Codecov Report
@@ Coverage Diff @@
## master #253 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 12 12
Lines 2566 2665 +99
=====================================
+ Hits 2566 2665 +99
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #253 +/- ##
=====================================
Coverage 100% 100%
=====================================
Files 12 12
Lines 2782 2879 +97
=====================================
+ Hits 2782 2879 +97
Continue to review full report at Codecov.
|
I like the general version and adding an explicit one for common uses. I will probably break out the more specialized transforms (at least the size one here, IP4, etc.) into a separate utilities file so that single header file users won't have a growing file each release. It would be available for either normal or single header file use, but a separate file. Just a heads up for my plans, does not affect this PR. Will hopefully help with #194. |
@henryiii Could you please take a look at the building error on GCC 4.7? I don't have it on my machine and the error is a bit of WTF |
I'll try it out in a 4.7 docker container later today and see if I can see what it's complaining about. GCC 4.7 is a pain, I'll probably be dropping it in a release or two. This looks fixable without too much work, I think. |
Note: This is on my todo list but I'm traveling a bit unexpectedly to cover for someone at a conference, so eventually will get to this! |
@henryiii Sure thing, thank you a lot! |
I believe you are seeing this bug in GCC: https://stackoverflow.com/a/12086873/2402816. I believe you are only putting these methods in the class for organization? There are no members. We can either move them to put this in 1.8 or wait till 1.9 and drop GCC 4.7 support. |
fd231d5
to
4d7642a
Compare
4d7642a
to
beb99d8
Compare
Tricky! Thank you for figuring this out. |
After returning back to this after some time I got an idea. Should I rename |
@phlptp , what do you think on the naming question? I like both. My physics backround leans toward Unit, but Suffix is a little more general |
I think I would have a preference toward "Unit". Given a significant chunk of my time recently has been on a runtime units library I may be bit biased though. |
@metopa Do you want to wait and target 1.9 instead, or try to get this in to 1.8? |
@henryiii I've just updated it |
Thanks! |
This PR adds infrastructure for accepting inputs in form
<number> <unit>
. This covers things like size inputs, durations, and many more.<suffix>
may or may not be separated from the number with space, must contain only letters and optionally can be matched case-insensitively.CLI::AsNumberWithUnit
takes a mapping from unit to factor. Transformation for durations may look like this:Transformation for size is already provided: