BPS C++ API  2.24.4
Bps Class Reference

Singleton Bps object as application global. More...

#include <bps.h>

+ Inheritance diagram for Bps:

Public Types

enum  Access { AccessNone = 0 , AccessReadOnly = 1 , AccessReadWrite = 2 }
 Simple access control. More...
 
enum  Alignment { AlignTopLeft = 0 , AlignTopCenter = 1 , AlignTopRight = 2 , AlignMiddleLeft = 3 , AlignMiddleCenter = 4 , AlignMiddleRight = 5 , AlignBottomLeft = 6 , AlignBottomCenter = 7 , AlignBottomRight = 8 }
 General alignment. More...
 
enum  Barcode {
  BarcodeEAN13 = 0 , BarcodeEAN8 = 1 , BarcodeUPCA = 2 , BarcodeUPCE0 = 3 , BarcodeUPCE1 = 4 , BarcodeSUPPL2 = 5 , BarcodeSUPPL5 = 6 , Barcode39 = 7 , Barcode39C = 8 , Barcode39E = 9 ,
  Barcode39EC = 10 , Barcode2of5 = 11 , Barcode2of5C = 12 , Barcode128 = 13 , Barcode128S = 14 , Barcode128R = 15 , BarcodeGS1128 = 16 , BarcodeGS1128S = 17 , BarcodeGS1DB = 18 , BarcodeGS1DBS = 19 ,
  BarcodeGS1DBSO = 20 , BarcodeGS1DBL = 21 , BarcodeGS1DBX = 22 , BarcodeGS1DBXS = 23 , BarcodeQR = 24 , BarcodeGS1QR = 25 , BarcodeDM = 26 , BarcodeGS1DM = 27 , BarcodeDMR = 28 , BarcodeGS1DMR = 29
}
 Type of the bar code construction element. More...
 
enum  Direction { DirectionEast = 0 , DirectionSouth = 1 , DirectionWest = 2 , DirectionNorth = 3 }
 Basic Compass Directions. More...
 
enum  EccLevel { EccLevelMin = 0 , EccLevelVeryLow = 1 , EccLevelLow = 2 , EccLevelMedium = 3 , EccLevelHigh = 4 , EccLevelVeryHigh = 5 , EccLevelMax = 6 }
 Error correction code level. More...
 
enum  HorizontalAlignment { AlignLeft = 0 , AlignCenter = 1 , AlignRight = 2 }
 Horizontal alignment. More...
 
enum  ItemDataRole { RoleSort = Qt::UserRole+100000 , RoleFractionDigits = Qt::UserRole+100001 , RoleKeyString = Qt::UserRole+100002 }
 Item data roles. More...
 
enum  NumStatus { NumFinite , NumPosInfinite , NumNegInfinite , NumNaN }
 Numeric status. More...
 
enum  Rotation { Rotation0 = 0 , Rotation90 = 1 , Rotation180 = 2 , Rotation270 = 3 }
 Rotation in 90 degree steps. More...
 
enum  Status { OK = 0 , Error = 1 , Timeout = 2 , Locked = 3 , Notlocked = 4 , Notfound = 5 }
 General purpose return status. More...
 
enum  VerticalAlignment { AlignTop = 0 , AlignMiddle = 1 , AlignBottom = 2 }
 Vertical alignment. More...
 

Signals

void masterTableChanged (const QString &aTable)
 Emitted when emitMasterTableChanged is called by an application.
 
void tableChanged (const QString &aTable)
 Emitted when emitTableChanged or emitMasterTableChanged is called by an application.
 

Public Member Functions

QStringList accessTexts () const
 
QStringList alignmentTexts () const
 
QStringList barcodeTexts () const
 
bool canEditInstallSettings ()
 Check if the the local installation settings are editable. More...
 
void clearCache ()
 Clears all cached values from the object.
 
QString computerName () const
 Get the computer name. More...
 
QString createTempFile (const QString &aTemplate=QString()) const
 Creates a temporary file and returns the complete file name. More...
 
int decryptPin (int aUserid, int aPin) const
 Decrypt a user PIN. More...
 
QStringList directionTexts () const
 
QString directory (const QString &aName=QString()) const
 Get a BPS application directory. More...
 
qreal dot2mm () const
 
QStringList eccLevelTexts () const
 
void emitMasterTableChanged (const QString &aTable)
 Emit the signals masterTableChanged and tableChanged. More...
 
void emitTableChanged (const QString &aTable)
 Emit the signal tableChanged. More...
 
int encryptPin (int aUserid, int aPin) const
 Encrypt a user PIN. More...
 
int indexOf (const QString &aCharList, const QString &aChar) const
 Replacement for QString::indexOf to check for a single char position. More...
 
int indexOf (const QString &aCharList, const QVariant &aChar) const
 Replacement for QString::indexOf to check for a single char position. More...
 
QBrush invalidInputBackgroundBrush () const
 
bool isElevated ()
 Check if the current process is running with elevated or limited privilege. More...
 
bool isEqual (const QVariant &aFirst, const QVariant &aSecond) const
 Compare 2 QVariant for non-strict equality (so the QVariant type may differ). More...
 
bool isEqual (const QVariantMap &aFirst, const QVariantMap &aSecond) const
 Compare a pair of QVariantMap for non-strict equality. More...
 
bool isInfinite (double aValue) const
 Check if a double value is infinite. More...
 
bool isNaN (double aValue) const
 Check if a double value is NaN. More...
 
bool isStrictlyEqual (const QVariant &aFirst, const QVariant &aSecond) const
 Compare 2 QVariants for strict equality. More...
 
QString loadStyleSheet (const QString &aFilename) const
 Load a style sheet with the given file name. More...
 
QLocale locale () const
 Get the locale to be used. More...
 
QMap< QString, QStringlowerKeyStringMap (const QMap< QString, QString > &aStringMap)
 Get a string map where all keys are lower case. More...
 
QMap< QString, QStringlowerKeyStringMap (const QVariantMap &aVariantMap)
 Get a string map where all keys are lower case. More...
 
QDateTime makeDateTime (const QString &aDateTime)
 Create QDateTime from a BPS date/time string. More...
 
qreal mm2dot () const
 
void msleep (int aMilliseconds) const
 Sleep for a number of milliseconds. More...
 
void mwait (int aMilliseconds) const
 Wait for a number of milliseconds. More...
 
QString nodeName () const
 Get the node name. More...
 
NumStatus numStatus (const BpsDecimal &aValue) const
 Returns the numeric status of a BpsDecimal value. More...
 
NumStatus numStatus (double aValue) const
 Returns the numeric status of a double value. More...
 
QString personalFolder () const
 Get the personal data folder. More...
 
bool printData (const QString &aPrinterName, const QString &aDocName, const QByteArray &aData) const
 Send data to a printer. More...
 
QString printerShareName (const QString &aPrinterName) const
 Get the share name of a printer if it is a network printer. More...
 
bool printFile (const QString &aPrinterName, const QString &aDocName, const QString &aFileName) const
 Send a file to a printer. More...
 
double round (double aValue, int aDecPlaces=3) const
 Round off as per standard commercial practice. More...
 
int screenResolution () const
 
void setUserStatusPath (const QString &aPath)
 Set a new user status path. More...
 
void sleep (int aSeconds) const
 Sleep for a number of seconds. More...
 
QString stripTimeFormat (const QString &aDateTimeFormat)
 Strip the time format from a date/time format string, creating a date only format. More...
 
QString terminalName () const
 Get the terminal name. More...
 
QString toString (const QVariant &aValue, int aDecPlaces=-3, int aMaxSize=17) const
 Get string representation of a QVariant. More...
 
QMap< QString, QStringtoStringMap (const QVariantMap &aVariantMap)
 Convert a variant map to a string map. More...
 
QVariantMap toVariantMap (const QMap< QString, QString > &aStringMap)
 Convert a string map to a variant map. More...
 
QString trimMultilineText (BpsDatastore *aDatastore, const QString &aTable, const QString &aColumn, const QString &aText)
 Apply a validators multi line text constraints (maxlines and maxperline) to a text and return the trimmed text. More...
 
QString userName () const
 Get the system user name. More...
 
QString userStatusPath () const
 The user status path is convenient to store local user settings additionally separated by database user name. More...
 
void usleep (int aMicroseconds) const
 Sleep for a number of microseconds. More...
 
QVariant validatorValue (BpsDatastore *aDatastore, const QString &aTable, const QString &aKey, const QVariant &aDefValue=QVariant())
 Reads a validator setting from the central system settings in Validators/table/key. More...
 
void wait (int aSeconds) const
 Wait for a number of seconds. More...
 
- Public Member Functions inherited from QObject
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
 QObject (QObject *parent)
 
qobject_cast (const QObject *object)
 
qobject_cast (QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Static Public Member Functions

static QModelIndexList bottomIndexes (const QModelIndexList &aIndexes)
 Reduces a list of tree indexes to the most bottom elements, by removing the indexes which are higher-ups of another index in the list. More...
 
static Bpsinstance ()
 
static int modelIndexLevel (const QModelIndex &aIndex)
 Find the level of a tree model index. More...
 
static QModelIndexList topIndexes (const QModelIndexList &aIndexes)
 Reduces a list of tree indexes to the topmost elements, by removing the indexes which are descendants of another index in the list. More...
 
static bool treeModelIndexGreaterThan (const QModelIndex &aFirst, const QModelIndex &aSecond)
 Compares two indexes of a tree model. More...
 
static bool treeModelIndexLessThan (const QModelIndex &aFirst, const QModelIndex &aSecond)
 Compares two indexes of a tree model. More...
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Related Functions

(Note that these are not member functions.)

#define bps   Bps::instance()
 Convenience notation for Bps::instance()
 

Additional Inherited Members

- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 
- Properties inherited from QObject
 objectName
 

Detailed Description

Singleton Bps object as application global.

Member Enumeration Documentation

◆ Access

Simple access control.

Enumerator
AccessNone 

No access permission.

AccessReadOnly 

Read only access.

AccessReadWrite 

Read/write access.

◆ Alignment

General alignment.

Enumerator
AlignTopLeft 

Align to the top left.

AlignTopCenter 

Align to the top center.

AlignTopRight 

Align to the top right.

AlignMiddleLeft 

Align to the middle left.

AlignMiddleCenter 

Align to the middle center.

AlignMiddleRight 

Align to the middle right.

AlignBottomLeft 

Align to the bottom left.

AlignBottomCenter 

Align to the bottom center.

AlignBottomRight 

Align to the bottom right.

◆ Barcode

Type of the bar code construction element.

Note
(1) with check char (last char of text)
(2) text is 8 chars: '0' + 6 data digits + check char
(3) with check char (not part of text)
(4) 43 chars: 0...9 A...Z - . SPACE $ / + %
(5) 128 chars: ASCII 0...127
Enumerator
BarcodeEAN13 

EAN, 13 digits (1)

BarcodeEAN8 

EAN, 8 digits (1)

BarcodeUPCA 

UPC-A, 12 digits (1)

BarcodeUPCE0 

UPC-E Code 0, 6 digits (2)

BarcodeUPCE1 

UPC-E Code 1, 6 digits (2)

BarcodeSUPPL2 

EAN/UPC 2-digit supplement.

BarcodeSUPPL5 

EAN/UPC 5-digit supplement.

Barcode39 

Code 39 no check char (4)

Barcode39C 

Code 39 with check char (3,4)

Barcode39E 

Extended Code 39 no check char (5)

Barcode39EC 

Extended Code 39 with check char (3,5)

Barcode2of5 

Interleaved 2 of 5.

Barcode2of5C 

Interleaved 2 of 5 with check char (1)

Barcode128 

Code 128 (5)

Barcode128S 

Code 128 store and concat with next (5)

Barcode128R 

Code 128 reader function control (5)

BarcodeGS1128 

GS1-128 (5)

BarcodeGS1128S 

GS1-128 store and concat with next (5)

BarcodeGS1DB 

GS1 DataBar Omnidirectional or Truncated (same as omnidirectional, just smaller in height)

BarcodeGS1DBS 

GS1 DataBar Stacked.

BarcodeGS1DBSO 

GS1 DataBar Stacked Omnidirectional.

BarcodeGS1DBL 

GS1 DataBar Limited.

BarcodeGS1DBX 

GS1 DataBar Expanded.

BarcodeGS1DBXS 

GS1 DataBar Expanded Stacked.

BarcodeQR 

QR Code.

BarcodeGS1QR 

GS1 QR Code.

BarcodeDM 

DataMatrix (square)

BarcodeGS1DM 

GS1 DataMatrix (square)

BarcodeDMR 

DataMatrix (rectangular)

BarcodeGS1DMR 

GS1 DataMatrix (rectangular)

◆ Direction

Basic Compass Directions.

Enumerator
DirectionEast 

To east (default)

DirectionSouth 

To south.

DirectionWest 

To west.

DirectionNorth 

To north.

◆ EccLevel

Error correction code level.

Mapping of correction levels to 2D bar codes:

EccLevelQR CodeiQR Code
EccLevelMinL: up to 7%L: up to 7%
EccLevelVeryLowL: up to 7%L: up to 7%
EccLevelLowL: up to 7%M: up to 15%
EccLevelMediumM: up to 15%Q: up to 25%
EccLevelHighQ: up to 25%H: up to 30%
EccLevelVeryHighH: up to 30%S: up to 50%
EccLevelMaxH: up to 30%T: up to 60%
Enumerator
EccLevelMin 

Minimum level.

EccLevelVeryLow 

Very low level.

EccLevelLow 

Low level.

EccLevelMedium 

Medium level.

EccLevelHigh 

High level.

EccLevelVeryHigh 

Very level.

EccLevelMax 

Maximum level.

◆ HorizontalAlignment

Horizontal alignment.

Enumerator
AlignLeft 

Align to the left.

AlignCenter 

Align to the center.

AlignRight 

Align to the top right.

◆ ItemDataRole

Item data roles.

Enumerator
RoleSort 

The data used for custom item sorting.

See also
BpsTreeWidgetItem::data()
RoleFractionDigits 

Number of fraction digits to use for display of numeric values.

See also
BpsTreeWidgetItem::operator<()
RoleKeyString 

String representation of the record key.

See also
BpsTreeWidget::saveCurrentItem()
BpsTreeWidget::restoreCurrentItem(const QVariant& aData)

◆ NumStatus

Numeric status.

Enumerator
NumFinite 

Finite.

NumPosInfinite 

Positive infinite.

NumNegInfinite 

Negative infinite.

NumNaN 

Not a number.

◆ Rotation

Rotation in 90 degree steps.

Enumerator
Rotation0 

No rotation (default)

Rotation90 

90 degrees

Rotation180 

180 degrees

Rotation270 

270 degrees

◆ Status

General purpose return status.

Enumerator
OK 

All worked out.

Error 

Some unspecified error happened.

Timeout 

The operation timed out.

Locked 

The object is already locked.

Notlocked 

The object was not locked for the current actor.

Notfound 

The object was not found.

◆ VerticalAlignment

Vertical alignment.

Enumerator
AlignTop 

Align to the top.

AlignMiddle 

Align to the middle.

AlignBottom 

Align to the bottom.

Member Function Documentation

◆ accessTexts()

QStringList Bps::accessTexts ( ) const
Returns
Access texts.

◆ alignmentTexts()

QStringList Bps::alignmentTexts ( ) const
Returns
Alignment texts.

◆ barcodeTexts()

QStringList Bps::barcodeTexts ( ) const
Returns
Barcode texts.

◆ bottomIndexes()

static QModelIndexList Bps::bottomIndexes ( const QModelIndexList &  aIndexes)
static

Reduces a list of tree indexes to the most bottom elements, by removing the indexes which are higher-ups of another index in the list.

Parameters
aIndexesThe index list to process.
Returns
List of most bottom indexes.

◆ canEditInstallSettings()

bool Bps::canEditInstallSettings ( )

Check if the the local installation settings are editable.

The settings are stored in the file settings.ini in the application data folder selected while installing BPS.

Returns
true = editable, false = not editable.

◆ computerName()

QString Bps::computerName ( ) const

Get the computer name.

The computer name taken from the environment variables COMPUTERNAME. For fat clients COMPUTERNAME is the name of the workstation. For thin clients COMPUTERNAME is the name of the terminal server.

Returns
The computer name as string.

◆ createTempFile()

QString Bps::createTempFile ( const QString aTemplate = QString()) const

Creates a temporary file and returns the complete file name.

It is purpose of the application to delete the file when it is no longer needed.

In most cases it will be more convenient to use QTemporaryFile, however there are special cases like when printing where you need to provide a file name and the class will open, write and close the file itself.

Parameters
aTemplateA file name template, as in QTemporaryFile.
Returns
The name of the created file.

◆ decryptPin()

int Bps::decryptPin ( int  aUserid,
int  aPin 
) const

Decrypt a user PIN.

Parameters
aUseridThe user id.
aPinThe encrypted PIN.
Returns
The decrypted PIN.

◆ directionTexts()

QStringList Bps::directionTexts ( ) const
Returns
Direction texts.

◆ directory()

QString Bps::directory ( const QString aName = QString()) const

Get a BPS application directory.

The path is first searched in the environment where aName is prefixed with "BPS_".

When the path was not found in the environment variables, it is searched in the file bps.conf which is in the directory where the executable was started from. The key aName is expected in section [Paths]. (Note that in bps.conf paths are written with forward slashes).

If the found path is relative (not starting with a drive or slash/backslash), it is assumed to be relative to the BPS installation directory (one above the exe's). The returned path is made absolute under this premise. The installation directory however is normally not writable, so a relative path is rarely reasonable.

Example 1: Relative path in environment variable

aNameLogs
Environment variable BPS_LOGS=mylogs
bps.conf: [Paths] ... Logs=(ignored if environment variable defined)
BPS installation directoryC:\Program Files\IBK BPS 2.22.0
Returned pathC:/Program Files/IBK BPS 2.22.0/mylogs

Example 2: Absolute path in bps.conf

aNameLogs
Environment variable BPS_LOGS=(not defined)
bps.conf: [Paths] ... Logs=C:/ProgramData/IBK Software AG/BPS2/logs
BPS installation directory(does not matter when path is absolute)
Returned pathC:/ProgramData/IBK Software AG/BPS2/logs
Parameters
aNameLogical path name, for example: CSS, Data, Logs, Plugins Scripts or Translations. Get the BPS installation directory if aName is empty.
Returns
The absolute path (with forward slashes), or empty string if path unknown.

◆ dot2mm()

qreal Bps::dot2mm ( ) const
Returns
The dot to millimeter conversion factor for the screen resolution.

◆ eccLevelTexts()

QStringList Bps::eccLevelTexts ( ) const
Returns
Error correction level texts.

◆ emitMasterTableChanged()

void Bps::emitMasterTableChanged ( const QString aTable)

Emit the signals masterTableChanged and tableChanged.

Called by applications when a master data table has been changed.

Parameters
aTableName of the table changed.

◆ emitTableChanged()

void Bps::emitTableChanged ( const QString aTable)

Emit the signal tableChanged.

Called by applications when data of a table has been changed.

Parameters
aTableName of the table changed.

◆ encryptPin()

int Bps::encryptPin ( int  aUserid,
int  aPin 
) const

Encrypt a user PIN.

Parameters
aUseridThe user id.
aPinThe unencrypted PIN.
Returns
The encrypted PIN.

◆ indexOf() [1/2]

int Bps::indexOf ( const QString aCharList,
const QString aChar 
) const

Replacement for QString::indexOf to check for a single char position.

Parameters
aCharListThe list of characters to check.
aCharString assumed to hold a single char.
Returns
Position of matched char when >= 0. -1 if not found or string length != 1.

◆ indexOf() [2/2]

int Bps::indexOf ( const QString aCharList,
const QVariant aChar 
) const

Replacement for QString::indexOf to check for a single char position.

Parameters
aCharListThe list of characters to check.
aCharQVariant with string assumed to hold a single char.
Returns
Position of matched char when >= 0. -1 if not found or string length != 1.

◆ instance()

static Bps* Bps::instance ( )
static
Returns
The instance of the singleton Bps object.

◆ invalidInputBackgroundBrush()

QBrush Bps::invalidInputBackgroundBrush ( ) const
Returns
The background brush for invalid input data.

◆ isElevated()

bool Bps::isElevated ( )

Check if the current process is running with elevated or limited privilege.

Elevated: Either UAC is enabled and the process was elevated by the administrator, or UAC is disabled and the process was started by a user who is a member of the Administrators group.

Not elevated (limited): Either UAC is enabled and the process was started normally without the elevation, or UAC is disabled and the process was started by a standard user.

Returns
true = elevated, false = limited.

◆ isEqual() [1/2]

bool Bps::isEqual ( const QVariant aFirst,
const QVariant aSecond 
) const

Compare 2 QVariant for non-strict equality (so the QVariant type may differ).

They are considered equal when both are null, or both are not null and have same value.

  • BpsMargins and BpsDecimal are tested by their native equality operators. BpsDecimal is also compared this way with all types convertible to double.
  • QBrush with the same "transform" are considered equal.
  • Pairs of QVariantMap are compared with isEqual(QVariantMap,QVariantMap).
Parameters
aFirstFirst value to compare.
aSecondSecond value to compare against.
Returns
True is the values are equal.

◆ isEqual() [2/2]

bool Bps::isEqual ( const QVariantMap &  aFirst,
const QVariantMap &  aSecond 
) const

Compare a pair of QVariantMap for non-strict equality.

  • First check is that both maps contain the list of element keys (key names are compared case-sensitive).
  • Second compare each element pair with isEqual(QVariant,QVariant)
Parameters
aFirstFirst map to compare.
aSecondSecond map to compare against.
Returns
True is the maps are equal.

◆ isInfinite()

bool Bps::isInfinite ( double  aValue) const
inline

Check if a double value is infinite.

To check if the value is a positive or negative infinite, you need to compare it additionally with any finite number (positive infinites are bigger than any other value except itself and NaN, negative infinites are smaller than any other value except itself and NaN):

if (bps->isInfinite(myval)) {
if (myval < 0) {
// negative infinite
} else {
// positive infinite
}
}
#define bps
Convenience notation for Bps::instance()
Definition: bps.h:53
Parameters
aValueThe value to check.
Returns
True if value is infinite, false if not infinite.

◆ isNaN()

bool Bps::isNaN ( double  aValue) const
inline

Check if a double value is NaN.

Parameters
aValueThe value to check.
Returns
True if NaN, false if not NaN.

◆ isStrictlyEqual()

bool Bps::isStrictlyEqual ( const QVariant aFirst,
const QVariant aSecond 
) const

Compare 2 QVariants for strict equality.

They are considered equal when both are of same type and value.

Parameters
aFirstFirst value to compare.
aSecondSecond value to compare against.
Returns
True is the values are equal.

◆ loadStyleSheet()

QString Bps::loadStyleSheet ( const QString aFilename) const

Load a style sheet with the given file name.

If the filename does not have an extension, .css will be added. If the file name is no absolute path, the file will first be searched from the current directory, and then in the logical path CSS.

Parameters
aFilenameThe file name of the style sheet.
Returns
Style sheet text, or empty string if file not found.

◆ locale()

QLocale Bps::locale ( ) const

Get the locale to be used.

First the environment variables are searched for a BPS_LOCALE, if not found the system locate is used.

Set the locale format in the environment is "language[_country]" where:

  • language is a lowercase, two-letter, ISO 639 language code (also some three-letter codes)
  • country is an uppercase, two-letter, ISO 3166 country code (also "419" as defined by United Nations)

Examples:

set BPS_LOCALE=de
set BPS_LOCALE=fr_CH
Returns
The locale to be use.

◆ lowerKeyStringMap() [1/2]

QMap<QString,QString> Bps::lowerKeyStringMap ( const QMap< QString, QString > &  aStringMap)

Get a string map where all keys are lower case.

Keys and values of the returned string map are trimmed, e.g. the leading and trailing whitespace is removed

Parameters
aStringMapThe map with probably mixed case keys.
Returns
The map with lower case keys.

◆ lowerKeyStringMap() [2/2]

QMap<QString,QString> Bps::lowerKeyStringMap ( const QVariantMap &  aVariantMap)

Get a string map where all keys are lower case.

Keys and values of the returned string map are trimmed, e.g. the leading and trailing whitespace is removed

Parameters
aVariantMapThe variant map with probably mixed case keys.
Returns
The string map with lower case keys.

◆ makeDateTime()

QDateTime Bps::makeDateTime ( const QString aDateTime)

Create QDateTime from a BPS date/time string.

The input is assumed to be of format YYYY.MM.DD HH:MM:SS, but may contain + or - signs for each portion to indicate relative years/months/days/hours/minutes/seconds the add subtract to the current date time. First the relative numbers get added or subtracted to/from the current date, then the absolute numbers get set.

In the following examples the current date/time is assumed to be 2009.05.28 07:47:32

aDateTimeReturn
2010.03.01 12:10:002010.03.01 12:10:00
+0000.+00.+00 +00:+00:+002009.05.28 07:47:32
-0010.-00.-00 00:00:001999.05.28 00:00:00
+0000.+00.+01 12:00:002009.05.29 12:00:00
Parameters
aDateTimeThe date/time string.
Returns
The date/time object.

◆ mm2dot()

qreal Bps::mm2dot ( ) const
Returns
The millimeter to dot conversion factor for the screen resolution.

◆ modelIndexLevel()

static int Bps::modelIndexLevel ( const QModelIndex aIndex)
static

Find the level of a tree model index.

The root item has level 0, children of root have level 1, grandchildren have level 2 and so on.

Parameters
aIndexThe tree model index of interest.
Returns
Level of the index

◆ msleep()

void Bps::msleep ( int  aMilliseconds) const

Sleep for a number of milliseconds.

No event processing will be done so the application will be unresponsive. Use mwait() in case to for non-blocking sleeping.

Parameters
aMillisecondsThe time to sleep.

◆ mwait()

void Bps::mwait ( int  aMilliseconds) const

Wait for a number of milliseconds.

While waiting, events will be processed and the application will stay responsive to user interface events and network communication. If aMilliseconds is <= 0, the function returns immediately after processing any pending events.

Parameters
aMillisecondsThe time to wait.

◆ nodeName()

QString Bps::nodeName ( ) const

Get the node name.

The node name is made up by the three parts computerName(), terminalName() and sysUserName() joined together by dots, for example WS12325.TC005.pmiller. Equal parts are omitted, for example if computerName() is equal to terminalName(), only one of them is shown.

Returns
The node name as string.

◆ numStatus() [1/2]

NumStatus Bps::numStatus ( const BpsDecimal aValue) const

Returns the numeric status of a BpsDecimal value.

Parameters
aValueThe value to check.
Returns
The current numeric status of aValue.

◆ numStatus() [2/2]

NumStatus Bps::numStatus ( double  aValue) const

Returns the numeric status of a double value.

Parameters
aValueThe value to check.
Returns
The current numeric status of aValue.

◆ personalFolder()

QString Bps::personalFolder ( ) const

Get the personal data folder.

Under windows this is the path of "My documents" or "Eigene Dateien". Under other operating systems this function is equivalent to QDir::homePath().

Returns
The personal data folder.

◆ printData()

bool Bps::printData ( const QString aPrinterName,
const QString aDocName,
const QByteArray aData 
) const

Send data to a printer.

Parameters
aPrinterNameThe name of the printer. May also be a network printer name such as "\\\\server\\printer".
aDocNameThe document name as shown in the spooler. The document name will be prefixed with the node name, for example when the document name is "My Report", the spooler might show "SPEEDY.Console.kochp: My Report".
aDataThe data to send.
Returns
True if successfully sent

◆ printerShareName()

QString Bps::printerShareName ( const QString aPrinterName) const

Get the share name of a printer if it is a network printer.

Parameters
aPrinterNameThe given printer name.
Returns
Network share name, or empty string for local printers

◆ printFile()

bool Bps::printFile ( const QString aPrinterName,
const QString aDocName,
const QString aFileName 
) const

Send a file to a printer.

The printer may be any local or network printer known to the workstation.

Parameters
aPrinterNameThe name of the printer. May also be a network printer name such as "\\\\server\\printer".
aDocNameThe document name as shown in the spooler. The document name will be prefixed with the node name, for example when the document name is "My Report", the spooler might show "SPEEDY.Console.kochp: My Report".
aFileNameThe name of the file to send.
Returns
True if successfully sent

◆ round()

double Bps::round ( double  aValue,
int  aDecPlaces = 3 
) const

Round off as per standard commercial practice.

Parameters
aValueThe value to round off.
aDecPlacesNumber of decimal places.
Returns
The rounded off value.

◆ screenResolution()

int Bps::screenResolution ( ) const
Returns
Returns the logical screen resolution in DPI.

◆ setUserStatusPath()

void Bps::setUserStatusPath ( const QString aPath)

Set a new user status path.

Parameters
aPathThe new user status path to set.

◆ sleep()

void Bps::sleep ( int  aSeconds) const

Sleep for a number of seconds.

No event processing will be done so the application will be unresponsive. Use wait() in case to for non-blocking sleeping.

Parameters
aSecondsThe time to sleep.

◆ stripTimeFormat()

QString Bps::stripTimeFormat ( const QString aDateTimeFormat)

Strip the time format from a date/time format string, creating a date only format.

Leading delimiter chars (in " -.,:;") before the first time format char (in "hHmszt"), and all characters between the first and last time format char are removed.

Examples:

fmt = stripTimeFormat(bStr("dd.MM.yyyy hh:mm"); // fmt = "dd.MM.yyyy"
fmt = stripTimeFormat(bStr("dd.MM.yyyy-hh:mm"); // fmt = "dd.MM.yyyy"
fmt = stripTimeFormat(bStr("XXX dd.MM # hh:mm-yyyy-zzz ++"); // fmt = "XXX dd.MM # ++"
#define bStr(aStr)
Encapsulation for string literals.
Definition: bpsglobals.h:125
QString stripTimeFormat(const QString &aDateTimeFormat)
Strip the time format from a date/time format string, creating a date only format.
Parameters
aDateTimeFormatThe date/time format string.
Returns
The date format string.

◆ terminalName()

QString Bps::terminalName ( ) const

Get the terminal name.

The terminal name is taken from the environment variable CLIENTNAME, if such is present and it is not "Console". Otherwise it is set equal to computerName().

Returns
The terminal name as string.

◆ topIndexes()

static QModelIndexList Bps::topIndexes ( const QModelIndexList &  aIndexes)
static

Reduces a list of tree indexes to the topmost elements, by removing the indexes which are descendants of another index in the list.

Parameters
aIndexesThe index list to process.
Returns
List of topmost indexes.

◆ toString()

QString Bps::toString ( const QVariant aValue,
int  aDecPlaces = -3,
int  aMaxSize = 17 
) const

Get string representation of a QVariant.

Parameters
aValueThe value to process.
aDecPlacesNumber of decimal places. Only applied for numeric values.
aMaxSizeMaximum string size. Only applied for numeric values.
Returns
String representation of the value.

◆ toStringMap()

QMap<QString,QString> Bps::toStringMap ( const QVariantMap &  aVariantMap)

Convert a variant map to a string map.

The case of the keys is retained.

Parameters
aVariantMapThe variant map to convert.
Returns
The string map.

◆ toVariantMap()

QVariantMap Bps::toVariantMap ( const QMap< QString, QString > &  aStringMap)

Convert a string map to a variant map.

The case of the keys is retained.

Parameters
aStringMapThe string map to convert.
Returns
The variant map.

◆ treeModelIndexGreaterThan()

static bool Bps::treeModelIndexGreaterThan ( const QModelIndex aFirst,
const QModelIndex aSecond 
)
static

Compares two indexes of a tree model.

This is useful for sorting a QModelIndexList of a tree model in descending order.

Example:

QModelIndexList list;
// list populated with arbitrary indexes
qSort(list.begin(), list.end(), Bps::treeModelIndexGreaterThan);
static bool treeModelIndexGreaterThan(const QModelIndex &aFirst, const QModelIndex &aSecond)
Compares two indexes of a tree model.
Parameters
aFirstThe first index.
aSecondThe second index.
Returns
True if first is greater than second.

◆ treeModelIndexLessThan()

static bool Bps::treeModelIndexLessThan ( const QModelIndex aFirst,
const QModelIndex aSecond 
)
static

Compares two indexes of a tree model.

This is useful for sorting a QModelIndexList of a tree model in ascending order.

Example:

QModelIndexList list;
// list populated with arbitrary indexes
qSort(list.begin(), list.end(), Bps::treeModelIndexLessThan);
static bool treeModelIndexLessThan(const QModelIndex &aFirst, const QModelIndex &aSecond)
Compares two indexes of a tree model.
Parameters
aFirstThe first index.
aSecondThe second index.
Returns
True if first is smaller than second.

◆ trimMultilineText()

QString Bps::trimMultilineText ( BpsDatastore aDatastore,
const QString aTable,
const QString aColumn,
const QString aText 
)

Apply a validators multi line text constraints (maxlines and maxperline) to a text and return the trimmed text.

Parameters
aDatastoreThe datastore to use.
aTableThe table name for the validator settings to use.
aColumnThe column name for the validator settings to use.
aTextThe text to check and in case trim.
Returns
Returns the trimmed text.

◆ userName()

QString Bps::userName ( ) const

Get the system user name.

The system user name taken from the environment variable USERNAME.

Returns
The system user name as string.

◆ userStatusPath()

QString Bps::userStatusPath ( ) const

The user status path is convenient to store local user settings additionally separated by database user name.

After construction of the bps Object, the default is initialized to "Status", and by convention the main application (workplace for example) will set it to "Status/dbUserName" after login.

Returns
The current user status path.

◆ usleep()

void Bps::usleep ( int  aMicroseconds) const

Sleep for a number of microseconds.

Parameters
aMicrosecondsThe time to sleep.

◆ validatorValue()

QVariant Bps::validatorValue ( BpsDatastore aDatastore,
const QString aTable,
const QString aKey,
const QVariant aDefValue = QVariant() 
)

Reads a validator setting from the central system settings in Validators/table/key.

The read values are cached for speed.

Parameters
aDatastoreThe datastore to operate on.
aTableThe table name.
aKeyThe key name, mostly something as "c_fieldname.mask" for example.
aDefValueA default value to return if no value is found or it is empty.
Returns
Returns the validator value.
Exceptions
BpsExceptionOn datastore errors.

◆ wait()

void Bps::wait ( int  aSeconds) const

Wait for a number of seconds.

While waiting, events will be processed and the application will stay responsive to user interface events and network communication. If aSeconds is <= 0, the function returns immediately after processing any pending events.

Parameters
aSecondsThe time to wait.

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