<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>Syndication::ParserCollection< T > Class Template Reference</title> <style type="text/css"> .cp-doNotDisplay { display: none; } @media aural, braille, handheld, tty { .cp-doNotDisplay { display: inline; speak: normal; }} .cp-edit { text-align: right; } @media print, embossed { .cp-edit { display: none; }} </style> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <link rel="meta" href="http://www.kde.org/labels.rdf" type="application/rdf+xml" title="ICRA labels" /> <meta name="trademark" content="KDE e.V." /> <meta name="description" content="K Desktop Environment Homepage, KDE.org" /> <meta name="MSSmartTagsPreventParsing" content="true" /> <meta name="robots" content="all" /> <meta name="no-email-collection" content="http://www.unspam.com/noemailcollection" /> <script type="text/javascript" src="jquery.js"></script> <script type="text/javascript" src="dynsections.js"></script> <link rel="shortcut icon" href="../../favicon.ico" /><link rel="icon" href="../../favicon.ico" /> <link rel="stylesheet" media="screen" type="text/css" title="KDE Colors" href="../../kde.css" /> <link rel="stylesheet" media="print, embossed" type="text/css" href="../../print.css" /> <link rel="stylesheet" media="screen, aural, handheld, tty, braille" type="text/css" title="Flat" href="../../flat.css" /> <link rel="stylesheet" type="text/css" href="../../doxygen.css" /> <link rel="stylesheet" type="text/css" href="../../tabs.css" /> </head> <body> <ul class="cp-doNotDisplay"> <li><a href="#cp-content" accesskey="2">Skip to content</a></li> <li><a href="#cp-menu" accesskey="5">Skip to link menu</a></li> </ul> <div id="container"> <div id="header"> <div id="header_top"><div><div> <img alt ="" src="../../top-kde.jpg"/> </div></div></div> <div id="header_bottom"> <div id="location"> <ul> <li><a href="http://api.kde.org">KDE API Reference</a></li> <li><a href="../../index.html">kdepimlibs-4.10.5 API Reference</a></li> </ul> </div> <div id="menu"> <ul> <li><a href="http://www.kde.org/">KDE Home</a></li> <li><a href="http://kde.org/contact/">Contact Us</a></li> </ul> </div> </div> </div> <!-- End page header --> <div id="body_wrapper"> <div id="body"> <!-- begin main content --> <div id="right"> <div class="content"> <div id="main"> <div class="clearer"> </div> <h2><a name="content"></a>Syndication Library</h2> <!-- BC --> <div id="top"> <!-- Generated by Doxygen 1.8.3.1 --> <div id="nav-path" class="navpath"> <ul> <li class="navelem"><a class="el" href="namespaceSyndication.html">Syndication</a></li><li class="navelem"><a class="el" href="classSyndication_1_1ParserCollection.html">ParserCollection</a></li> </ul> </div> </div><!-- top --> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> | <a href="classSyndication_1_1ParserCollection-members.html">List of all members</a> </div> <div class="headertitle"> <div class="title">Syndication::ParserCollection< T > Class Template Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div> </div> </div><!--header--> <div class="contents"> <p><code>#include <<a class="el" href="parsercollection_8h_source.html">parsercollection.h</a>></code></p> <table class="memberdecls"> <tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr class="memitem:a1498602b04ddfe02ebd6adf04ff9039d"><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classSyndication_1_1ParserCollection.html#a1498602b04ddfe02ebd6adf04ff9039d">~ParserCollection</a> ()</td></tr> <tr class="separator:a1498602b04ddfe02ebd6adf04ff9039d"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a502192561d9a6dc6f1aaa9c19250c574"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classSyndication_1_1ParserCollection.html#a502192561d9a6dc6f1aaa9c19250c574">changeMapper</a> (const QString &format, <a class="el" href="classSyndication_1_1Mapper.html">Mapper</a>< T > *mapper)=0</td></tr> <tr class="separator:a502192561d9a6dc6f1aaa9c19250c574"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:a1c1febf72c8d6e1ad731455ed0278a27"><td class="memItemLeft" align="right" valign="top">virtual <a class="el" href="namespaceSyndication.html#aaf92d762df59845c8a311e4d08e2d4e4">ErrorCode</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classSyndication_1_1ParserCollection.html#a1c1febf72c8d6e1ad731455ed0278a27">lastError</a> () const =0</td></tr> <tr class="separator:a1c1febf72c8d6e1ad731455ed0278a27"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:ae71af2ec3e5322dba2b4cf90ce6e53f6"><td class="memItemLeft" align="right" valign="top">virtual boost::shared_ptr< T > </td><td class="memItemRight" valign="bottom"><a class="el" href="classSyndication_1_1ParserCollection.html#ae71af2ec3e5322dba2b4cf90ce6e53f6">parse</a> (const <a class="el" href="classSyndication_1_1DocumentSource.html">DocumentSource</a> &source, const QString &formatHint=QString())=0</td></tr> <tr class="separator:ae71af2ec3e5322dba2b4cf90ce6e53f6"><td class="memSeparator" colspan="2"> </td></tr> <tr class="memitem:aee788d5173629c4051774f7a5c3de558"><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classSyndication_1_1ParserCollection.html#aee788d5173629c4051774f7a5c3de558">registerParser</a> (<a class="el" href="classSyndication_1_1AbstractParser.html">AbstractParser</a> *parser, <a class="el" href="classSyndication_1_1Mapper.html">Mapper</a>< T > *mapper)=0</td></tr> <tr class="separator:aee788d5173629c4051774f7a5c3de558"><td class="memSeparator" colspan="2"> </td></tr> </table> <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2> <div class="textblock"><h3>template<class T><br/> class Syndication::ParserCollection< T ></h3> <p>A collection of format-specific parser implementations. </p> <p>To parse a feed source, pass it to the <a class="el" href="classSyndication_1_1ParserCollection.html#ae71af2ec3e5322dba2b4cf90ce6e53f6" title="tries to parse a given source with the parsers registered.">parse()</a> method of this class. In most cases, you should use the global singleton instance <a class="el" href="namespaceSyndication.html#af2e53b977bf4b6d9a28ee4cbffd482a9" title="The default ParserCollection instance parsing a DocumentSource into a Feed object.">Syndication::parserCollection()</a>. When loading the source from the web, use <a class="el" href="classSyndication_1_1Loader.html" title="This class is the preferred way of loading feed sources.">Loader</a> instead of using this class directly.</p> <p>Example code:</p> <div class="fragment"><div class="line">...</div> <div class="line">QFile someFile(somePath);</div> <div class="line">...</div> <div class="line">DocumentSource src(someFile.readAll());</div> <div class="line">someFile.close();</div> <div class="line"></div> <div class="line">FeedPtr feed = <a class="code" href="namespaceSyndication.html#af2e53b977bf4b6d9a28ee4cbffd482a9" title="The default ParserCollection instance parsing a DocumentSource into a Feed object.">parserCollection</a>()->parse(src);</div> <div class="line"></div> <div class="line"><span class="keywordflow">if</span> (feed)</div> <div class="line">{</div> <div class="line"> QString title = feed->title();</div> <div class="line"> QList<ItemPtr> items = feed->items();</div> <div class="line"> ...</div> <div class="line">}</div> </div><!-- fragment --><p>The template parameter T is the abstraction class parsed documents should be mapped to. If you want to use your own abstraction MyFeed, implement <a class="el" href="classSyndication_1_1ParserCollection.html" title="A collection of format-specific parser implementations.">ParserCollection</a><MyFeed> (Note that you have to provide mapper implementations for every feed format then).</p> <dl class="section author"><dt>Author</dt><dd>Frank Osterfeld </dd></dl> <p>Definition at line <a class="el" href="global_8h_source.html#l00036">36</a> of file <a class="el" href="global_8h_source.html">global.h</a>.</p> </div><h2 class="groupheader">Constructor & Destructor Documentation</h2> <a class="anchor" id="a1498602b04ddfe02ebd6adf04ff9039d"></a> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<class T > </div> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">virtual <a class="el" href="classSyndication_1_1ParserCollection.html">Syndication::ParserCollection</a>< T >::~<a class="el" href="classSyndication_1_1ParserCollection.html">ParserCollection</a> </td> <td>(</td> <td class="paramname"></td><td>)</td> <td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">virtual</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>destructor </p> <p>Definition at line <a class="el" href="parsercollection_8h_source.html#l00078">78</a> of file <a class="el" href="parsercollection_8h_source.html">parsercollection.h</a>.</p> </div> </div> <h2 class="groupheader">Member Function Documentation</h2> <a class="anchor" id="a502192561d9a6dc6f1aaa9c19250c574"></a> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<class T > </div> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">virtual void <a class="el" href="classSyndication_1_1ParserCollection.html">Syndication::ParserCollection</a>< T >::changeMapper </td> <td>(</td> <td class="paramtype">const QString & </td> <td class="paramname"><em>format</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classSyndication_1_1Mapper.html">Mapper</a>< T > * </td> <td class="paramname"><em>mapper</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">pure virtual</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Changes the specific format to abstraction mapping for a parser. </p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">format</td><td>the format string of the parser whose mapping should be changed. See <a class="el" href="classSyndication_1_1AbstractParser.html#a03caed9f6fcd8327a6fdf6880e106005" title="Returns the name of the format supported by this parser.">AbstractParser::format</a>. </td></tr> <tr><td class="paramname">mapper</td><td><a class="el" href="classSyndication_1_1Mapper.html" title="A mapper maps an SpecificDocument to something else.">Mapper</a> implementation doing the mapping from the format specific representation to abstraction of type T. </td></tr> </table> </dd> </dl> </div> </div> <a class="anchor" id="a1c1febf72c8d6e1ad731455ed0278a27"></a> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<class T > </div> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">virtual <a class="el" href="namespaceSyndication.html#aaf92d762df59845c8a311e4d08e2d4e4">ErrorCode</a> <a class="el" href="classSyndication_1_1ParserCollection.html">Syndication::ParserCollection</a>< T >::lastError </td> <td>(</td> <td class="paramname"></td><td>)</td> <td> const</td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">pure virtual</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>returns the error code of the last <a class="el" href="classSyndication_1_1ParserCollection.html#ae71af2ec3e5322dba2b4cf90ce6e53f6" title="tries to parse a given source with the parsers registered.">parse()</a> call. </p> <dl class="section return"><dt>Returns</dt><dd>the last error, or Success if <a class="el" href="classSyndication_1_1ParserCollection.html#ae71af2ec3e5322dba2b4cf90ce6e53f6" title="tries to parse a given source with the parsers registered.">parse()</a> was successful or not yet called at all. </dd></dl> </div> </div> <a class="anchor" id="ae71af2ec3e5322dba2b4cf90ce6e53f6"></a> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<class T > </div> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">virtual boost::shared_ptr<T> <a class="el" href="classSyndication_1_1ParserCollection.html">Syndication::ParserCollection</a>< T >::parse </td> <td>(</td> <td class="paramtype">const <a class="el" href="classSyndication_1_1DocumentSource.html">DocumentSource</a> & </td> <td class="paramname"><em>source</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const QString & </td> <td class="paramname"><em>formatHint</em> = <code>QString()</code> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">pure virtual</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>tries to parse a given source with the parsers registered. </p> <p>The source is passed to the first parser that accepts it.</p> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">source</td><td>The source to be parsed </td></tr> <tr><td class="paramname">formatHint</td><td>An optional hint which parser to test first. If there is a parser with the given hint as format string (e.g., "rss2", "atom", "rdf"...), it is asked first to accept the source. This can avoid unnecessary <a class="el" href="classSyndication_1_1AbstractParser.html#ab98c6173e681ba87eec0f84f6594c8a5" title="Lets the parser check if it can parse the passed source.">AbstractParser::accept()</a> checks and speed up parsing. See also <a class="el" href="classSyndication_1_1AbstractParser.html#a03caed9f6fcd8327a6fdf6880e106005" title="Returns the name of the format supported by this parser.">AbstractParser::format()</a>. </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>The feed document parsed from the source, or NULL if no parser accepted the source. </dd></dl> </div> </div> <a class="anchor" id="aee788d5173629c4051774f7a5c3de558"></a> <div class="memitem"> <div class="memproto"> <div class="memtemplate"> template<class T > </div> <table class="mlabels"> <tr> <td class="mlabels-left"> <table class="memname"> <tr> <td class="memname">virtual bool <a class="el" href="classSyndication_1_1ParserCollection.html">Syndication::ParserCollection</a>< T >::registerParser </td> <td>(</td> <td class="paramtype"><a class="el" href="classSyndication_1_1AbstractParser.html">AbstractParser</a> * </td> <td class="paramname"><em>parser</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classSyndication_1_1Mapper.html">Mapper</a>< T > * </td> <td class="paramname"><em>mapper</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </td> <td class="mlabels-right"> <span class="mlabels"><span class="mlabel">pure virtual</span></span> </td> </tr> </table> </div><div class="memdoc"> <p>Adds a parser and corresponding mapper to the collection. </p> <p><a class="el" href="classSyndication_1_1AbstractParser.html#a03caed9f6fcd8327a6fdf6880e106005" title="Returns the name of the format supported by this parser.">AbstractParser::format()</a> must be unique in the collection. If there is already a parser with the same format string, the parser isn't added.</p> <dl class="section note"><dt>Note</dt><dd>ownership for both <code>parser</code> and <code>mapper</code> is taken by the implementation, so don't delete them in your code!</dd></dl> <dl class="params"><dt>Parameters</dt><dd> <table class="params"> <tr><td class="paramname">parser</td><td>The parser to be registered </td></tr> <tr><td class="paramname">mapper</td><td>the mapper that should be used for building the abstraction </td></tr> </table> </dd> </dl> <dl class="section return"><dt>Returns</dt><dd>whether the parser was successfully registered or not. </dd></dl> </div> </div> <hr/>The documentation for this class was generated from the following files:<ul> <li><a class="el" href="global_8h_source.html">global.h</a></li> <li><a class="el" href="parsercollection_8h_source.html">parsercollection.h</a></li> </ul> </div><!-- contents --> <div class="copyrights"> This file is part of the KDE documentation.<br/> Documentation copyright © 1996-2013 The KDE developers.<br/> Generated on Fri Jul 12 2013 16:48:30 by <a href="http://www.doxygen.org/index.html">doxygen</a> 1.8.3.1 written by <a href="mailto:dimitri@stack.nl">Dimitri van Heesch</a>, © 1997-2006 <p> KDE's <a href="http://techbase.kde.org/Policies/Library_Documentation_Policy">Doxygen guidelines</a> are available online. </p> </div> </div> </div> </div> <div id="left"> <div class="menu_box"> <a name="cp-menu" /><div class="menutitle"><div> <h2 id="cp-menu-project">Syndication Library</h2> <a href="#cp-skip-project" class="cp-doNotDisplay">Skip menu "Syndication Library"</a> </div></div> <ul><li><a href="index.html">Main Page</a></li><li><a href="namespaces.html">Namespace List</a></li><li><a href="namespacemembers.html">Namespace Members</a></li><li><a href="classes.html">Alphabetical List</a></li><li><a href="annotated.html">Class List</a></li><li><a href="hierarchy.html">Class Hierarchy</a></li><li><a href="functions.html">Class Members</a></li><li><a href="files.html">File List</a></li><li><a href="pages.html">Related Pages</a></li></ul> <!-- <h2>Class Picker</h2> <div style="text-align: center;"> <form name="guideform"> <select name="guidelinks" style="width:100%;" onChange="window.location=document.guideform.guidelinks.options[document.guideform.guidelinks.selectedIndex].value"> <option value="annotated.html">-- Choose --</option> <option value="classSyndication_1_1AbstractParser.html">syndication::abstractparser</option>, <option value="classSyndication_1_1Category.html">syndication::category</option>, <option value="classSyndication_1_1DataRetriever.html">syndication::dataretriever</option>, <option value="classSyndication_1_1DocumentSource.html">syndication::documentsource</option>, <option value="classSyndication_1_1DocumentVisitor.html">syndication::documentvisitor</option>, <option value="classSyndication_1_1ElementWrapper.html">syndication::elementwrapper</option>, <option value="classSyndication_1_1Enclosure.html">syndication::enclosure</option>, <option value="classSyndication_1_1Feed.html">syndication::feed</option>, <option value="classSyndication_1_1FileRetriever.html">syndication::fileretriever</option>, <option value="classSyndication_1_1Image.html">syndication::image</option>, <option value="classSyndication_1_1Item.html">syndication::item</option>, <option value="classSyndication_1_1Loader.html">syndication::loader</option>, <option value="classSyndication_1_1Mapper.html">syndication::mapper</option>, <option value="classSyndication_1_1OutputRetriever.html">syndication::outputretriever</option>, <option value="classSyndication_1_1ParserCollection.html">syndication::parsercollection</option>, <option value="classSyndication_1_1Person.html">syndication::person</option>, <option value="classSyndication_1_1SpecificDocument.html">syndication::specificdocument</option>, <option value="classSyndication_1_1SpecificItem.html">syndication::specificitem</option>, <option value="classSyndication_1_1SpecificItemVisitor.html">syndication::specificitemvisitor</option>, </select> </form> </div> --> <div class="menu_box"> <a name="cp-menu" /><div class="menutitle"><div> <h2 id="cp-menu-project">kdepimlibs-4.10.5 API Reference</h2> <a href="#cp-skip-project" class="cp-doNotDisplay">Skip menu "kdepimlibs-4.10.5 API Reference"</a> </div></div> <div class="nav_list"> <ul> <li><a href="../../akonadi/html/index.html">akonadi</a></li><li> <a href="../../akonadi/contact/html/index.html">contact</a></li><li> <a href="../../akonadi/kmime/html/index.html">kmime</a></li><li> <a href="../../akonadi/socialutils/html/index.html">socialutils</a></li><li><a href="../../kabc/html/index.html">kabc</a></li><li><a href="../../kalarmcal/html/index.html">kalarmcal</a></li><li><a href="../../kblog/html/index.html">kblog</a></li><li><a href="../../kcal/html/index.html">kcal</a></li><li><a href="../../kcalcore/html/index.html">kcalcore</a></li><li><a href="../../kcalutils/html/index.html">kcalutils</a></li><li><a href="../../kholidays/html/index.html">kholidays</a></li><li><a href="../../kimap/html/index.html">kimap</a></li><li><a href="../../kioslave/html/index.html">kioslave</a></li><li> <a href="../../kioslave/imap4/html/index.html">imap4</a></li><li> <a href="../../kioslave/mbox/html/index.html">mbox</a></li><li> <a href="../../kioslave/nntp/html/index.html">nntp</a></li><li><a href="../../kldap/html/index.html">kldap</a></li><li><a href="../../kmbox/html/index.html">kmbox</a></li><li><a href="../../kmime/html/index.html">kmime</a></li><li><a href="../../kontactinterface/html/index.html">kontactinterface</a></li><li><a href="../../kpimidentities/html/index.html">kpimidentities</a></li><li><a href="../../kpimtextedit/html/index.html">kpimtextedit</a></li><li><a href="../../kpimutils/html/index.html">kpimutils</a></li><li><a href="../../kresources/html/index.html">kresources</a></li><li><a href="../../ktnef/html/index.html">ktnef</a></li><li><a href="../../kxmlrpcclient/html/index.html">kxmlrpcclient</a></li><li><a href="../../mailtransport/html/index.html">mailtransport</a></li><li><a href="../../microblog/html/index.html">microblog</a></li><li><a href="../../qgpgme/html/index.html">qgpgme</a></li><li><a href="../../syndication/html/index.html">syndication</a></li><li> <a href="../../syndication/atom/html/index.html">atom</a></li><li> <a href="../../syndication/rdf/html/index.html">rdf</a></li><li> <a href="../../syndication/rss2/html/index.html">rss2</a></li> </ul></div></div> <!-- api_searchbox --> </div> </div> <div class="clearer"></div> </div> <div class="clearer"></div> </div> <div id="end_body"></div> <div id="footer"><div id="footer_text"> Report problems with this website to <a href="https://bugs.kde.org/enter_sysadmin_request.cgi?component=api.kde.org">our bug tracking system</a>.<br> Contact the specific authors with questions and comments about the page contents.<p> KDE<sup>®</sup> and <a href="/media/images/kde_gear_black.png">the K Desktop Environment<sup>®</sup> logo</a> are registered trademarks of <a href="http://ev.kde.org/" title="Homepage of the KDE non-profit Organization">KDE e.V.</a> | <a href="http://www.kde.org/contact/impressum.php">Legal</a></p> </div></div> </div> <!-- WARNING: DO NOT SEND MAIL TO THE FOLLOWING EMAIL ADDRESS! YOU WILL BE BLOCKED INSTANTLY AND PERMANENTLY! <a href="mailto:aaaatrap-45abe0e0c3bebc77@kde.org">Block me</a> WARNING END --> </body> </html>