diff options
author | Tim Mayberry <mojofunk@gmail.com> | 2015-08-03 12:32:31 +1000 |
---|---|---|
committer | Tim Mayberry <mojofunk@gmail.com> | 2017-04-16 14:02:41 +1000 |
commit | c634daef6a9de8df7245d4fb6fbbcdf0ad7ac7ff (patch) | |
tree | e21e96a8a76133570f756ac31c1fad705c92384a /libs/pbd/wscript | |
parent | 78b82b7ff2e28d53faae176776491404115ce02c (diff) |
Add locale independent and thread safe string conversion API with tests
All conversions are performed as if in the "C" locale but without actually
changing locale.
This is a wrapper around printf/sscanf for int types which aren't affected by
locale and uses glib functions g_ascii_strtod and g_ascii_dtostr for
float/double types.
My first attempt at this used std::stringstream and
ios::imbue(std::locale::classic()) as it should be thread safe, but testing
shows it is not for gcc/mingw-w64 on Windows, and possibly also some versions
of macOS/OS X.
Use "yes" and "no" when converting a boolean in PBD::string_to<bool> as this
seems to be the convention used throughout libardour which will allow using
string_to<bool> in those cases.
Add accepted bool string values from PBD::string_is_affirmative to
PBD::string_to<bool>
Mark strings in pbd/string_convert.cc as not for translation
Add u/int16_t string conversions to pbd/string_convert.h and tests
Add DEBUG_TRACE output on conversion errors
Add int8_t/uint8_t conversions(using int16/uint16 types) to string_convert.h
Add support for converting an infinity expression to/from string
Follows the C99/C11 standard for strtof/strtod where subject sequence is an
optional plus or minus sign then INF or INFINITY, ignoring case.
Diffstat (limited to 'libs/pbd/wscript')
-rw-r--r-- | libs/pbd/wscript | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libs/pbd/wscript b/libs/pbd/wscript index 05c2deb1ae..29d82edcb4 100644 --- a/libs/pbd/wscript +++ b/libs/pbd/wscript @@ -73,6 +73,7 @@ libpbd_sources = [ 'stacktrace.cc', 'stateful_diff_command.cc', 'stateful.cc', + 'string_convert.cc', 'strreplace.cc', 'strsplit.cc', 'system_exec.cc', @@ -191,6 +192,7 @@ def build(bld): test/mutex_test.cc test/scalar_properties.cc test/signals_test.cc + test/string_convert_test.cc test/convert_test.cc test/filesystem_test.cc test/natsort_test.cc |