Skip to content

Commit

Permalink
Reformat code with clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
lnjX committed Mar 14, 2024
1 parent 1de0740 commit 4dc4784
Show file tree
Hide file tree
Showing 42 changed files with 82 additions and 183 deletions.
3 changes: 1 addition & 2 deletions src/base/QXmppDataForm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@

using namespace QXmpp::Private;

struct field_type
{
struct field_type {
QXmppDataForm::Field::Type type;
const char *str;
};
Expand Down
3 changes: 1 addition & 2 deletions src/base/QXmppError.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ class QFileDevice;
class QIODevice;
class QNetworkReply;

struct QXMPP_EXPORT QXmppError
{
struct QXMPP_EXPORT QXmppError {
QString description;
std::any error;

Expand Down
6 changes: 2 additions & 4 deletions src/base/QXmppFutureUtils_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ namespace QXmpp::Private {

// helper for std::visit
template<class... Ts>
struct overloaded : Ts...
{
struct overloaded : Ts... {
using Ts::operator()...;
};
// explicit deduction guide (not needed as of C++20)
Expand Down Expand Up @@ -59,8 +58,7 @@ template<typename F, typename Ret, typename A, typename... Rest>
A lambda_helper(Ret (F::*)(A, Rest...) const);

template<typename F>
struct first_argument
{
struct first_argument {
using type = decltype(lambda_helper(&F::operator()));
};

Expand Down
8 changes: 2 additions & 6 deletions src/base/QXmppGlobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,18 +168,14 @@ enum Cipher {
///
/// \since QXmpp 1.5
///
struct Success
{
};
struct Success { };

///
/// Unit struct used to indicate that a process has been cancelled.
///
/// \since QXmpp 1.5
///
struct Cancelled
{
};
struct Cancelled { };

} // namespace QXmpp

Expand Down
6 changes: 2 additions & 4 deletions src/base/QXmppHashing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ HashingResult calculateHashesSync(std::unique_ptr<QIODevice> data, std::vector<Q
return { std::move(results), std::move(data) };
}

struct BufferReader : public QRunnable
{
struct BufferReader : public QRunnable {
BufferReader(HashGenerator &creator)
: generator(creator)
{
Expand All @@ -230,8 +229,7 @@ struct BufferReader : public QRunnable
HashGenerator &generator;
};

struct HashProcessor : public QRunnable
{
struct HashProcessor : public QRunnable {
HashProcessor(HashGenerator *generator, QCryptographicHash::Algorithm algorithm)
: generator(generator),
hash(std::make_unique<QCryptographicHash>(algorithm)),
Expand Down
18 changes: 5 additions & 13 deletions src/base/QXmppHashing_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ class QXmppHash;

namespace QXmpp::Private {

struct HashingResult
{
struct HashingResult {
using Result = std::variant<std::vector<QXmppHash>, Cancelled, QXmppError>;

HashingResult(Result result, std::unique_ptr<QIODevice> data)
Expand All @@ -34,17 +33,10 @@ struct HashingResult
std::unique_ptr<QIODevice> data;
};

struct HashVerificationResult
{
struct NoStrongHashes
{
};
struct NotMatching
{
};
struct Verified
{
};
struct HashVerificationResult {
struct NoStrongHashes { };
struct NotMatching { };
struct Verified { };
using Result = std::variant<NoStrongHashes, NotMatching, Verified, Cancelled, QXmppError>;

HashVerificationResult(Result result, std::unique_ptr<QIODevice> data)
Expand Down
29 changes: 7 additions & 22 deletions src/base/QXmppJingleData.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,20 +434,10 @@ class QXMPP_EXPORT QXmppJingleIq : public QXmppIq
Responder
};

struct RtpSessionStateActive
{
};

struct RtpSessionStateHold
{
};

struct RtpSessionStateUnhold
{
};

struct RtpSessionStateMuting
{
struct RtpSessionStateActive { };
struct RtpSessionStateHold { };
struct RtpSessionStateUnhold { };
struct RtpSessionStateMuting {
/// True when temporarily not sending media to the other party but continuing to accept
/// media from it, false for ending mute state
bool isMute = true;
Expand All @@ -456,10 +446,7 @@ class QXMPP_EXPORT QXmppJingleIq : public QXmppIq
/// Session to be muted (e.g., only audio or video)
QString name;
};

struct RtpSessionStateRinging
{
};
struct RtpSessionStateRinging { };

using RtpSessionState = std::variant<RtpSessionStateActive, RtpSessionStateHold, RtpSessionStateUnhold, RtpSessionStateMuting, RtpSessionStateRinging>;

Expand Down Expand Up @@ -670,8 +657,7 @@ class QXMPP_EXPORT QXmppCallInviteElement
Left
};

struct Jingle
{
struct Jingle {
QString sid;
std::optional<QString> jid;

Expand All @@ -681,8 +667,7 @@ class QXMPP_EXPORT QXmppCallInviteElement
void toXml(QXmlStreamWriter *writer) const;
};

struct External
{
struct External {
QString uri;

bool operator==(const External &other) const { return other.uri == uri; }
Expand Down
3 changes: 1 addition & 2 deletions src/base/QXmppPubSubIq_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
#define QXMPPPUBSUBIQ_H

#include "QXmppIq.h"
#include "QXmppPubSubBaseItem.h"

#include <optional>

#include <QDomElement>
#include <QSharedDataPointer>

#include "QXmppPubSubBaseItem.h"

class QXmppDataForm;
class QXmppPubSubSubscription;
class QXmppPubSubAffiliation;
Expand Down
3 changes: 1 addition & 2 deletions src/base/QXmppPubSubMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

// helper for std::visit
template<class... Ts>
struct overloaded : Ts...
{
struct overloaded : Ts... {
using Ts::operator()...;
};
// explicit deduction guide (not needed as of C++20)
Expand Down
8 changes: 2 additions & 6 deletions src/base/QXmppPubSubMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@ class QXmppPubSubMetadataPrivate;
class QXMPP_EXPORT QXmppPubSubMetadata : public QXmppExtensibleDataFormBase
{
public:
struct Unset
{
};
struct Max
{
};
struct Unset { };
struct Max { };
using ItemLimit = std::variant<Unset, quint64, Max>;

QXmppPubSubMetadata();
Expand Down
3 changes: 1 addition & 2 deletions src/base/QXmppPubSubNodeConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ static const auto PAYLOAD_TYPE = QStringLiteral("pubsub#type");

// helper for std::visit
template<class... Ts>
struct overloaded : Ts...
{
struct overloaded : Ts... {
using Ts::operator()...;
};
// explicit deduction guide (not needed as of C++20)
Expand Down
8 changes: 2 additions & 6 deletions src/base/QXmppPubSubNodeConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,8 @@ class QXmppPubSubNodeConfigPrivate;
class QXMPP_EXPORT QXmppPubSubNodeConfig : public QXmppExtensibleDataFormBase
{
public:
struct Unset
{
};
struct Max
{
};
struct Unset { };
struct Max { };
using ItemLimit = std::variant<Unset, uint64_t, Max>;

enum AccessModel : uint8_t {
Expand Down
3 changes: 1 addition & 2 deletions src/base/QXmppSendResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ enum class SendError : uint8_t {
///
/// \since QXmpp 1.5
///
struct SendSuccess
{
struct SendSuccess {
/// Indicates whether the packet has been acknowledged by the other peer.
bool acknowledged = false;
};
Expand Down
3 changes: 1 addition & 2 deletions src/base/QXmppStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@

using namespace QXmpp::Private;

struct IqState
{
struct IqState {
QXmppPromise<QXmppStream::IqResult> interface;
QString jid;
};
Expand Down
3 changes: 1 addition & 2 deletions src/base/QXmppStun.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1800,8 +1800,7 @@ QXmppIcePrivate::QXmppIcePrivate()
tieBreaker = QXmppUtils::generateRandomBytes(8);
}

struct QXmppIceTransportDetails
{
struct QXmppIceTransportDetails {
QXmppIceTransport *transport;
QHostAddress stunHost;
quint16 stunPort;
Expand Down
3 changes: 1 addition & 2 deletions src/base/QXmppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

namespace QXmpp::Private {

struct TaskData
{
struct TaskData {
QPointer<QObject> context;
std::function<void(TaskPrivate &, void *)> continuation;
void *result = nullptr;
Expand Down
10 changes: 3 additions & 7 deletions src/base/QXmppUtils_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,13 @@ bool isIqType(const QDomElement &, QStringView tagName, QStringView xmlns);
QDomElement firstChildElement(const QDomElement &, QStringView tagName = {}, QStringView xmlNs = {});
QDomElement nextSiblingElement(const QDomElement &, QStringView tagName = {}, QStringView xmlNs = {});

struct DomChildElements
{
struct DomChildElements {
QDomElement parent;
QStringView tagName;
QStringView namespaceUri;

struct EndIterator
{
};
struct Iterator
{
struct EndIterator { };
struct Iterator {
Iterator operator++()
{
el = nextSiblingElement(el, tagName, namespaceUri);
Expand Down
3 changes: 1 addition & 2 deletions src/client/QXmppAtmTrustMemoryStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ using namespace QXmpp::Private;
/// \since QXmpp 1.5
///

struct UnprocessedKey
{
struct UnprocessedKey {
QByteArray id;
QString ownerJid;
QByteArray senderKeyId;
Expand Down
3 changes: 1 addition & 2 deletions src/client/QXmppAttentionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@
/// rate limiter.
///

struct PastRequest
{
struct PastRequest {
QString bareJid;
QDateTime timestamp;
};
Expand Down
3 changes: 1 addition & 2 deletions src/client/QXmppBlockingManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ class UnblockIq : public QXmppIq
};

// Manager data
struct QXmppBlockingManagerPrivate
{
struct QXmppBlockingManagerPrivate {
std::optional<QVector<QString>> blocklist;
std::vector<QXmppPromise<QXmppBlockingManager::BlocklistResult>> openFetchBlocklistPromises;
};
Expand Down
14 changes: 5 additions & 9 deletions src/client/QXmppBlockingManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,21 @@
#include "QXmppError.h"
#include "QXmppTask.h"

#include <QVector>

#include <variant>

#include <QVector>

struct QXmppBlockingManagerPrivate;

class QXMPP_EXPORT QXmppBlocklist
{
public:
struct NotBlocked
{
};
struct Blocked
{
struct NotBlocked { };
struct Blocked {
QVector<QString> blockingEntries;
QVector<QString> partiallyBlockingEntries;
};
struct PartiallyBlocked
{
struct PartiallyBlocked {
QVector<QString> partiallyBlockingEntries;
};

Expand Down
12 changes: 3 additions & 9 deletions src/client/QXmppCallInviteManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,9 @@ class QXMPP_EXPORT QXmppCallInvite : public QObject
{
Q_OBJECT
public:
struct Rejected
{
};
struct Retracted
{
};
struct Left
{
};
struct Rejected { };
struct Retracted { };
struct Left { };

using Result = std::variant<Rejected, Retracted, Left, QXmppError>;

Expand Down
6 changes: 2 additions & 4 deletions src/client/QXmppCall_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class QXmppCallPrivate : public QObject
{
Q_OBJECT
public:
struct GstCodec
{
struct GstCodec {
int pt;
QString name;
int channels;
Expand All @@ -39,8 +38,7 @@ class QXmppCallPrivate : public QObject
QString gstDepay;
QString gstEnc;
QString gstDec;
struct Property
{
struct Property {
QString name;
int value;
};
Expand Down
Loading

0 comments on commit 4dc4784

Please sign in to comment.