Commit graph

6 commits

Author SHA1 Message Date
Berthold Stoeger
7452aa22c2 download: replace progress_bar_text by std::string
No fixed buffers. Sadly, the thing is still a global variable.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-08-13 19:28:30 +02:00
Berthold Stoeger
03b910ee7f core: remove __cplusplus ifdefs
Since all source files are now C++, this is redundant.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-08-13 19:28:30 +02:00
Berthold Stoeger
398cc2b639 cleanup: remove localized snprintf() functions
The last use of these functions was removed in ae299d5e66.

And that's a good thing, because snprintf-style interfaces
make zero sense in times of variable-length character
encodings.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-05-29 09:33:23 +12:00
Berthold Stoeger
322c3b55e6 core: add compile time format check to format_string_std
Had to rewrite the thing, because gcc's warnings don't work
with templatized var-args. Since there is no string-format.cpp
and I didn't want to inline it, moved it to format.cpp.

String formatting is distributed around at least four
headers: membuffer.h, subsurface-string.h, format.h
and format-string.h. This really should be unified!

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
8b51ff7ded core: add locale aware formatting function to std::string
We had locale aware formatting functions that generated QStrings.
Create an alternative that creates std::string, since we want that
in the core.

This commit is unfortunate for two reasons:
- The function is called "casprintf()" for analogy with the QString
  version. However, the non locale aware function is called
  "format_string_std()" for analogy with "format_string()".
  Ultimately these names should be unified. Probably, once there
  are no membuffer users left.
- This does UTF-16->UTF-8->UTF-16 roundtrips. The core formatting
  functions should render UTF-8 and only convert to UTF-16, in
  the UI layer.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2024-04-23 07:47:11 +07:00
Berthold Stoeger
5afe1a53d8 Cleanup: Move *_loc formatting functions into new format.cpp file
qthelper.cpp is already quite voluminous. Move the recently
introduced localized versions of (v)snprintf() and put_format()
into their own translation unit.

Moreover, adopt C-style semantics for asprintf_loc(). This function
will be used to remove fixed-size buffers in core/plannernotes.c.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2018-04-09 11:29:43 -07:00