aboutsummaryrefslogtreecommitdiffstats
path: root/src/shared/cpaster/cgi.h
blob: 3e89abd72b5daa927317ab2231d2d4dc313ee965 (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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include <QString>

class CGI
{
public:
    static QString encodeURL(const QString &rawText);
    static QString decodeURL(const QString &urlText);

    enum HTMLconvertFlags {
        Normal,
        LineBreaks = 0x0001,
        Spaces     = 0x0002,
        Tabs       = 0x0004
    };

    static QString encodeHTML(const QString &rawText, int conversionFlags = 0);

private:
    inline short charToHex(const QChar &ch);
    inline QChar hexToChar(const QString &hx);
};