Documents > BPS V2 C++ API

A helper class derived from QString to conveniently read HTML files, replace translatable texts and replace parameter tags. More...

#include <bpsmdehtml.h>

List of all members.

Public Member Functions

 BpsMdeHtml (const QString &aString)
 Construct a HTML object from a QString.
 BpsMdeHtml (const char *aFile)
 Construct by reading the HTML template from a file.
BpsMdeHtml set (const QString &aTag, const QString &aValue)
 Replace parameter tags marked in the HTML with {{aTag}} by another value.
BpsMdeHtml set (const QString &aTag, bool aValue)
 Replace parameter tags marked in the HTML with {{aTag}} by another value.
BpsMdeHtml set (const QString &aTag, int aValue)
 Replace parameter tags marked in the HTML with {{aTag}} by another value.
BpsMdeHtml set (const QString &aTag, qlonglong aValue)
 Replace parameter tags marked in the HTML with {{aTag}} by another value.
BpsMdeHtml set (const QString &aTag, qulonglong aValue)
 Replace parameter tags marked in the HTML with {{aTag}} by another value.
BpsMdeHtml trn (const QString &aText, const QString &aTranslated)
 Replace translation texts marked in the HTML with [[aText]] by a translated text.

Static Public Member Functions

static void errorPage (BpsMdeRequest *aRequest, BpsMdeSession *aSession, const QString &aTitle, const QString &aMessage, const QString &aUrl=QString())
 Shows the standard error page of the MDE server.
static QString escapeHtml (const QString &aText)
 Escapes special chars by their html entity: less than, greater than, ampersand.
static void menuPage (BpsMdeRequest *aRequest, BpsMdeSession *aSession, const QString &aTitle, const QList< BpsMdeApplication * > &aApplications)
 Shows a standard menu page of the MDE server.
static QString nbsp ()
static QString toHtml (const QString &aText)
 Convert a normal text to HTML.

Detailed Description

A helper class derived from QString to conveniently read HTML files, replace translatable texts and replace parameter tags.

An extra collection of static methods provide convenience in using core html pages and other items.


Constructor & Destructor Documentation

BpsMdeHtml::BpsMdeHtml ( const QString &  aString)

Construct a HTML object from a QString.

Parameters:
[in]aStringThe string to use.
BpsMdeHtml::BpsMdeHtml ( const char *  aFile)

Construct by reading the HTML template from a file.

Parameters:
[in]aFileThe file name to read from.

Member Function Documentation

static void BpsMdeHtml::errorPage ( BpsMdeRequest aRequest,
BpsMdeSession aSession,
const QString &  aTitle,
const QString &  aMessage,
const QString &  aUrl = QString() 
) [static]

Shows the standard error page of the MDE server.

Parameters:
[in]aRequestThe request handled.
[in]aSessionThe session handled.
[in]aTitleThe page title.
[in]aMessageThe error message.
[in]aUrlThe URL (local page) to call after confirmation.
static QString BpsMdeHtml::escapeHtml ( const QString &  aText) [static]

Escapes special chars by their html entity: less than, greater than, ampersand.

Parameters:
[in]aTextThe text maybe holding special chars with html markup meaning.
Returns:
The text with the problematic characters escaped.
static void BpsMdeHtml::menuPage ( BpsMdeRequest aRequest,
BpsMdeSession aSession,
const QString &  aTitle,
const QList< BpsMdeApplication * > &  aApplications 
) [static]

Shows a standard menu page of the MDE server.

Only applications with non-empty text and icon, and having access are taken into the menu. The menu is first populated with the applications having a fixed position, and then filled up with the others. The applications with not fixed position are ordered by text() ascending (case-insensitive compare).

Parameters:
[in]aRequestThe request handled.
[in]aSessionThe session handled.
[in]aTitleA page title (sent in HTML header only).
[in]aApplicationsThe list of applications as source.
static QString BpsMdeHtml::nbsp ( ) [static]
Returns:
The HTML entity for non breaking space.
BpsMdeHtml BpsMdeHtml::set ( const QString &  aTag,
const QString &  aValue 
)

Replace parameter tags marked in the HTML with {{aTag}} by another value.

Basically this does exactly what trn() does, only with curly braces in place of square brackets.

Parameters:
[in]aTagThe template tag, without the curly braces.
[in]aValueThe value to insert instead of the tag.
Returns:
Returns a new object with the tags replaced.
BpsMdeHtml BpsMdeHtml::set ( const QString &  aTag,
bool  aValue 
)

Replace parameter tags marked in the HTML with {{aTag}} by another value.

Parameters:
[in]aTagThe template tag, without the curly braces.
[in]aValueThe value to insert instead of the tag (true="1", false="0").
Returns:
Returns a new object with the tags replaced.
BpsMdeHtml BpsMdeHtml::set ( const QString &  aTag,
int  aValue 
)

Replace parameter tags marked in the HTML with {{aTag}} by another value.

Parameters:
[in]aTagThe template tag, without the curly braces.
[in]aValueThe value to insert instead of the tag.
Returns:
Returns a new object with the tags replaced.
BpsMdeHtml BpsMdeHtml::set ( const QString &  aTag,
qlonglong  aValue 
)

Replace parameter tags marked in the HTML with {{aTag}} by another value.

Parameters:
[in]aTagThe template tag, without the curly braces.
[in]aValueThe value to insert instead of the tag.
Returns:
Returns a new object with the tags replaced.
BpsMdeHtml BpsMdeHtml::set ( const QString &  aTag,
qulonglong  aValue 
)

Replace parameter tags marked in the HTML with {{aTag}} by another value.

Parameters:
[in]aTagThe template tag, without the curly braces.
[in]aValueThe value to insert instead of the tag.
Returns:
Returns a new object with the tags replaced.
static QString BpsMdeHtml::toHtml ( const QString &  aText) [static]

Convert a normal text to HTML.

Newlines get replaced by BR tags, ampersands are replaced by the html entity.

Parameters:
[in]aTextThe regular text.
Returns:
The HTML code.
BpsMdeHtml BpsMdeHtml::trn ( const QString &  aText,
const QString &  aTranslated 
)

Replace translation texts marked in the HTML with [[aText]] by a translated text.

Basically this does exactly what set() does, only with square brackets in place of curly braces.

Parameters:
[in]aTextThe template text, without the brackets.
[in]aTranslatedThe translated text be inserted instead of the template text replace.
Returns:
Returns a new object with the templates replaced.

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