From 9ab6f6d363f873f0799982c3c0872d38a656ee84 Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Thu, 18 Oct 2018 14:40:32 +0200 Subject: urlfilter: add Domain class (#6): Add domain matcher class --- lib/urlfilter/domain.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 lib/urlfilter/domain.h (limited to 'lib/urlfilter/domain.h') diff --git a/lib/urlfilter/domain.h b/lib/urlfilter/domain.h new file mode 100644 index 0000000..356762d --- /dev/null +++ b/lib/urlfilter/domain.h @@ -0,0 +1,33 @@ +/* + * This file is part of smolbote. It's copyrighted by the contributors recorded + * in the version control history of the file, available from its original + * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote + * + * SPDX-License-Identifier: GPL-3.0 + */ + +#ifndef SMOLBOTE_DOMAIN_H +#define SMOLBOTE_DOMAIN_H + +#include +#include + +class Domain +{ +public: + explicit Domain(const QString &domain); + explicit Domain(Domain &&other); + Domain& operator=(Domain &&other); + + // match domain and subdomains of domain + bool matches(const QUrl &url) const; + // exact match of domain + bool matchesExactly(uint hash) const; + QString host() const; + +private: + QString m_domain; + uint m_hash; +}; + +#endif // SMOLBOTE_DOMAIN_H -- cgit v1.2.1