pocoproject / poco

The POCO C++ Libraries are powerful cross-platform C++ libraries for building network- and internet-based applications that run on desktop, server, mobile, IoT, and embedded systems.
https://pocoproject.org
Other
8.19k stars 2.13k forks source link

Poco::format() doesn't support (space) as a flag like printf() does #2730

Open austin-beer opened 5 years ago

austin-beer commented 5 years ago

printf() supports a space ' ' as a flag in the format specifier. It would be great if Poco::format() supported the same.

http://www.cplusplus.com/reference/cstdio/printf/ https://github.com/pocoproject/poco/blob/1bf40a0cd28be83e6243a0524be19118792c8cd1/Foundation/src/Format.cpp#L30

github-actions[bot] commented 2 years ago

This issue is stale because it has been open for 365 days with no activity.

austin-beer commented 2 years ago

This issue has been open for over two and a half years. Is there any chance of addressing this issue?

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 365 days with no activity.

austin-beer commented 1 year ago

This issue has been open for over three years? Would it be possible for someone to address this issue?

github-actions[bot] commented 7 months ago

This issue is stale because it has been open for 365 days with no activity.

matejk commented 7 months ago

@austin-beer, is this stil an issue in Poco 1.13?

If so, can you prepare a fix and create a pull request?

austin-beer commented 7 months ago

Yes, this is still an issue in Poco 1.13. This switch statement still doesn't handle a space character in the format string: https://github.com/pocoproject/poco/blob/poco-1.13.0-release/Foundation/src/Format.cpp#L35

Unfortunately I don't have time right now to develop a fix for this, but I'll put it on my TODO list to work on if I get time.

andrewauclair commented 6 months ago

Poco::format wraps the C++ streams which don't have an equivalent for this flag. That makes this a pretty difficult feature to implement in Poco. Simply adding a space to that switch isn't going to cut it.

austin-beer commented 6 months ago

Ah, yes, I didn't realize that. It does make implementing this capability more difficult. Perhaps instead then an exception should be thrown if ' ' is encountered as a format flag so that the un-expected behavior (that it's not supported) is clear to anyone who tries to use it.