Strf Versions Save

Yet another C++ text formatting library.

v0.16.1

1 month ago

Bug fix: Flush buffer on the destructor of basic_string_appender()

v0.16.0

1 month ago
  • Breaking changes

    • Changed how printable types are to be added

    • Redesigned transcoding API

    • removed surrogate_policy facet

    • width_decumulator is now default constructed with remaining_width() == width_max

    • remove copy-constructor from array_destination

    • printing of integers is not overridable anymore

    • added template parameter to printable_overrider_c

    • Renamed/replaced

      • In PrintingTraits: formatters -> format_specifiers

        • suffix _formatter to _format_specifiers in all names
      • Named type requirements Formatters to FormatSpecifier

      • conv -> transcode

      • value_with_formatters -> value_and_format

      • codepoints_robust_count -> count_codepoints

      • codepoints_robust_count_f -> count_codepoints_f

      • codepoints_fast_count -> count_codepoints_fast

      • codepoints_fast_count_f -> codepoints_fast_count_f

      • codepoints_count_result -> count_codepoints_result<CharT>

      • width_and_pos -> width_and_ptr<CharT>

      • min_space_after_recycle to min_destination_buffer_size

      • basic_cstr_writer to basic_cstr_destination

      • basic_char_array_writer to array_destination

      • discarded_destination to discarder

      • type requirement PrintTraits -> PrintableDef

        • and its member type formatters -> format_specifiers
        • and its member function template make_printer_input -> PrintTraits::make_input
      • removed type requirement PrinterInput

      • struct template print_traits -> printer, and

        • print_traits_of -> printer_of
        • print_traits_tag -> printable_tag
      • function template preview to precalculate

      • class templates

        • print_preview to premeasurements
        • size_preview to size_accumulator
        • width_preview to width_accumulator ( and redesigned )
      • type alias print_size_and_width_preview to full_premeasurements

      • enumerations

        • preview_size to precalc_size
        • preview_width to precalc_width
      • Replace class templates destination_no_reserve, destination_calc_size and destination_with_given_size by printing_syntax

      • Change Transcode requirements

        • change parameters order in transcode
        • add unsafe_transcode and unsafe_transcode_size
        • rename member type aliases:
          • src_char_type -> src_code_unit
          • dst_char_type -> dst_code_unit
    • Redesigned destination:

      • destination<CharT> now is a type alias to output_buffer<CharT, 64>, where output_buffer<CharT, N> derives from output_buffer<CharT, N - 1> and the poscondition of output_buffer<CharT, N>::recycle_buffer() is that space() >= (1 >> N)
      • Renamed tepe membes char_type to value_type
      • Removed deprecated function size
    • Removed deprecated type aliases: basic_outbuff, bin_outbuff, u8outbuff, u16outbuff, u32outbuff, woutbuff

    • Removed deprecated class template width_by_func ( and function template make_width_calculator )

    • Replaced facet invalid_seq_notifer by transcoding_error_notifer

    • When transcoding U+FFFD, just translate it to the replacement character of the destination encoding ( don't call trascoding_error_notifier::unsupported_codepoint anymore )

    • Replacing unsigned integers with signed everywhere. Including:

      • signature of virtual function output_buffer::do_write
      • signature of charset functions

v0.15.3

2 years ago

Fixed bugs:

  • #34 - Wrong result when rounding up 9.999...
  • #35 - Wrong rounding in strf::fixed(0.051).p(1)

v0.15.2

2 years ago
  • Rename class template basic_outbuff to destination And its member functions:
    pointer() -> buffer_ptr() end() -> buffer_end() space() -> buffer_space() But create aliases with the old names to preserve backward compatibility

  • Fix bugs in floating-point printing:

    • segfault when printing in fixed notation with precision a value that is to close to zero ( like strf::fixed(1e-30, 3))
    • wrong aligment when printing strf::gen(120.1, 3) > 10
  • Fix some mistakes in CMakeLists.txt:

    • target strf-cuda was equivalent to strf-header-only
    • make exported package relocatable

v0.15.1

2 years ago
  • Now, by default, the width of the input strings is calculated as specified to std::format
  • Now the destructors of narrow_cfile_writer, wide_cfile_write and basic_streambuf_writer call recycle ( or do something equivalent to that )

v0.15.0

2 years ago

Breaking changes:

  • Now you need to invoke punct format function if you want to apply numeric punctuation
  • Made width_t unsigned
  • Modified width_t::round() : now it rounds towards zero on ties ( instead of towards even number ).
  • Removed class template basic_outbuff_noexcept.
  • Added template parameter to narrow_cfile_writer to specify buffer's size.
  • Renamed strf::get_facet to strf::use_facet
  • Renamed outbuff_garbage_buf to garbage_buff
  • Renamed "Char econding" to "charset":
    • char_encoding to charset and
    • char_encoding_id to charset_eid
    • eid_* to scid_*
    • static_char_encoding to static_charset
    • dynamic_char_encoding_data to dynamic_charset_data
    • dynamic_char_encoding to dynamic_charset
    • char_encoding_c to charset_c
    • convert_encoding to convert_charset`
    • convert_from_encoding to convert_from_charset`
    • sanitize_encoding to sanitize_charset
    • sanitize_from_encoding to sanitize_from_charset
    • get_encoding to get_charset
    • CharEncoding to Charset ( type requirement )
    • Charset::char_type to Charset::code_unit
    • Charset::decode_char to Charset::decode_unit
  • Renamed charset and width calculation facets: Added the "_t" suffix, and created a constexpr variable, or a variable template, with each of the previous names. For example:
    • Charsets: The types utf<CharT>, utf8<CharT>, strf::iso_8859_6<CharT>, etc were renamed to utf_t<CharT>, utf8_t<CharT>, strf::iso_8859_6_t<CharT>, etc. The old names ( utf<CharT>, utf8<CharT>, etc ) are now constexpr values.
    • Width calculators: The types fast_width, width_as_fast_u32len, and width_as_u32len were renamed to fast_width_t, width_as_fast_u32len_t and width_as_u32len_t respectively. The old names are now constexpr values.
    • Change the default facet of width_calculator_c to width_as_u32len_t.
    • Modified In PrintTraits::make_printer_input signature: added tag<CharT> parameter.

Improvements:

  • Add support to all ISO-8859-x and Windows-125x character encodings.
  • Create char_array_writer and to_range ( that writes to char* without appending '\0' )

Bug fixes:

  • Fix 32bit floating point in hexadecimal ( it was totally wrong )
  • Transcoding from UTF-16 to UTF-8 ac49b9e5c5a26114a8dd3af1f578a7c7e8bb6e36
  • UTF-8 decoding big codepoints fac0db3d14457e2641cec929b6941309c0ddcd67

Others things:

  • Create write and and do_writemember functions in basic_outbuff
  • Moved benchmarks to another git repository
  • Removed git submodules

v0.14.0

3 years ago
  • Breaking changes:

    • Removed split (a.k.a. internal ) alignment formatting. The following items have been removed:
      • text_alignment::split
      • format function operator%
      • join_split
    • Renamed:
      • alignment_formatter -> dynamic_alignment_formatter
      • empty_alignment_formatter -> alignment_formatter
    • Removed template parameter from float_formatter. Now there is instead a float_notation member variable in float_format.
  • New features

    • Format function pad0 ( similar to printf format flat '0' )
    • Format function fill_sign ( can also use operator~). ( similar to printf format flat ' ' )
  • Little improvements:

    • PrintTraits is more flexible now: If PrintTraits::make_printer_input<CharT>(p,facets,x) is ill-formed, then PrintTraits::make_printer_input<CharT>(p,facets,fmt(x)) is used instead. This reduces boilter-plate code when you extend the library ( add a new printable type )

v0.13.1

3 years ago

Bugfix: Header <intrin.h> was being included inside namespace strf::detail::ryu

v0.13.0

3 years ago
  • New features

    • New printable type: char32_t
    • Created strf::preview function template.
  • Breaking changes:

    • In basic_outbuff, renamed size to space
    • In class template size_preview, renamed get_size to accumulated_size.
    • In class template width_preview, changed behaviour of subtract_width and removed checked_subtract_width.
    • Modified PrintTraits type requirements.
    • In usual_printer_input, rename fp to facets.
    • Modified float_format_fn, int_format_fn, alignemnt_format_fn
    • Redesigned class digits_group_iterator
    • Bug #19 - Now the argument passed to fill must be of a character type
    • Bug #28 - Now *oct(0) is printed as "0", not "00"
    • Now format function operator* and operator+ when applied to integers when the numeric base is not correct.
    • Removed deprecated format function operator~ ( replaced by operator*)
  • Enhance documenation:

    • Created "How to add destinations"
    • Created "How to add printable types"
    • Created "How to override printable types"
    • Document numpunct facet in strf_hpp.html