Documents > BPS V2 C++ API
BpsEan128 Class Reference

Parses and composes EAN128 records. More...

#include <bpsean128.h>

List of all members.

Public Types

enum  Status {
  S_OK,
  S_Error
}
 Status of record and elements. More...

Public Member Functions

void addElement (const QString &aAi, const QString &aData)
 Add another element to the record.
QString ai (int aIndex) const
 Get the application identifier of an element.
 BpsEan128 ()
 Construct an empty EAN128 object to compose a record.
 BpsEan128 (const QString &aString)
 Construct a EAN128 from parsing a string with the scanned content.
 BpsEan128 (const BpsEan128 &aOther)
 Copy constructor.
QString code () const
int count () const
QString data (int aIndex) const
 Get the element content.
void fixup ()
 Fixup the record by removing elements in error, and recalculate the final checksum.
bool gs (int aIndex) const
 Get the GS (FNC1) requirement of an element.
int indexOf (const QString &aAi, int aFrom=0)
 Returns the index of the first element with this AI.
int indexOf (const QRegExp &aAiRegExp, int aFrom=0)
 Returns the index of the first element matching the search pattern by QRegExp::exactMatch(ai(index)).
BpsEan128operator= (const BpsEan128 &aOther)
 Assignment.
void setCode (const QString &aCode)
 Set the code and parse it.
Status status () const
Status status (int aIndex) const
 Get an elements status.
QString text () const

Detailed Description

Parses and composes EAN128 records.

See chapter Barcode scanning in the manual for list of supported AI's.


Member Enumeration Documentation

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.


Constructor & Destructor Documentation

BpsEan128::BpsEan128 ( const QString &  aString)

Construct a EAN128 from parsing a string with the scanned content.

Parameters:
[in]aStringThe string with the code.
BpsEan128::BpsEan128 ( const BpsEan128 aOther)

Copy constructor.

Parameters:
[in]aOtherThe other EAN128 to copy.

Member Function Documentation

void BpsEan128::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:
[in]aAiThe AI of the element.
[in]aDataThe element content.
QString BpsEan128::ai ( int  aIndex) const

Get the application identifier of an element.

Parameters:
[in]aIndexThe element index in range 0 ... count()-1.
Returns:
The AI of the element.
QString BpsEan128::code ( ) const
Returns:
The plain record code, without AI braces.
int BpsEan128::count ( ) const
Returns:
Number of elements in the record.
QString BpsEan128::data ( int  aIndex) const

Get the element content.

Parameters:
[in]aIndexThe element index in range 0 ... count()-1.
Returns:
Data of the element.
bool BpsEan128::gs ( int  aIndex) const

Get the GS (FNC1) requirement of an element.

Parameters:
[in]aIndexThe element index in range 0 ... count()-1.
Returns:
True: A GS (FNC1) must be inserted before next element.
int BpsEan128::indexOf ( const QString &  aAi,
int  aFrom = 0 
)

Returns the index of the first element with this AI.

Parameters:
[in]aAiThe AI searched.
[in]aFromThe index to start searching from.
Returns:
Index of the found element, or -1 if no such element found.
int BpsEan128::indexOf ( const QRegExp &  aAiRegExp,
int  aFrom = 0 
)

Returns the index of the first element matching the search pattern by QRegExp::exactMatch(ai(index)).

Parameters:
[in]aAiRegExpRegular expression describing the AI to find.
[in]aFromThe index to start searching from.
Returns:
Index of the found element, or -1 if no such element found.
BpsEan128& BpsEan128::operator= ( const BpsEan128 aOther)

Assignment.

Parameters:
[in]aOtherThe other record to copy.
Returns:
Reference to this object.
void BpsEan128::setCode ( const QString &  aCode)

Set the code and parse it.

Parameters:
[in]aCodeThe code to set and parse.
Status BpsEan128::status ( ) const
Returns:
The current record status.
Status BpsEan128::status ( int  aIndex) const

Get an elements status.

Parameters:
[in]aIndexThe element index in range 0 ... count()-1.
Returns:
Status of the element.
QString BpsEan128::text ( ) const
Returns:
The code with braces around the AI's as human friendly representation.

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