Welcome to mirror list, hosted at ThFree Co, Russian Federation.

HTMLFilter.h « src - github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b992370517679850b0098d011129457aa57c204a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2005-2020 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.

#ifndef MUMBLE_HTMLFILTER_H_
#define MUMBLE_HTMLFILTER_H_

#include <QString>

/// HTMLFilter provides utilitites for
/// creating a plain text representaton
/// of a HTML document.
///
/// It is used for converting Mumble
/// text messages, comments, and more
/// to plain text when a server is
/// configured to disallow HTML.
class HTMLFilter {
	/// escapeTags returns the in HTML document
	/// with all occurrences of > and <
	/// replaced by &lt; and &gt;.
	static QString escapeTags(const QString &in);

public:
	/// filter does a best-effort conversion of the
	/// in HTML document to a plain-text representation.
	///
	/// If the filtering process succeeded, the function
	/// writes the filtered document as plain text to
	/// out, and returns true.
	///
	/// If the filtering failed, the function returns false
	/// and out is left unchanged.
	static bool filter(const QString &in, QString &out);
};

#endif