LCOV - code coverage report
Current view: top level - src/models - NewsItem.h (source / functions) Coverage Total Hit
Test: coverage.info.cleaned Lines: 100.0 % 12 12
Test Date: 2026-01-27 22:31:25 Functions: 100.0 % 13 13

            Line data    Source code
       1              : #ifndef NEWSITEM_H
       2              : #define NEWSITEM_H
       3              : 
       4              : #include <QString>
       5              : #include <QUrl>
       6              : #include <QDateTime>
       7              : #include <QVariant>
       8              : #include <QDebug>
       9              : 
      10              : #include "../FangObject.h"
      11              : #include "DBObject.h"
      12              : 
      13              : class FeedItem;
      14              : 
      15              : class NewsItem : public FangObject, DBObject
      16              : {
      17              :     Q_OBJECT
      18              :     
      19              : public:
      20              :     
      21              :     NewsItem(QObject *parent = nullptr);
      22              :     
      23              :     // This is the c'tor you'll want to use.
      24              :     explicit NewsItem(
      25              :             FeedItem* feed,
      26              :             qint64 id,
      27              :             qint64 feedId,
      28              :             const QString& title,
      29              :             const QString& author,
      30              :             const QString& summary,
      31              :             const QString& content,
      32              :             const QDateTime& timestamp,
      33              :             const QUrl& url,
      34              :             bool pinned);
      35              :     
      36          174 :     virtual ~NewsItem() {}
      37              :     
      38              :     // For sorting
      39              :     bool operator<(const NewsItem& rhs);
      40              :     static bool LessThan(const NewsItem* left, const NewsItem* right);
      41              :     
      42            3 :     inline FeedItem* getFeed() const { return feed; }
      43              :     
      44              :     // This returns the actual feed database ID
      45            3 :     inline qint64 getFeedId() const { return _feedId; }
      46              :     
      47            3 :     inline QString getTitle() const { return title; }
      48            3 :     inline QString getAuthor() const { return author; }
      49            3 :     inline QString getSummary() const { return summary; }
      50            3 :     inline QString getContent() const { return content; }
      51            3 :     inline QDateTime getTimestamp() const { return timestamp; }
      52            3 :     inline QUrl getURL() const { return url; }
      53           17 :     virtual inline qint64 getDbID() const { return _id; }
      54            5 :     inline bool getPinned() const { return pinned; }
      55            2 :     inline void setPinned(bool p) { pinned = p; }
      56              :    
      57              :   private:
      58              :     FeedItem* feed;
      59              :     qint64 _id;
      60              :     qint64 _feedId;
      61              :     QString title;
      62              :     QString author;
      63              :     QString summary;
      64              :     QString content;
      65              :     QDateTime timestamp;
      66              :     QUrl url;
      67              :     bool pinned;
      68              : };
      69              : 
      70              : #endif // NEWSITEM_H
        

Generated by: LCOV version 2.0-1