8 * represents a Wikipedia (Mediawiki) article and its links
13 //! representation of links to other articles
14 typedef std::vector
<Article
*> ArticleLinkStorage
;
15 //! representation of iterator over links
16 typedef std::vector
<Article
*>::iterator ArticleLinkIterator
;
17 //! representation of const iterator over links
18 typedef std::vector
<Article
*>::const_iterator ArticleLinkConstIterator
;
20 /*! Create a new article from a title
21 * \param articleTitle The title of the article
23 Article(std::string articleTitle
)
24 : title(articleTitle
), analyzed(false) {}
26 //! Get the title of the article
27 std::string
getTitle() const {
31 //! get the number of links the article has
32 size_t getNumLinks() const;
34 /*! Add a link to another article.
35 * \param[in] article Pointer to the article this article links
37 * \returns Whether adding woth successful. Returns false if
38 * instance / pointer is already included.
40 bool addLink(Article
* article
);
42 /*! Set article to be analyzed.
43 * State is automatically set by #addLink, but if
44 * article has no outgoing links, this must be called,
45 * otherwise #getNumLinks will throw an exception
46 * \param analyzed whether article has been analyzed
48 void setAnalyzed(bool analyzed
);
50 //! Get state if article was analyzed (for out links)
51 bool isAnalyzed() const;
53 /*! Get const_iterator to first linked article */
54 ArticleLinkConstIterator
linkBegin() const;
56 /*! Get const_iterator to last linked article */
57 ArticleLinkConstIterator
linkEnd() const;
61 ArticleLinkStorage links
;