From aacc4bcb4a487871daae6717f77605aaba444341 Mon Sep 17 00:00:00 2001 From: Marc Deop Date: Sat, 2 Mar 2019 12:26:57 +0100 Subject: style: apply .clang-format to all .cpp and .h files --- lib/csapi/search.h | 329 ++++++++++++++++++++++++++--------------------------- 1 file changed, 160 insertions(+), 169 deletions(-) (limited to 'lib/csapi/search.h') diff --git a/lib/csapi/search.h b/lib/csapi/search.h index 86a0ee92..41761030 100644 --- a/lib/csapi/search.h +++ b/lib/csapi/search.h @@ -6,15 +6,14 @@ #include "jobs/basejob.h" -#include "csapi/definitions/room_event_filter.h" #include "converters.h" -#include +#include "csapi/definitions/room_event_filter.h" #include "events/eventloader.h" -#include #include +#include +#include -namespace QMatrixClient -{ +namespace QMatrixClient { // Operations /// Perform a server-side search. @@ -23,183 +22,175 @@ namespace QMatrixClient class SearchJob : public BaseJob { public: - // Inner data structures - + // Inner data structures + + /// Configures whether any context for the events + /// returned are included in the response. + struct IncludeEventContext { + /// How many events before the result are + /// returned. By default, this is ``5``. + Omittable beforeLimit; + /// How many events after the result are + /// returned. By default, this is ``5``. + Omittable afterLimit; + /// Requests that the server returns the + /// historic profile information for the users + /// that sent the events that were returned. + /// By default, this is ``false``. + Omittable includeProfile; + }; + + /// Configuration for group. + struct Group { + /// Key that defines the group. + QString key; + }; + + /// Requests that the server partitions the result set + /// based on the provided list of keys. + struct Groupings { + /// List of groups to request. + QVector groupBy; + }; + + /// Mapping of category name to search criteria. + struct RoomEventsCriteria { + /// The string to search events for + QString searchTerm; + /// The keys to search. Defaults to all. + QStringList keys; + /// This takes a `filter`_. + Omittable filter; + /// The order in which to search for results. + /// By default, this is ``"rank"``. + QString orderBy; /// Configures whether any context for the events /// returned are included in the response. - struct IncludeEventContext - { - /// How many events before the result are - /// returned. By default, this is ``5``. - Omittable beforeLimit; - /// How many events after the result are - /// returned. By default, this is ``5``. - Omittable afterLimit; - /// Requests that the server returns the - /// historic profile information for the users - /// that sent the events that were returned. - /// By default, this is ``false``. - Omittable includeProfile; - }; - - /// Configuration for group. - struct Group - { - /// Key that defines the group. - QString key; - }; - + Omittable eventContext; + /// Requests the server return the current state for + /// each room returned. + Omittable includeState; /// Requests that the server partitions the result set /// based on the provided list of keys. - struct Groupings - { - /// List of groups to request. - QVector groupBy; - }; + Omittable groupings; + }; + /// Describes which categories to search in and their criteria. + struct Categories { /// Mapping of category name to search criteria. - struct RoomEventsCriteria - { - /// The string to search events for - QString searchTerm; - /// The keys to search. Defaults to all. - QStringList keys; - /// This takes a `filter`_. - Omittable filter; - /// The order in which to search for results. - /// By default, this is ``"rank"``. - QString orderBy; - /// Configures whether any context for the events - /// returned are included in the response. - Omittable eventContext; - /// Requests the server return the current state for - /// each room returned. - Omittable includeState; - /// Requests that the server partitions the result set - /// based on the provided list of keys. - Omittable groupings; - }; - - /// Describes which categories to search in and their criteria. - struct Categories - { - /// Mapping of category name to search criteria. - Omittable roomEvents; - }; + Omittable roomEvents; + }; + /// Performs a full text search across different categories. + struct UserProfile { /// Performs a full text search across different categories. - struct UserProfile - { - /// Performs a full text search across different categories. - QString displayname; - /// Performs a full text search across different categories. - QString avatarUrl; - }; - + QString displayname; + /// Performs a full text search across different categories. + QString avatarUrl; + }; + + /// Context for result, if requested. + struct EventContext { + /// Pagination token for the start of the chunk + QString begin; + /// Pagination token for the end of the chunk + QString end; + /// The historic profile information of the + /// users that sent the events returned. + /// + /// The ``string`` key is the user ID for which + /// the profile belongs to. + QHash profileInfo; + /// Events just before the result. + RoomEvents eventsBefore; + /// Events just after the result. + RoomEvents eventsAfter; + }; + + /// The result object. + struct Result { + /// A number that describes how closely this result matches the + /// search. Higher is closer. + Omittable rank; + /// The event that matched. + RoomEventPtr result; /// Context for result, if requested. - struct EventContext - { - /// Pagination token for the start of the chunk - QString begin; - /// Pagination token for the end of the chunk - QString end; - /// The historic profile information of the - /// users that sent the events returned. - /// - /// The ``string`` key is the user ID for which - /// the profile belongs to. - QHash profileInfo; - /// Events just before the result. - RoomEvents eventsBefore; - /// Events just after the result. - RoomEvents eventsAfter; - }; - - /// The result object. - struct Result - { - /// A number that describes how closely this result matches the search. Higher is closer. - Omittable rank; - /// The event that matched. - RoomEventPtr result; - /// Context for result, if requested. - Omittable context; - }; - - /// The results for a particular group value. - struct GroupValue - { - /// Token that can be used to get the next batch - /// of results in the group, by passing as the - /// `next_batch` parameter to the next call. If - /// this field is absent, there are no more - /// results in this group. - QString nextBatch; - /// Key that can be used to order different - /// groups. - Omittable order; - /// Which results are in this group. - QStringList results; - }; - + Omittable context; + }; + + /// The results for a particular group value. + struct GroupValue { + /// Token that can be used to get the next batch + /// of results in the group, by passing as the + /// `next_batch` parameter to the next call. If + /// this field is absent, there are no more + /// results in this group. + QString nextBatch; + /// Key that can be used to order different + /// groups. + Omittable order; + /// Which results are in this group. + QStringList results; + }; + + /// Mapping of category name to search criteria. + struct ResultRoomEvents { + /// An approximate count of the total number of results found. + Omittable count; + /// List of words which should be highlighted, useful for stemming + /// which may change the query terms. + QStringList highlights; + /// List of results in the requested order. + std::vector results; + /// The current state for every room in the results. + /// This is included if the request had the + /// ``include_state`` key set with a value of ``true``. + /// + /// The ``string`` key is the room ID for which the ``State + /// Event`` array belongs to. + std::unordered_map state; + /// Any groups that were requested. + /// + /// The outer ``string`` key is the group key requested (eg: + /// ``room_id`` or ``sender``). The inner ``string`` key is the + /// grouped value (eg: a room's ID or a user's ID). + QHash> groups; + /// Token that can be used to get the next batch of + /// results, by passing as the `next_batch` parameter to + /// the next call. If this field is absent, there are no + /// more results. + QString nextBatch; + }; + + /// Describes which categories to search in and their criteria. + struct ResultCategories { /// Mapping of category name to search criteria. - struct ResultRoomEvents - { - /// An approximate count of the total number of results found. - Omittable count; - /// List of words which should be highlighted, useful for stemming which may change the query terms. - QStringList highlights; - /// List of results in the requested order. - std::vector results; - /// The current state for every room in the results. - /// This is included if the request had the - /// ``include_state`` key set with a value of ``true``. - /// - /// The ``string`` key is the room ID for which the ``State - /// Event`` array belongs to. - std::unordered_map state; - /// Any groups that were requested. - /// - /// The outer ``string`` key is the group key requested (eg: ``room_id`` - /// or ``sender``). The inner ``string`` key is the grouped value (eg: - /// a room's ID or a user's ID). - QHash> groups; - /// Token that can be used to get the next batch of - /// results, by passing as the `next_batch` parameter to - /// the next call. If this field is absent, there are no - /// more results. - QString nextBatch; - }; - - /// Describes which categories to search in and their criteria. - struct ResultCategories - { - /// Mapping of category name to search criteria. - Omittable roomEvents; - }; - - // Construction/destruction - - /*! Perform a server-side search. - * \param searchCategories - * Describes which categories to search in and their criteria. - * \param nextBatch - * The point to return events from. If given, this should be a - * ``next_batch`` result from a previous call to this endpoint. - */ - explicit SearchJob(const Categories& searchCategories, const QString& nextBatch = {}); - ~SearchJob() override; - - // Result properties - - /// Describes which categories to search in and their criteria. - const ResultCategories& searchCategories() const; + Omittable roomEvents; + }; + + // Construction/destruction + + /*! Perform a server-side search. + * \param searchCategories + * Describes which categories to search in and their criteria. + * \param nextBatch + * The point to return events from. If given, this should be a + * ``next_batch`` result from a previous call to this endpoint. + */ + explicit SearchJob(const Categories& searchCategories, + const QString& nextBatch = {}); + ~SearchJob() override; + + // Result properties + + /// Describes which categories to search in and their criteria. + const ResultCategories& searchCategories() const; protected: - Status parseJson(const QJsonDocument& data) override; + Status parseJson(const QJsonDocument& data) override; private: - class Private; - QScopedPointer d; + class Private; + QScopedPointer d; }; } // namespace QMatrixClient -- cgit v1.2.3 From 27ca32a1e5a56e09b9cc1d94224d2831004dcf3d Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 7 Jul 2019 19:32:34 +0900 Subject: Namespace: QMatrixClient -> Quotient (with back comp alias) --- lib/csapi/search.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/csapi/search.h') diff --git a/lib/csapi/search.h b/lib/csapi/search.h index f965a72a..079ac8e9 100644 --- a/lib/csapi/search.h +++ b/lib/csapi/search.h @@ -16,7 +16,7 @@ #include -namespace QMatrixClient +namespace Quotient { // Operations @@ -200,4 +200,4 @@ private: QScopedPointer d; }; -} // namespace QMatrixClient +} // namespace Quotient -- cgit v1.2.3 From 60bb1cf942ad0815dcf42cbfe8acd1e076d848cf Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Tue, 29 Oct 2019 22:04:40 +0900 Subject: Derive Omittable<> from std::optional<> 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. --- lib/csapi/search.h | 203 ----------------------------------------------------- 1 file changed, 203 deletions(-) delete mode 100644 lib/csapi/search.h (limited to 'lib/csapi/search.h') diff --git a/lib/csapi/search.h b/lib/csapi/search.h deleted file mode 100644 index 079ac8e9..00000000 --- a/lib/csapi/search.h +++ /dev/null @@ -1,203 +0,0 @@ -/****************************************************************************** - * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN - */ - -#pragma once - -#include "converters.h" - -#include "csapi/definitions/room_event_filter.h" - -#include "events/eventloader.h" -#include "jobs/basejob.h" - -#include -#include - -#include - -namespace Quotient -{ - -// Operations - -/// Perform a server-side search. -/*! - * Performs a full text search across different categories. - */ -class SearchJob : public BaseJob -{ -public: - // Inner data structures - - /// Configures whether any context for the eventsreturned are included in - /// the response. - struct IncludeEventContext - { - /// How many events before the result arereturned. By default, this is - /// ``5``. - Omittable beforeLimit; - /// How many events after the result arereturned. By default, this is - /// ``5``. - Omittable afterLimit; - /// Requests that the server returns thehistoric profile information for - /// the usersthat sent the events that were returned.By default, this is - /// ``false``. - Omittable includeProfile; - }; - - /// Configuration for group. - struct Group - { - /// Key that defines the group. - QString key; - }; - - /// Requests that the server partitions the result setbased on the provided - /// list of keys. - struct Groupings - { - /// List of groups to request. - QVector groupBy; - }; - - /// Mapping of category name to search criteria. - struct RoomEventsCriteria - { - /// The string to search events for - QString searchTerm; - /// The keys to search. Defaults to all. - QStringList keys; - /// This takes a `filter`_. - Omittable filter; - /// The order in which to search for results.By default, this is - /// ``"rank"``. - QString orderBy; - /// Configures whether any context for the eventsreturned are included - /// in the response. - Omittable eventContext; - /// Requests the server return the current state foreach room returned. - Omittable includeState; - /// Requests that the server partitions the result setbased on the - /// provided list of keys. - Omittable groupings; - }; - - /// Describes which categories to search in and their criteria. - struct Categories - { - /// Mapping of category name to search criteria. - Omittable roomEvents; - }; - - /// Performs a full text search across different categories. - struct UserProfile - { - /// Performs a full text search across different categories. - QString displayname; - /// Performs a full text search across different categories. - QString avatarUrl; - }; - - /// Context for result, if requested. - struct EventContext - { - /// Pagination token for the start of the chunk - QString begin; - /// Pagination token for the end of the chunk - QString end; - /// The historic profile information of theusers that sent the events - /// returned.The ``string`` key is the user ID for whichthe profile - /// belongs to. - QHash profileInfo; - /// Events just before the result. - RoomEvents eventsBefore; - /// Events just after the result. - RoomEvents eventsAfter; - }; - - /// The result object. - struct Result - { - /// A number that describes how closely this result matches the search. - /// Higher is closer. - Omittable rank; - /// The event that matched. - RoomEventPtr result; - /// Context for result, if requested. - Omittable context; - }; - - /// The results for a particular group value. - struct GroupValue - { - /// Token that can be used to get the next batchof results in the group, - /// by passing as the`next_batch` parameter to the next call. Ifthis - /// field is absent, there are no moreresults in this group. - QString nextBatch; - /// Key that can be used to order differentgroups. - Omittable order; - /// Which results are in this group. - QStringList results; - }; - - /// Mapping of category name to search criteria. - struct ResultRoomEvents - { - /// An approximate count of the total number of results found. - Omittable count; - /// List of words which should be highlighted, useful for stemming which - /// may change the query terms. - QStringList highlights; - /// List of results in the requested order. - std::vector results; - /// The current state for every room in the results.This is included if - /// the request had the``include_state`` key set with a value of - /// ``true``.The ``string`` key is the room ID for which the - /// ``StateEvent`` array belongs to. - std::unordered_map state; - /// Any groups that were requested.The outer ``string`` key is the group - /// key requested (eg: ``room_id``or ``sender``). The inner ``string`` - /// key is the grouped value (eg: a room's ID or a user's ID). - QHash> groups; - /// Token that can be used to get the next batch ofresults, by passing - /// as the `next_batch` parameter tothe next call. If this field is - /// absent, there are nomore results. - QString nextBatch; - }; - - /// Describes which categories to search in and their criteria. - struct ResultCategories - { - /// Mapping of category name to search criteria. - Omittable roomEvents; - }; - - // Construction/destruction - - /*! Perform a server-side search. - * \param searchCategories - * Describes which categories to search in and their criteria. - * \param nextBatch - * The point to return events from. If given, this should be a - * ``next_batch`` result from a previous call to this endpoint. - */ - explicit SearchJob(const Categories& searchCategories, - const QString& nextBatch = {}); - - ~SearchJob() override; - - // Result properties - - /// Describes which categories to search in and their criteria. - const ResultCategories& searchCategories() const; - -protected: - Status parseJson(const QJsonDocument& data) override; - -private: - class Private; - QScopedPointer d; -}; - -} // namespace Quotient -- cgit v1.2.3