8 // forward_list has no size :(
12 * represents a Wikipedia (Mediawiki) article and its links
17 //! representation of links to other articles
18 typedef std::list
<Article
*> storage
;
19 //! representation of iterator over links
20 typedef storage::iterator ArticleLinkIterator
;
21 //! representation of const iterator over links
22 typedef storage::const_iterator ArticleLinkConstIterator
;
24 /*! Create a new article from a title
25 * \param articleTitle The title of the article
27 Article(std::string articleTitle
)
28 : title(articleTitle
), analyzed(false), marked(false) {}
30 /*! Get the title of the article
31 * \return title of the article
33 std::string
getTitle() const
38 /*! get the number of links the article has.
39 * This throws an exception if state has not been set to anaylzed.
40 * \return number of links the article has.
44 size_t getNumLinks() const;
46 /*! Add a link to another article.
47 * \param[in] article Pointer to the article this article links
49 * \returns Whether adding woth successful. Returns false if
50 * instance / pointer is already included.
52 * Automatically sets state to analyzed
56 bool addLink(Article
* article
);
58 /*! Set article to be analyzed.
59 * State is automatically set by #addLink, but if
60 * article has no outgoing links, this must be called,
61 * otherwise #getNumLinks will throw an exception
62 * \param analyzed whether article has been analyzed
65 void setAnalyzed(bool analyzed
);
67 //! Get state if article was analyzed (for out links)
68 bool isAnalyzed() const;
70 /*! Set article to be marked.
71 * Some kind of "marking" for output usage. May be start point,
72 * may be end point, may be point of special interest.
73 * \param marked whether article os marked
75 void setMarked(bool marked
);
77 /*! Get state whether article was marked.
78 * \returns Whether article is marked.
80 bool isMarked() const;
82 /*! Get const_iterator to first linked article */
83 ArticleLinkConstIterator
linkBegin() const;
85 /*! Get const_iterator to last linked article */
86 ArticleLinkConstIterator
linkEnd() const;