Parses and composes GS1 data records with AI elements.
More...
#include <bpsgs1data.h>
Parses and composes GS1 data records with AI elements.
See chapter Barcode scanning in the manual for list of supported AI's.
◆ Status
Status of record and elements.
| Enumerator |
|---|
| S_OK | The record or element is OK.
|
| S_Error | One or more of the elements are incomplete, have invalid characters, or no valid AI found.
|
◆ BpsGs1Data() [1/2]
| BpsGs1Data::BpsGs1Data |
( |
const QString & |
aString | ) |
|
Construct a GS1 data object from parsing a string with the scanned content.
- Parameters
-
| aString | The string with the code. |
◆ BpsGs1Data() [2/2]
| BpsGs1Data::BpsGs1Data |
( |
const BpsGs1Data & |
aOther | ) |
|
Copy constructor.
- Parameters
-
| aOther | The other GS1 data object to copy. |
◆ addElement()
| void BpsGs1Data::addElement |
( |
const QString & |
aAi, |
|
|
const QString & |
aData |
|
) |
| |
Add another element to the record.
Fixup will be run in advance before adding the new element. Status might be S_Error after adding though, when validation of the new element fails.
- Parameters
-
| aAi | The AI of the element. |
| aData | The element content. |
◆ ai()
| QString BpsGs1Data::ai |
( |
int |
aIndex | ) |
const |
Get the application identifier of an element.
- Parameters
-
| aIndex | The element index in range 0 ... count()-1. |
- Returns
- The AI of the element.
◆ code()
- Returns
- The plain record code, without AI braces.
◆ count()
| int BpsGs1Data::count |
( |
| ) |
const |
- Returns
- Number of elements in the record.
◆ data()
| QString BpsGs1Data::data |
( |
int |
aIndex | ) |
const |
Get the element content.
- Parameters
-
| aIndex | The element index in range 0 ... count()-1. |
- Returns
- Data of the element.
◆ gs()
| bool BpsGs1Data::gs |
( |
int |
aIndex | ) |
const |
Get the GS (FNC1) requirement of an element.
- Parameters
-
| aIndex | The element index in range 0 ... count()-1. |
- Returns
- True: A GS (FNC1) must be inserted before next element.
◆ indexOf() [1/2]
| int BpsGs1Data::indexOf |
( |
const QRegExp & |
aAiRegExp, |
|
|
int |
aFrom = 0 |
|
) |
| |
Returns the index of the first element matching the search pattern by QRegExp::exactMatch(ai(index)).
- Parameters
-
| aAiRegExp | Regular expression describing the AI to find. |
| aFrom | The index to start searching from. |
- Returns
- Index of the found element, or -1 if no such element found.
◆ indexOf() [2/2]
| int BpsGs1Data::indexOf |
( |
const QString & |
aAi, |
|
|
int |
aFrom = 0 |
|
) |
| |
Returns the index of the first element with this AI.
- Parameters
-
| aAi | The AI searched. |
| aFrom | The index to start searching from. |
- Returns
- Index of the found element, or -1 if no such element found.
◆ operator=()
Assignment.
- Parameters
-
| aOther | The other record to copy. |
- Returns
- Reference to this object.
◆ setCode()
| void BpsGs1Data::setCode |
( |
const QString & |
aCode | ) |
|
Set the code and parse it.
- Parameters
-
| aCode | The code to set and parse. |
◆ status() [1/2]
| Status BpsGs1Data::status |
( |
| ) |
const |
- Returns
- The current record status.
◆ status() [2/2]
| Status BpsGs1Data::status |
( |
int |
aIndex | ) |
const |
Get an elements status.
- Parameters
-
| aIndex | The element index in range 0 ... count()-1. |
- Returns
- Status of the element.
◆ text()
- Returns
- The code with braces around the AI's as human friendly representation.
The documentation for this class was generated from the following file: