#4659 closed Feature Requests (wontfix)
I have 4 new conversion chars I want
Reported by: | Owned by: | Samuel Krempp | |
---|---|---|---|
Milestone: | To Be Determined | Component: | format |
Version: | Boost Development Trunk | Severity: | Not Applicable |
Keywords: | conversion chars | Cc: |
Description
I have already implemented these using the trunk from your subversion:
1). %B this prints out a bool as text true/false
2.a). %b prints out the integer, long what ever as a binary number.
2.b). %b(<sign><base>) prints any integer argument as a base <base> number where 2 <= <base> <= 36, if <sign> is - then use lowercase chars as digits if <sign> is + or nothing then use uppercase chars for the digits.
3). %r inspired by your own %t but %r repeats a space width times it does not do tabulation.
4). %Rc again inspired by %Tc, %Rc repeats char c width times, again it does not do tabulation.
Attachments (1)
Change History (5)
by , 12 years ago
Attachment: | patchfile.patch added |
---|
comment:1 by , 12 years ago
I have also implemented a version of printf, and fprintf using C++0x's Variadic templates well I did two versions the first is feature rich but lacks the %1$ etc syntax the second uses boost::format to do the heavy lifting, and hence has that syntax, both are type safe, I also did a type safe version of scanf and fscanf, using Variadic templates those things rock, I have tested this against my patched format library and it works good :D I could attach the files if thats ok
comment:2 by , 5 years ago
Any changes for non-standard extensions would need to be qualified with preprocessor guards. Bringing Boost.Format up to ISO C11 printf syntax rules is probably the next step, and then anything else like boolean, repeating extensions would need to be identified as non-standard and explicitly enabled, and I would be concerned about the extensions colliding with future standards.
comment:3 by , 5 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
I like the idea of adding more functionality. Specifically I think that %b might make sense and %B might make sense, and I can see where there could be a printf compatible syntax for repeating, however what was suggested does not "end" in a conversion specifier and therefore would not be acceptable as a format string. I'm going to carry the boolean notion over to github issues and close this out.
comment:4 by , 5 years ago
Note that %r and %R are unnecessary as you can use http://en.cppreference.com/w/cpp/string/basic_string/basic_string(constructor number 2) to make a string containing a character of a specific length.
I will be submitting a PR for %b going to std::boolalpha today. %B does not work out, since std::ios_base::uppercase only applies to numeric conversion.
made using "svn diff > patchfile.patch", yep it's a patch file