Commit Graph

9 Commits

Author SHA1 Message Date
Yat Ho
cbc5388440 build: bump to C++20 (#7191)
* build: bump to C++20

Co-authored-by: Cœur <coeur@gmx.fr>

* refactor: use designated initializers

* refactor: remove redundant SFINAE

* fix: clang-tidy warnings

* chore: comments about min compiler versions for C++20 features

* build: clang objc++ modules build errors

Co-authored-by: Dzmitry Neviadomski <nevack.d@gmail.com>

* refactor: add `TR_CONSTEXPR_VEC` and `TR_CONSTEXPR_STR`

* fix: don't use `std::rel_ops`

* chore: housekeeping

* fix: possible fix for macOS linker error

---------

Co-authored-by: Cœur <coeur@gmx.fr>
Co-authored-by: Dzmitry Neviadomski <nevack.d@gmail.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2026-01-20 16:27:34 -06:00
Yat Ho
03b5035d88 fix: unconst variable to be moved (#8048) 2026-01-02 12:39:39 -06:00
Yat Ho
d726c0d213 fix: optional serializer edge cases (#8044)
* fix: should reject when deserializing wrong optional type

* fix: reject nested optionals in serializer
2026-01-02 10:40:59 -06:00
Charles Kerr
91f39c56a8 refactor: register converters in tr_lib_init() (#8023) 2025-12-28 09:36:49 -06:00
Charles Kerr
ae44cacc31 chore: silence MSVC C4702 unreachable code warning (#8010) 2025-12-25 14:53:37 -06:00
Charles Kerr
d5314e2c44 refactor: add libtransmission-app (#7978)
* refactor: add libtransmission-app

* refactor: add libtransmission-app/display-modes.h

* refactor: use app::SortMode, app:ShowMode in Qt client

* feat: add to_variant(), to_value() in serializer

* refactor: use app::SortMode in GTK client

* refactor: use app::ShowMode in GTK client

* refactor: make naming consistent with libtransmission-app
2025-12-22 20:05:57 -06:00
Yat Ho
91d9f1f776 feat: generic support for optional fields in serializer (#7979) 2025-12-22 07:58:09 -06:00
Charles Kerr
8f445496c2 refactor: use unmanaged_string for periodic torrent_get fields (#7977)
* refactor: remove Session::addKeyName()

refactor: remove Session::removeKeyName()

these should have been removed a long time ago

* fix: better logging on error in Converters

* refactor: add Qt-app-specific variant converters

* refactor: use tr_variant::unmanaged_string(tr_quark) when in torrent_get table mode
2025-12-21 20:49:41 -06:00
Charles Kerr
4599a7312e refactor: libtransmission::serializer redesign (#7954)
* refactor: libtransmission::serializer redesign

This is a followup to bf48eadaeb with several goals.

- `Converters` now has container-like concepts to make it Just Work
  when a user tries to convert containers of T, e.g. std::vector<T>,
  std::set<T>, QStringList, small:vector<T>, etc.

- `Fields` are now stored in a std::tuple instead of a std::array.
  This has two important benefits:
  1. `Fields` are smaller and can be made constexpr / consteval
  2. We no longer need to use type erasure. The void pointer casts
  and typeinfo lookups are gone and the new code is typesafe.

- naming cleanup:

  - renamed the namespace to `libtransmission::serializer`.
  - renamed the file to `serializer.h`
  - renamed the tr_variant<->T converter registry class to `Converters`.

- removed use of the CRTP. You can now serialize any struct
  without having to subclass `Serializable`.

I think I am done refactoring this for awhile.

* fix: naming is hard

docs: better code comments

* fix: clang-tidy readability-identifier-naming

* Update tests/libtransmission/serializer-tests.cc

Co-authored-by: Yat Ho <lagoho7@gmail.com>

* refactor: remove tr_variant<->int converter

* improve tests

---------

Co-authored-by: Yat Ho <lagoho7@gmail.com>
2025-12-21 06:04:18 -06:00