aboutsummaryrefslogtreecommitdiff
path: root/lib/util.h
AgeCommit message (Collapse)Author
2020-06-14quotient_common.h for common namespace thingsKitsune Ral
The two main cases for this header file are: * namespace QMatrixClient = Quotient should occur exactly once, to respect ODR. * Q_NAMESPACE for namespace Quotient (to enable Q_ENUM_NS, particularly) must be defined exactly once, for the same reason.
2020-06-09Comments refreshKitsune Ral
[skip ci]
2019-11-01Omittable: Add direct-list-initialising operator=; documentKitsune Ral
See the change in connection.cpp for the example of usage. Also: removed static_asserts: the first one is provided by std::optional, and the second one is only relevant to edit().
2019-11-01Reinstate Omittable<>::omitted (deprecated)Kitsune Ral
To ease on back-compatibility.
2019-11-01Omittable: get rid of value()Kitsune Ral
Xcode 10 doesn't have it, and value() is not quite fitting mostly-exceptionless Quotient anyway.
2019-11-01Derive Omittable<> from std::optional<>Kitsune Ral
That breaks API all over the place but: 1. The fixes are trivial. 2. More of std:: is used instead of home-baking the same stuff.
2019-10-02wrap_in_function()Kitsune Ral
Because Apple stdlib doesn't have std::function deduction guides.
2019-09-29function_traits: drop unused piecesKitsune Ral
is_callable won't ever be needed because std::is_invokable is here; arg_number and returns() didn't find its users; and function_type has been just broken all along for member functions.
2019-09-12Introduce HashQ<> and UnorderedMap<>Kitsune Ral
Invading into std:: is frowned upon, even though legitimate from the C++ standard perspective. Given that it's possible to pass a hash object to unordered_map, it only takes an alias for std::unordered_map to avoid having to specialize std::hash. And besides, a generic compatibility bridge between qHash and std::hash has been long needed. std::hash<QString> in converters.h remains for now; it will be dropped separately when the API files get regenerated to use UnorderedMap.
2019-08-11Now that we're C++17, remove old compatibility cruftKitsune Ral
2019-08-09stringToHueF: pick a safer name for the variableKitsune Ral
std::string is still a thing, after all.
2019-08-09Namespace: QMatrixClient -> Quotient (with back comp alias)Kitsune Ral
2019-08-02Apply the new brace wrapping to source filesKitsune Ral
2019-07-09Merge branch 'master' into use-clang-formatKitsune Ral
2019-07-09Move serverPart() to the public APIKitsune Ral
Also: Connection::resolveServer() now only accepts MXIDs, not domains.
2019-06-29Merge remote-tracking branch 'remotes/origin/master' into use-clang-formatKitsune Ral
2019-06-24Merge branch 'master' into clang-formatKitsune Ral
# Conflicts: # CMakeLists.txt # lib/avatar.cpp # lib/connection.cpp # lib/connection.h # lib/connectiondata.cpp # lib/csapi/account-data.cpp # lib/csapi/account-data.h # lib/csapi/capabilities.cpp # lib/csapi/capabilities.h # lib/csapi/content-repo.cpp # lib/csapi/create_room.cpp # lib/csapi/filter.cpp # lib/csapi/joining.cpp # lib/csapi/keys.cpp # lib/csapi/list_joined_rooms.cpp # lib/csapi/notifications.cpp # lib/csapi/openid.cpp # lib/csapi/presence.cpp # lib/csapi/pushrules.cpp # lib/csapi/registration.cpp # lib/csapi/room_upgrades.cpp # lib/csapi/room_upgrades.h # lib/csapi/search.cpp # lib/csapi/users.cpp # lib/csapi/versions.cpp # lib/csapi/whoami.cpp # lib/csapi/{{base}}.cpp.mustache # lib/events/accountdataevents.h # lib/events/eventcontent.h # lib/events/roommemberevent.cpp # lib/events/stateevent.cpp # lib/jobs/basejob.cpp # lib/jobs/basejob.h # lib/networkaccessmanager.cpp # lib/networksettings.cpp # lib/room.cpp # lib/room.h # lib/settings.cpp # lib/settings.h # lib/syncdata.cpp # lib/user.cpp # lib/user.h # lib/util.cpp
2019-05-23Move out the logic of the hue calculation to utilsAlexey Andreyev
2019-03-24Expose linkifyUrls() into library API for future useKitsune Ral
2019-03-24RoomMemberEvent: sanitize user display namesKitsune Ral
MemberEventContent::displayName() will strip away Unicode text direction override characters. Direct access to JSON can still provide "raw" data.
2019-03-02style: apply .clang-format to all .cpp and .h filesMarc Deop
2019-02-25Have a build-wide macro for compilers that don't handle init-lists rightKitsune Ral
WORKAROUND_EXTENDED_INITIALIZER_LIST -> BROKEN_INITIALIZER_LISTS is available from util.h now.
2019-02-15Omittable: disallow implicit conversion to value_type altogetherKitsune Ral
Because it works, and fails, in surprising ways. And none of the code uses it, as of now.
2019-02-09csapi: GetCapabilitiesJob (MSC1753)Kitsune Ral
2019-01-13Merge branch 'kitsune-workaround-stuck-invites'Kitsune Ral
2019-01-13qt_connection_util.h: a new home for connectSingleShot() and newly made ↵Kitsune Ral
connectUntil()
2019-01-13util.h: check for fallthrough attribute instead of C++ versionKitsune Ral
2019-01-13Fix Omittables accidentally becoming non-omitted when compared with ↵Kitsune Ral
non-Omittable values
2019-01-13util.h: check for fallthrough attribute instead of C++ versionKitsune Ral
2018-12-08Omittable<>::merge<>Kitsune Ral
2018-12-08function_traits: more tests, fix function objects/lambdas not working with ↵Kitsune Ral
some compilers A member function reference is not the same as a member function pointer.
2018-12-08Omittable: better editability; drop implicit cast to boolKitsune Ral
2018-12-08Omittable: make operator-> and operator* return an empty object if omitted ↵Kitsune Ral
== true That is, instead of Q_ASSERTing in debug builds (release builds already work that way). The idea is that since the value is default-initialised anyway it can be used as a "blank canvas" to access specific fields inside the value's structure. The next commit will use that.
2018-12-08Special-case FALLTHROUGH for ClangKitsune Ral
2018-12-08function_traits<>: support any arity; add compile-time testsKitsune Ral
2018-11-22Generalise and expose cacheLocation()Kitsune Ral
2018-09-09util.h: move qAsConst out of QMatrixClientKitsune Ral
It's borrowed from Qt; namespacing basically forced client writers to put "using namespace QMatrixClient" before using qAsConst.
2018-08-13ConnectionsGuard: Fix clazy warningKitsune Ral
2018-07-27util.h: findFirstOfKitsune Ral
A spin on the standard algorithm.
2018-07-27Fix compilation with ClangKitsune Ral
2018-07-27Omittable<>: use std::decay<>, add assertionKitsune Ral
...against unwrapping omitted values (the release build will return a default-constructed value).
2018-07-08Revert perfect forwarding support in OmittableKitsune Ral
Turned out to work in unexpected ways when an Omittable<> gets copied.
2018-07-08Omittable: support perfect forwardingKitsune Ral
2018-07-08Move Omittable<> to util.hKitsune Ral
2018-07-07util.h: DISABLE_MOVE macroKitsune Ral
2018-07-04Event types system remade to be extensibleKitsune Ral
There were two common points that had to be updated every time a new event is introduced: the EventType enumeration and one of 3 doMakeEvent<> specialisations. The new code has a template class, EventFactory<>, that uses a list of static factory methods to create events instead of typelists used in doMakeEvent<>(); the EventType enumeration is replaced with a namespace populated with constants as necessary. In general, EventType is considered a deprecated mechanism altogether; instead, a set of facilities is provided: is<>() to check if an event has a certain type (to replace comparison against an EventType value) and visit<>() to execute actions based on the event type (replacing switch statements over EventType values). Closes #129.
2018-07-03Roll various switch case fallthrough markers into a macroKitsune Ral
2018-07-03Provide #include back-compatibility for REGISTER_ENUMKitsune Ral
2018-07-01More cleanup and minor tweaksKitsune Ral
2018-05-28Move out prettyPrint() from Room to util.hKitsune Ral
So that it could be used outside of room context.