Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible to easily output data types using QDebug #49

Merged
merged 1 commit into from Jun 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -21,6 +21,7 @@
#include "image.h"
#include <QSharedData>
#include <QUrl>
#include <QDebug>

using namespace Appstream;

@@ -120,7 +121,10 @@ int Image::width() const {
return d->m_width;
}


QDebug operator<<(QDebug s, const Appstream::Image& image) {
s.nospace() << "Appstream::Image(" << image.url() << ',' << image.kind() << "[" << image.width() << "x" << image.height() << "])";
return s.space();
}



@@ -86,6 +86,6 @@ class APPSTREAMQT_EXPORT Image {
};
}

#endif // APPSTREAMQT_IMAGE_H
APPSTREAMQT_EXPORT QDebug operator<<(QDebug s, const Appstream::Image& image);

class QUrl;
#endif // APPSTREAMQT_IMAGE_H
@@ -21,6 +21,7 @@
#include "provides.h"
#include <QSharedData>
#include <QString>
#include <QDebug>
#include <QHash>

using namespace Appstream;
@@ -153,7 +154,10 @@ Provides::~Provides() {

}


QDebug operator<<(QDebug s, const Appstream::Provides& provides) {
s.nospace() << "Appstream::Provides(" << provides.kind() << ',' << provides.value() << "])";
return s.space();
}



@@ -72,4 +72,6 @@ class APPSTREAMQT_EXPORT Provides {
};
}

APPSTREAMQT_EXPORT QDebug operator<<(QDebug s, const Appstream::Provides& provides);

#endif // APPSTREAMQT_PROVIDES_H
@@ -21,10 +21,19 @@
#include "screenshot.h"
#include <QSharedData>
#include <QString>
#include <QDebug>
#include "image.h"

using namespace Appstream;

QDebug operator<<(QDebug s, const Appstream::Screenshot& screenshot) {
s.nospace() << "Appstream::Screenshot(";
if (!screenshot.caption().isEmpty())
s.nospace() << screenshot.caption() << ":";
s.nospace() << screenshot.images() << ')';
return s.space();
}

class Appstream::ScreenshotData : public QSharedData {
public:
ScreenshotData() : m_default(false) {
@@ -71,4 +71,6 @@ class APPSTREAMQT_EXPORT Screenshot {
};
}

APPSTREAMQT_EXPORT QDebug operator<<(QDebug s, const Appstream::Screenshot& screenshot);

#endif // APPSTREAMQT_SCREENSHOT_H