Getting article by url.

This commit is contained in:
vng 2013-08-08 18:33:03 +03:00
parent c99879cbce
commit bde1d74272
2 changed files with 13 additions and 1 deletions

View file

@ -94,13 +94,21 @@ string Storage::FormatParentName(ArticleInfo const & info) const
{
p = &m_info[p->m_parentIndex];
if (!res.empty())
res += " --> ";
res += " > ";
res += p->m_title;
}
return res;
}
ArticleInfo const * Storage::GetTitleFromUrl(string const & url) const
{
for (size_t i = 0; i < m_info.size(); ++i)
if (!m_info[i].m_redirect && m_info[i].m_url == url)
return &m_info[i];
return 0;
}
bool Storage::LessScore::operator() (size_t i1, size_t i2) const
{
double const s1 = Get(i1).Score(m_lat, m_lon);

View file

@ -36,7 +36,11 @@ public:
return m_info[m_lastQuery[i]];
}
/// Format parent's name like: father > grand father > ...
string FormatParentName(ArticleInfo const & info) const;
/// Find article by url.
ArticleInfo const * GetTitleFromUrl(string const & url) const;
//@}
protected: