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

            Line data    Source code
       1              : #ifndef BATCHNEWSPARSER_H
       2              : #define BATCHNEWSPARSER_H
       3              : 
       4              : #include <QMap>
       5              : #include <QUrl>
       6              : 
       7              : #include "../FangObject.h"
       8              : #include "ParserInterface.h"
       9              : #include "RawFeed.h"
      10              : 
      11              : /*!
      12              :  * \brief The BatchNewsParser is a wrapper for NewsParser that handles multiple feeds.
      13              :  */
      14              : class BatchNewsParser : public FangObject
      15              : {
      16              :     Q_OBJECT
      17              : public:
      18              :     explicit BatchNewsParser(QObject *parent = nullptr);
      19              : 
      20              :     // Parses a list of feed URLs and emits ready() when all are complete.
      21              :     virtual void parse(const QList<QUrl> &urls);
      22              : 
      23              :     // Map of parse results
      24           10 :     virtual QMap<QUrl, ParserInterface::ParseResult> getResults() { return results; }
      25              : 
      26              :     // Get parsed feed for a specific URL (nullptr if parse failed)
      27              :     virtual RawFeed* getFeed(const QUrl& url);
      28              : 
      29              : signals:
      30              :     void ready();
      31              : 
      32              : protected:
      33              :     // Virtual method for creating parsers; can be overridden for unit tests.
      34              :     virtual ParserInterface* createParser();
      35              : 
      36              :     // Called whenever a parser is done.
      37              :     void onParserDone();
      38              : 
      39              :     // Parsers that are in flight.
      40              :     QMap<QUrl, ParserInterface*> parsers;
      41              : 
      42              :     // Results of parsing per-URL.
      43              :     QMap<QUrl, ParserInterface::ParseResult> results;
      44              : 
      45              :     // Parsed feeds per-URL (owned by this object).
      46              :     QMap<QUrl, RawFeed*> feeds;
      47              : };
      48              : 
      49              : #endif // BATCHNEWSPARSER_H
        

Generated by: LCOV version 2.0-1