The bps extension is a namespace assembling general BPS properties and functions. More...
Namespaces | |
gui | |
The bps.gui extension is a namespace assembling GUI properties and functions. | |
installer | |
The bps.installer extension is a namespace holding classes for installation and update of the BPS database. | |
validator | |
The bps.validator extension is a namespace holding the base class for field validators. | |
Classes | |
class | AsyncIO |
The bps.AsyncIO class provides functionality for reading and writing asynchronous serial ports. More... | |
class | Brush |
A wrapper for QBrush. More... | |
class | CmdlineParser |
A parser for command line arguments. More... | |
class | Color |
A wrapper for QColor. More... | |
class | Datastore |
The datastore class is used to access the BPS databases. More... | |
class | Decimal |
A class for decimal arithmetics. More... | |
class | Dir |
The bps.Dir class provides access to directory structures and their contents in a platform-independent way. More... | |
class | FieldValidator |
This class implements the BPS table field validator. More... | |
class | File |
The bps.File class provides functionality for reading and writing binary and text files. More... | |
class | Font |
A wrapper for QFont. More... | |
class | Margins |
A wrapper for BpsMargins. More... | |
class | MaskProcessor |
This class implements the BPS mask validator for input text. More... | |
class | OrderUtils |
The OrderUtils class holds a number of utility methods for order processing. More... | |
class | Pen |
A wrapper for QPen. More... | |
class | Pixmap |
A wrapper for QPixmap. More... | |
class | Point |
A wrapper for QPointF. More... | |
class | Query |
The query class is used to process SQL queries. More... | |
class | Schedule |
This class implements the BPS schedule object. More... | |
class | Settings |
Create and query settings on the local maching and in the central datastore. More... | |
class | Size |
A wrapper for QSizeF. More... | |
class | SqlValues |
Convenience class to help composing select, insert and update statements. More... | |
class | Timer |
The Timer class provides repetitive and single-shot timers. More... | |
class | XmlReader |
A wrapper for QXmlStreamReader. More... | |
class | XmlWriter |
A wrapper for QXmlStreamWriter. More... | |
Functions | |
Boolean | canEditInstallSettings () |
Check if the the local installation settings are editable. More... | |
String | dateToTimestampString (Date aDate) |
Format date object to a timestamp string. More... | |
Number | decryptPin (Number aUserid, Number aPin) |
Decrypt a user PIN. More... | |
String | directory (String aName="") |
Get a BPS application directory. More... | |
String | dump (Mixed aValue, Number aMaxDepth=100) |
Format any variable (except functions) for debug output. More... | |
Number | encryptPin (Number aUserid, Number aPin) |
Encrypt a user PIN. More... | |
String | formatError (Error aError) |
Format an Error for display. More... | |
String | formatNiceNumber (Number aValue) |
Format a large integer number for better human readability, for example 1234567 becomes 1'234'567. More... | |
Boolean | isElevated () |
Check if the current process is running with elevated or limited privilege. More... | |
void | lerror (...) |
Print to log error output. More... | |
void | lfile (...) |
Print lo log file only. More... | |
void | log (...) |
Print to log output. More... | |
void | logClose () |
Close the log file. More... | |
void | logOpen () |
Opens the log file and writes the script name and starting date/time into it. More... | |
void | msleep (Number aMilliseconds) |
Sleep for the time specified in milliseconds. More... | |
void | mwait (Number aMilliseconds) |
Wait for a number of milliseconds. More... | |
String | personalFolder () |
Get the personal data folder. More... | |
Boolean | printData (String aPrinterName, String aDocName, String aData, String aCodec="") |
Send data to a printer. More... | |
Boolean | printFile (String aPrinterName, String aDocName, String aFileName) |
Send a file to a printer. More... | |
Number | round (Number aValue, Number aDigits=3) |
Round off as per standard commercial practice. More... | |
void | sleep (Number aSeconds) |
Sleep for the time specified in seconds. More... | |
String | sprintf (String aFormat, Mixed aArgs) |
A string formatting function. More... | |
Date | timestampStringToDate (String aTimestampString) |
Parses a date/time encoded in text with format YYYYMMDDHHMMSS. More... | |
void | usleep (Number aMicroseconds) |
Sleep for the time specified in microseconds. More... | |
void | wait (Number aSeconds) |
Wait for a number of seconds. More... | |
Variables | |
String | logFile |
The log file name used by bps.log(), bps.lerror() and bps.lfile(). More... | |
Number | logLevel |
The level to indent the log outputs by. More... | |
String | Version |
Software version as text. | |
Number | VersionFix |
Software fix version number. | |
Number | VersionMajor |
Software major version number. | |
Number | VersionMicro |
Software micro version number. | |
Number | VersionMinor |
Software minor version number. | |
The bps extension is a namespace assembling general BPS properties and functions.
There is only one static bps object, you can not create new objects of this type.
The extension needs to be loaded before it can be used:
Embedded scripts (getting called by BPS C++ code) such as report scripts for example have the bps extension allready loaded by default.
enum bps::Access |
enum bps::Alignment |
General alignment.
enum bps::Barcode |
Type of the bar code.
enum bps::Direction |
enum bps::PixmapSizing |
enum bps::Rotation |
enum bps::Status |
Boolean 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.
String bps::dateToTimestampString | ( | Date | aDate | ) |
Format date object to a timestamp string.
aDate | The date/time value. |
Number bps::decryptPin | ( | Number | aUserid, |
Number | aPin | ||
) |
Decrypt a user PIN.
PIN's are stored in an encrypted manner within the t_users table.
aUserid | The user id. |
aPin | The encrypted PIN. |
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].
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.
Example 1: Relative path in environment variable
aName | Logs |
Environment variable BPS_LOGS= | mylogs |
BPS installation directory | C:\Program Files\IBK BPS 2.0.0 |
Returned path | C:/Program Files/IBK BPS 2.0.0/mylogs |
Example 2: Relative path in bps.conf
aName | Logs |
Environment variable BPS_LOGS= | (not found) |
bps.conf: [Paths] ... Logs= | logs |
BPS installation directory | C:\Program Files\IBK BPS 2.0.0 |
Returned path | C:/Program Files/IBK BPS 2.0.0/logs |
[in] | aName | Logical path name, for example: Logs , Plugins or Scripts . Get the BPS installation directory if aName is empty. |
String bps::dump | ( | Mixed | aValue, |
Number | aMaxDepth = 100 |
||
) |
Format any variable (except functions) for debug output.
The formatted text is in ECMAscrip syntax, so basically it could be used as script source.
[in] | aValue | Any object, array or scalar variable to dump. |
[in] | aMaxDepth | Maximum recursion depth. Use 1 to list top level scalars of a object or array only. |
Number bps::encryptPin | ( | Number | aUserid, |
Number | aPin | ||
) |
Encrypt a user PIN.
PIN's are stored in an encrypted manner within the t_users table.
aUserid | The user id. |
aPin | The unencrypted PIN. |
Format an Error for display.
In case aError is an instance of Error, the message text is returned with the stack traceback information appended in human readable format. If aError if not instance or Error, its string representation is returned.
[in] | aError | An object, possibly an instance of Error. |
String bps::formatNiceNumber | ( | Number | aValue | ) |
Format a large integer number for better human readability, for example 1234567 becomes 1'234'567.
aValue | The value to process |
Boolean 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.
void bps::lerror | ( | ... | ) |
Print to log error output.
Print the expressions (applying toString() if necessary) to the console error output (stderr), followed by a newline. Lines will be indented by logLevel * 2 spaces. In case a logFile was opened, the output is also appended to the logFile.
Multiple expressions will be separated by a blank.
void bps::lfile | ( | ... | ) |
Print lo log file only.
Append the expressions (applying toString() if necessary) to the logFile, followed by a newline. Lines will be indented by logLevel * 2 spaces.
Multiple expressions will be separated by a blank.
void bps::log | ( | ... | ) |
Print to log output.
Print the argument expressions (applying toString() if necessary) to the console standard output (stdout), followed by a newline. Lines will be indented by logLevel * 2 spaces. In case a logFile was opened, the output is also appended to the logFile.
Multiple expressions will be separated by a blank.
void bps::logClose | ( | ) |
Close the log file.
Writes the ending date/time and the elapsed time into the log file in case one is opened.
void bps::logOpen | ( | ) |
Opens the log file and writes the script name and starting date/time into it.
The log directory is determined as:
bps.conf
file is present in the applicationDirPath, the variables Prefix
and Logs
in the Paths
section of the the file are recognized. The Prefix
is only used if Logs
is not an absolute path. Prefix
is ignored because Logs
is an absolute path: bps.conf
file is present, or the Prefix
or Logs
settings are not found in the Paths
section, Prefix
will default to applicationDirPath and Logs
will default to "logs"
.The filename of the log will be the same as the script name, but with the extension .log instead of .js
void bps::msleep | ( | Number | aMilliseconds | ) |
Sleep for the time specified in milliseconds.
No event processing will be done so the application will be unresponsive. Use mwait() in case to for non-blocking sleeping.
aMilliseconds | Number of milliseconds to sleep. |
void bps::mwait | ( | Number | aMilliseconds | ) |
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.
aMilliseconds | The time to wait. |
String bps::personalFolder | ( | ) |
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().
Send data to a printer.
aPrinterName | The name of the printer. May also be a network printer name such as "\\\\server\\printer". |
aDocName | The 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". |
aData | The data to send. |
aCodec | The codec used for text encoding. Default = Latin1. See https://doc.qt.io/qt-5/qtextcodec.html for examle "IBM 850". |
Send a file to a printer.
The printer may be any local or network printer known to the workstation.
aPrinterName | The name of the printer. May also be a network printer name such as "\\\\server\\printer". |
aDocName | The 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". |
aFileName | The name of the file to send. |
Number bps::round | ( | Number | aValue, |
Number | aDigits = 3 |
||
) |
Round off as per standard commercial practice.
[in] | aValue | The value to round off. |
[in] | aDigits | Number of digits behind the decimal point. |
void bps::sleep | ( | Number | aSeconds | ) |
Sleep for the time specified in seconds.
No event processing will be done so the application will be unresponsive. Use wait() in case to for non-blocking sleeping.
aSeconds | Number of seconds to sleep. |
A string formatting function.
The placeholders in the format string are marked by "%" and are followed by one or more of these elements, in this order:
You can also swap the arguments. That is, the order of the placeholders doesn't have to match the order of the arguments. You can do that by simply indicating in the format string which arguments the placeholders refer to:
You can repeat the placeholders without having to increase the number of arguments.
aFormat | The string that must be left padded. |
aArgs | An arbitrary number of arguments.The |
Date bps::timestampStringToDate | ( | String | aTimestampString | ) |
Parses a date/time encoded in text with format YYYYMMDDHHMMSS.
aTimestampString | The timestamp string to process. |
void bps::usleep | ( | Number | aMicroseconds | ) |
Sleep for the time specified in microseconds.
aMicroseconds | Number of microseconds to sleep. |
void bps::wait | ( | Number | aSeconds | ) |
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.
aSeconds | The time to wait. |
String bps::logFile |
The log file name used by bps.log(), bps.lerror() and bps.lfile().
When empty (default), bps.log() and bps.lerror() will only create console ouput, while bps.lfile() will throw an bps.Error.
Number bps::logLevel |
The level to indent the log outputs by.
Log outputs created by bps.log(), bps.lerror() and bps.lfile() will be indented by bps.logLevel * 2 spaces.