1 /* 2 * %kadu copyright begin% 3 * Copyright 2016 Rafał Przemysław Malinowski (rafal.przemyslaw.malinowski@gmail.com) 4 * %kadu copyright end% 5 * 6 * This program is free software; you can redistribute it and/or 7 * modify it under the terms of the GNU General Public License as 8 * published by the Free Software Foundation; either version 2 of 9 * the License, or (at your option) any later version. 10 * 11 * This program is distributed in the hope that it will be useful, 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program. If not, see <http://www.gnu.org/licenses/>. 18 */ 19 20 #pragma once 21 22 #include "exports.h" 23 24 #include <QtCore/QString> 25 26 class HtmlString; 27 28 class KADUAPI NormalizedHtmlString 29 { 30 public: 31 NormalizedHtmlString() = default; 32 33 const QString & string() const; 34 35 template<typename ... T> arg(const T &...args)36 NormalizedHtmlString arg(const T & ... args) 37 { 38 return NormalizedHtmlString{m_string.arg(args.string()...)}; 39 } 40 41 friend bool operator == (const NormalizedHtmlString &x, const NormalizedHtmlString &y) 42 { 43 return x.m_string == y.m_string; 44 } 45 46 friend bool operator != (const NormalizedHtmlString &x, const NormalizedHtmlString &y) 47 { 48 return !(x == y); 49 } 50 51 friend bool operator < (const NormalizedHtmlString &x, const NormalizedHtmlString &y) 52 { 53 return x.m_string < y.m_string; 54 } 55 56 private: 57 friend NormalizedHtmlString normalizeHtml(const HtmlString &html); 58 59 explicit NormalizedHtmlString(QString string); 60 QString m_string; 61 62 }; 63