BPS Script API  2.24.4
bps::MaskProcessor Class Reference

This class implements the BPS mask validator for input text. More...

Public Member Functions

QString fixup (const QString &aInput) const
 Fix up the input if possible. More...
 
Boolean isValid (QString &aInput) const
 Check for valid input. More...
 
 MaskProcessor ()
 Default constructor. More...
 
 MaskProcessor (String aMask)
 Constructor taking an initiam mask as argument. More...
 

Properties

String mask
 The current mask. More...
 
Number maxLength
 The maximum length in characters. More...
 
Number minLength
 The minimum length in characters. More...
 

Detailed Description

This class implements the BPS mask validator for input text.

A mask is a QString containing the characters defined in the following table.

  • Upper case mask chars stand for mandatory input.
  • Lower case mask chars are optional inputs which may be skipped at input.
  • Mask characters can be repeated by appending the count in curly brackets, for example x{5} is equivalent to xxxxx
Mask charAllowed input charsNotes
A,aA-Z a-zASCII alphabetic characters
C,cA-Z a-z 0-9ASCII alphabetic characters and digits
W,wA-Z a-z 0-9 - _ $Words
F,fA-Z a-z 0-9 - _ $ .Filenames (words and dots)
G,gA-Z a-z 0-9 - _ $ . spaceFilenames with spaces
P,pA-Z a-z 0-9 - _ $ . /Pathnames (filenames and slashes)
Q,qA-Z a-z 0-9 - _ $ . / spacePathnames with spaces
X,xAll printable charactersNo whitespace
Y,yAll printable charactersIncluding whitespace
S,s+ -Plus or minus sign
D,d0-9Decimal digits
B,b0 1Binary digits
H,h0-9 a-f A-FHexadecimal digits
N,n0-9Formatted numbers:
Upper case N's are interpreted as minimum number of digits to enter during input, followed
by lower case n's to complete to the maximum number of digits.
So NnnNNnn will be interpreted as two numbers, where the first is
3 digits long and 1 must be entered at least, and the second is
4 digits while 2 of them must be entered at least.
> Convert following input to upper case.
< Convert following input to lower case.
! Switch off case conversion.
\ Do not interpret the next char as mask, use it as filler.
Other charFillerInsert exactly as written in mask.
The user can omit input, it will be inserted automatically.

Examples:

MaskUser inputResult after fixup
nnnn.nnn.nnn.nn11000.000.000.00
1.1.12.50001.001.012.05
.23..60000.023.000.06
 0000.000.000.00
1234561234.056.000.00
NNnnNNNnnn10001000000
123451234000005
1234561234000056
123456781234005678
Ddd-Bnn1a1-A00
10k510-K05

Constructor & Destructor Documentation

◆ MaskProcessor() [1/2]

bps::MaskProcessor::MaskProcessor ( )

Default constructor.

The initial mask is empty.

◆ MaskProcessor() [2/2]

bps::MaskProcessor::MaskProcessor ( String  aMask)

Constructor taking an initiam mask as argument.

Parameters
aMaskThe initial mask to use.

Member Function Documentation

◆ fixup()

QString bps::MaskProcessor::fixup ( const QString &  aInput) const

Fix up the input if possible.

This will remove all invalid characters and format all n/N sequences.

Parameters
aInputThe unprocessed string
Returns
The fixed up string.

◆ isValid()

Boolean bps::MaskProcessor::isValid ( QString &  aInput) const

Check for valid input.

Parameters
aInputThe input to check.
Returns
True if the input is valid.

Property Documentation

◆ mask

String bps::MaskProcessor::mask
readwrite

The current mask.

 

◆ maxLength

Number bps::MaskProcessor::maxLength
read

The maximum length in characters.

Gets computed when mask is set.

◆ minLength

Number bps::MaskProcessor::minLength
read

The minimum length in characters.

Gets computed when mask is set.


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