TreeFrogFramework  1.18
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 QString htmlEscape (const QString &input, Tf::EscapeFlag flag=Tf::Quotes)
 
static QString htmlEscape (int 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, QTextCodec *codec)
 
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

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

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

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.

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

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

See also
toMimeEncoded(const QString &, QTextCodec *)
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 &)
QByteArray THttpUtility::getResponseReasonPhrase ( int  statusCode)
static

Returns a reason phrase of the HTTP status code statusCode.

QByteArray THttpUtility::getUTCTimeString ( )
static
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;.
QString THttpUtility::htmlEscape ( int  n)
inlinestatic

Internal use.

QString THttpUtility::htmlEscape ( long  n)
inlinestatic

Internal use.

QString THttpUtility::htmlEscape ( ulong  n)
inlinestatic

Internal use.

QString THttpUtility::htmlEscape ( qlonglong  n)
inlinestatic

Internal use.

QString THttpUtility::htmlEscape ( qulonglong  n)
inlinestatic

Internal use.

QString THttpUtility::htmlEscape ( double  n)
inlinestatic

Internal use.

QString THttpUtility::htmlEscape ( const char *  input,
Tf::EscapeFlag  flag = Tf::Quotes 
)
static
QString THttpUtility::htmlEscape ( const QByteArray &  input,
Tf::EscapeFlag  flag = Tf::Quotes 
)
static
QString THttpUtility::htmlEscape ( const QVariant &  input,
Tf::EscapeFlag  flag = Tf::Quotes 
)
static
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.
QString THttpUtility::jsonEscape ( const char *  input)
static

This function overloads jsonEscape(const QString &).

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

This function overloads jsonEscape(const QString &).

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

This function overloads jsonEscape(const QString &).

QByteArray THttpUtility::timeZone ( )
static

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

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

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

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

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

See also
fromMimeEncoded(const QByteArray &)
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 &)
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: