aboutsummaryrefslogtreecommitdiff
path: root/lib/util.h
AgeCommit message (Collapse)Author
2019-03-17RoomMemberEvent: 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-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.
2018-05-03GetRoomEventsJob (replaces RoomMessagesJob) + refactoringKitsune Ral
1. Updates in this commit (see further) allow to generate and build GetRoomEventsJob from message_pagination.yaml; this job completely preempts RoomMessagesJob. 2. EventsBatch<> is no more a thing; there's EventsArray<> to replace it but it's loaded from a JSON array rather than an event batch (a JSON array inside another JSON object). SyncJob that used it extensively has been moved to "conventional" containers (Events, RoomEvents and the newly introduced StateEvents). RoomMessagesJob that also used EventsBatch<> is decommissioned (see above). 3. RoomEventsRange is now an alias for Range<RoomEvents>, defined in util.h (otherwise almost the same). 4. Connection::getMessages() is no more. Use Room::getPreviousContent() and Connection::callApi<GetRooMEventsJob>() instead. 5. Moving things around in Room, since SyncJob now supplies state events in more specific StateEvents, rather than RoomEvents.
2018-05-01ConnectionsGuard: one more fix about defaultsKitsune Ral
2018-04-30ConnectionsGuard: suppress the copying assignment operatorKitsune Ral
It accidentally leaked through using QPointer::operator=
2018-04-16ConnectionsGuard<> template to automatically disconnect subscribersKitsune Ral
Case in point is a room list model (so far in Quaternion, but planned for inclusion to the lib) that stores lists of connections and rooms; upon dropping, e.g., a room from the list the model should disconnect from the room's signals.
2018-04-02lookup()/dispatch() removed; unique_ptr_cast() and qAsConst() introducedKitsune Ral
qAsConst() is a copy-paste from Qt code and is only supplied by QMatrixClient if Qt is below 5.7. unique_ptr_cast<> is similar to static_cast<> of pointers but deals with unique_ptr's, passing ownership to the newly made pointer.
2018-03-31Move source files to a separate folderKitsune Ral
It's been long overdue to separate them from the rest of the stuff (docs etc.). Also, this allows installing to a directory within the checked out git tree (say, ./install/, similar to ./build/).