aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/users.cpp
diff options
context:
space:
mode:
authorMarc Deop <marc@marcdeop.com>2019-03-02 12:26:57 +0100
committerMarc Deop <marc@marcdeop.com>2019-03-02 12:26:57 +0100
commitaacc4bcb4a487871daae6717f77605aaba444341 (patch)
tree4f50b6874821667ccb6b91c017e5d041e3846112 /lib/csapi/users.cpp
parentc971b924cd62822ed6fb1a0291c483ae73a3ecda (diff)
downloadlibquotient-aacc4bcb4a487871daae6717f77605aaba444341.tar.gz
libquotient-aacc4bcb4a487871daae6717f77605aaba444341.zip
style: apply .clang-format to all .cpp and .h files
Diffstat (limited to 'lib/csapi/users.cpp')
-rw-r--r--lib/csapi/users.cpp36
1 files changed, 17 insertions, 19 deletions
diff --git a/lib/csapi/users.cpp b/lib/csapi/users.cpp
index 97d8962d..6d005915 100644
--- a/lib/csapi/users.cpp
+++ b/lib/csapi/users.cpp
@@ -12,13 +12,12 @@ using namespace QMatrixClient;
static const auto basePath = QStringLiteral("/_matrix/client/r0");
-namespace QMatrixClient
-{
+namespace QMatrixClient {
// Converters
- template <> struct JsonObjectConverter<SearchUserDirectoryJob::User>
- {
- static void fillFrom(const QJsonObject& jo, SearchUserDirectoryJob::User& result)
+ template <> struct JsonObjectConverter<SearchUserDirectoryJob::User> {
+ static void fillFrom(const QJsonObject& jo,
+ SearchUserDirectoryJob::User& result)
{
fromJson(jo.value("user_id"_ls), result.userId);
fromJson(jo.value("display_name"_ls), result.displayName);
@@ -30,16 +29,18 @@ namespace QMatrixClient
class SearchUserDirectoryJob::Private
{
public:
- QVector<User> results;
- bool limited;
+ QVector<User> results;
+ bool limited;
};
-static const auto SearchUserDirectoryJobName = QStringLiteral("SearchUserDirectoryJob");
+static const auto SearchUserDirectoryJobName =
+ QStringLiteral("SearchUserDirectoryJob");
-SearchUserDirectoryJob::SearchUserDirectoryJob(const QString& searchTerm, Omittable<int> limit)
+SearchUserDirectoryJob::SearchUserDirectoryJob(const QString& searchTerm,
+ Omittable<int> limit)
: BaseJob(HttpVerb::Post, SearchUserDirectoryJobName,
- basePath % "/user_directory/search")
- , d(new Private)
+ basePath % "/user_directory/search"),
+ d(new Private)
{
QJsonObject _data;
addParam<>(_data, QStringLiteral("search_term"), searchTerm);
@@ -49,27 +50,24 @@ SearchUserDirectoryJob::SearchUserDirectoryJob(const QString& searchTerm, Omitta
SearchUserDirectoryJob::~SearchUserDirectoryJob() = default;
-const QVector<SearchUserDirectoryJob::User>& SearchUserDirectoryJob::results() const
+const QVector<SearchUserDirectoryJob::User>&
+SearchUserDirectoryJob::results() const
{
return d->results;
}
-bool SearchUserDirectoryJob::limited() const
-{
- return d->limited;
-}
+bool SearchUserDirectoryJob::limited() const { return d->limited; }
BaseJob::Status SearchUserDirectoryJob::parseJson(const QJsonDocument& data)
{
auto json = data.object();
if (!json.contains("results"_ls))
return { JsonParseError,
- "The key 'results' not found in the response" };
+ "The key 'results' not found in the response" };
fromJson(json.value("results"_ls), d->results);
if (!json.contains("limited"_ls))
return { JsonParseError,
- "The key 'limited' not found in the response" };
+ "The key 'limited' not found in the response" };
fromJson(json.value("limited"_ls), d->limited);
return Success;
}
-