Added documentation.

This commit is contained in:
tastytea 2019-04-20 05:39:52 +02:00
parent 2462eefbbe
commit 6145082354
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 19 additions and 15 deletions

View File

@ -43,12 +43,16 @@ void write_line(const uint8_t spaces, const string &tag, const string &value);
//! Write releases.
uint8_t releases(const string &url);
//! @brief Get the base URL, without trailing slash.
const string get_baseurl(const string &url);
const string get_project(const string &url);
const string get_repo(const string &url);
//! Get the domain name.
const string get_domain(const string &url);
//! Get the full name of the repo (user/project).
const string get_repo(const string &url);
//! Get the project name.
const string get_project(const string &url);
#endif // GITEA2RSS_HPP

View File

@ -16,16 +16,16 @@
#include "gitea2rss.hpp"
const string get_project(const string &url)
{
const string repo = get_repo(url);
return repo.substr(repo.find('/') + 1);
}
const string get_baseurl(const string &url)
{
const size_t pos = url.find('/', 8) + 1;
return url.substr(0, pos - 1);
const size_t pos = url.find('/', 8);
return url.substr(0, pos);
}
const string get_domain(const string &url)
{
const string baseurl = get_baseurl(url);
return baseurl.substr(baseurl.rfind('/') + 1);
}
const string get_repo(const string &url)
@ -34,8 +34,8 @@ const string get_repo(const string &url)
return url.substr(pos);
}
const string get_domain(const string &url)
const string get_project(const string &url)
{
const string baseurl = get_baseurl(url);
return baseurl.substr(baseurl.rfind('/') + 1);
const string repo = get_repo(url);
return repo.substr(repo.find('/') + 1);
}