Syndication::AbstractParser Class
class Syndication::AbstractParserInterface for all parsers. More...
Header: | #include <Syndication/AbstractParser> |
CMake: | find_package(KF6 REQUIRED COMPONENTS Syndication) target_link_libraries(mytarget PRIVATE KF6::Syndication) |
Inherited By: |
Public Functions
virtual bool | accept(const Syndication::DocumentSource &source) const = 0 |
virtual QString | format() const = 0 |
virtual Syndication::SpecificDocumentPtr | parse(const Syndication::DocumentSource &source) const = 0 |
Detailed Description
The parsers for the various formats must implement this interface and register themselves at the ParserRegistry.
Member Function Documentation
[pure virtual]
bool AbstractParser::accept(const Syndication::DocumentSource &source) const
Lets the parser check if it can parse the passed source.
Parser implementations should do a _quick_ check for the file format (i.e. check for feed format and version number in the root element) to find out if the source is in a supported format. They should _not_ completely parse the document to test for full compliance to the format specification.
source the document source to be checked
Returns whether source seems to be in a format supported by the parser
[pure virtual]
QString AbstractParser::format() const
Returns the name of the format supported by this parser.
Returns a string like "rss2", "atom" or "rdf"
[pure virtual]
Syndication::SpecificDocumentPtr AbstractParser::parse(const Syndication::DocumentSource &source) const
Lets the parser parse a document source.
The parser returns a valid document instance if successful, or an invalid one if not.
source The document source to be parsed
Returns a newly created document parsed from source
See also SpecificDocument::isValid().