TreeFrogFramework  2.8
Static Public Member Functions | List of all members
THttpUtility Class Reference

#include <thttputility.h>

Static Public Member Functions

static QString fromUrlEncoding (const QByteArray &enc)
 
static QByteArray toUrlEncoding (const QString &input, const QByteArray &exclude="-._")
 
static QList< QPair< QString, QString > > fromFormUrlEncoded (const QByteArray &enc)
 
static QString htmlEscape (const QString &input, Tf::EscapeFlag flag=Tf::Quotes)
 
static QString htmlEscape (int n)
 
static QString htmlEscape (uint n)
 
static QString htmlEscape (long n)
 
static QString htmlEscape (ulong n)
 
static QString htmlEscape (qlonglong n)
 
static QString htmlEscape (qulonglong n)
 
static QString htmlEscape (double n)
 
static QString htmlEscape (const char *input, Tf::EscapeFlag flag=Tf::Quotes)
 
static QString htmlEscape (const QByteArray &input, Tf::EscapeFlag flag=Tf::Quotes)
 
static QString htmlEscape (const QVariant &input, Tf::EscapeFlag flag=Tf::Quotes)
 
static QString jsonEscape (const QString &input)
 
static QString jsonEscape (const char *input)
 
static QString jsonEscape (const QByteArray &input)
 
static QString jsonEscape (const QVariant &input)
 
static QByteArray toMimeEncoded (const QString &input, const QByteArray &encoding="UTF-8")
 
static QByteArray toMimeEncoded (const QString &input, QStringConverter::Encoding encoding)
 
static QString fromMimeEncoded (const QByteArray &mime)
 
static QByteArray getResponseReasonPhrase (int statusCode)
 
static QString trimmedQuotes (const QString &string)
 
static QByteArray timeZone ()
 
static QByteArray toHttpDateTimeString (const QDateTime &dateTime)
 
static QDateTime fromHttpDateTimeString (const QByteArray &localTime)
 
static QDateTime fromHttpDateTimeUTCString (const QByteArray &utc)
 
static QByteArray getUTCTimeString ()
 

Detailed Description

The THttpUtility class contains utility functions.

Member Function Documentation

◆ fromFormUrlEncoded()

QList< QPair< QString, QString > > THttpUtility::fromFormUrlEncoded ( const QByteArray &  enc)
static

◆ fromHttpDateTimeString()

QDateTime THttpUtility::fromHttpDateTimeString ( const QByteArray &  localTime)
static

Parses the HTTP datetime array given in localTime and returns the datetime.

◆ fromHttpDateTimeUTCString()

QDateTime THttpUtility::fromHttpDateTimeUTCString ( const QByteArray &  utc)
static

Returns a byte array for Date field of an HTTP header, containing the UTC datetime equivalent of utc.

Parses the UTC datetime array given in utc and returns the datetime.

◆ fromMimeEncoded()

QString THttpUtility::fromMimeEncoded ( const QByteArray &  mime)
static

Returns a byte array copy of input, encoded as MIME-Base64.

See also
fromMimeEncoded(const QByteArray &)

Returns a decoded copy of the MIME-Base64 array mime.

See also
toMimeEncoded(const QString &, QTextCodec *)

◆ fromUrlEncoding()

QString THttpUtility::fromUrlEncoding ( const QByteArray &  enc)
static

Returns a decoded copy of enc.

enc is first decoded from URL encoding, then converted from UTF-8 to unicode.

See also
toUrlEncoding(const QString &, const QByteArray &)

◆ getResponseReasonPhrase()

QByteArray THttpUtility::getResponseReasonPhrase ( int  statusCode)
static

Returns a reason phrase of the HTTP status code statusCode.

◆ getUTCTimeString()

QByteArray THttpUtility::getUTCTimeString ( )
static

◆ htmlEscape() [1/11]

QString THttpUtility::htmlEscape ( const char *  input,
Tf::EscapeFlag  flag = Tf::Quotes 
)
static

◆ htmlEscape() [2/11]

QString THttpUtility::htmlEscape ( const QByteArray &  input,
Tf::EscapeFlag  flag = Tf::Quotes 
)
static

◆ htmlEscape() [3/11]

QString THttpUtility::htmlEscape ( const QString &  input,
Tf::EscapeFlag  flag = Tf::Quotes 
)
static

Returns a converted copy of input.

All applicable characters in input are converted to HTML entities. The conversions performed are:

  • & (ampersand) becomes &amp;.
  • " (double quote) becomes &quot; when Tf::Compatible or Tf::Quotes is set.
  • ' (single quote) becomes &#039; only when Tf::Quotes is set.
  • < (less than) becomes &lt;.
  • > (greater than) becomes &gt;.

◆ htmlEscape() [4/11]

QString THttpUtility::htmlEscape ( const QVariant &  input,
Tf::EscapeFlag  flag = Tf::Quotes 
)
static

◆ htmlEscape() [5/11]

QString THttpUtility::htmlEscape ( double  n)
inlinestatic

Internal use.

◆ htmlEscape() [6/11]

QString THttpUtility::htmlEscape ( int  n)
inlinestatic

Internal use.

◆ htmlEscape() [7/11]

QString THttpUtility::htmlEscape ( long  n)
inlinestatic

Internal use.

◆ htmlEscape() [8/11]

QString THttpUtility::htmlEscape ( qlonglong  n)
inlinestatic

Internal use.

◆ htmlEscape() [9/11]

QString THttpUtility::htmlEscape ( qulonglong  n)
inlinestatic

Internal use.

◆ htmlEscape() [10/11]

QString THttpUtility::htmlEscape ( uint  n)
inlinestatic

Internal use.

◆ htmlEscape() [11/11]

QString THttpUtility::htmlEscape ( ulong  n)
inlinestatic

Internal use.

◆ jsonEscape() [1/4]

QString THttpUtility::jsonEscape ( const char *  input)
static

This function overloads jsonEscape(const QString &).

◆ jsonEscape() [2/4]

QString THttpUtility::jsonEscape ( const QByteArray &  input)
static

This function overloads jsonEscape(const QString &).

◆ jsonEscape() [3/4]

QString THttpUtility::jsonEscape ( const QString &  input)
static

Returns a converted copy of input.

All applicable characters in input are converted to JSON representation. The conversions performed are:

  • & (ampersand) becomes \u0026.
  • < (less than) becomes \u003C.
  • > (greater than) becomes \u003E.

◆ jsonEscape() [4/4]

QString THttpUtility::jsonEscape ( const QVariant &  input)
static

This function overloads jsonEscape(const QString &).

◆ timeZone()

QByteArray THttpUtility::timeZone ( )
static

Returns the numeric timezone "[+|-]hhmm" of the current computer as a bytes array.

◆ toHttpDateTimeString()

QByteArray THttpUtility::toHttpDateTimeString ( const QDateTime &  dateTime)
static

Returns a byte array for Date field of an HTTP header, containing the datetime equivalent of localTime.

◆ toMimeEncoded() [1/2]

QByteArray THttpUtility::toMimeEncoded ( const QString &  input,
const QByteArray &  encoding = "UTF-8" 
)
static

This function overloads toMimeEncoded(const QString &, QTextCodec *).

See also
fromMimeEncoded(const QByteArray &)

◆ toMimeEncoded() [2/2]

QByteArray THttpUtility::toMimeEncoded ( const QString &  input,
QStringConverter::Encoding  encoding 
)
static

◆ toUrlEncoding()

QByteArray THttpUtility::toUrlEncoding ( const QString &  input,
const QByteArray &  exclude = "-._" 
)
static

Returns an encoded copy of input.

input is first converted to UTF-8, and all ASCII-characters that are not in the unreserved group are URL encoded.

See also
fromUrlEncoding(const QByteArray &)

◆ trimmedQuotes()

QString THttpUtility::trimmedQuotes ( const QString &  string)
inlinestatic

Returns a string that has quotes removed from the start and the end.


The documentation for this class was generated from the following files: