BPS C++ API  2.24.4
bpsgs1data.h
Go to the documentation of this file.
1 
4 #ifndef BPSGS1DATA_H
5 #define BPSGS1DATA_H
6 
7 #include "bpscore_global.h"
8 #include <QRegExp>
9 
16 {
18 
19 public:
20 
24  enum Status {
25  S_OK,
26  S_Error
27  };
28 
33 
38  BpsGs1Data(const QString& aString);
39 
44  BpsGs1Data(const BpsGs1Data& aOther);
45 
46  virtual ~BpsGs1Data();
47 
53  BpsGs1Data& operator=(const BpsGs1Data& aOther);
54 
58  Status status() const;
59 
63  QString code() const;
64 
69  void setCode(const QString& aCode);
70 
74  void clear();
75 
79  void fixup();
80 
84  QString text() const;
85 
89  int count() const;
90 
96  QString ai(int aIndex) const;
97 
103  QString data(int aIndex) const;
104 
110  bool gs(int aIndex) const;
111 
117  Status status(int aIndex) const;
118 
126  void addElement(const QString& aAi, const QString& aData);
127 
134  int indexOf(const QString& aAi, int aFrom = 0);
135 
142  int indexOf(const QRegExp& aAiRegExp, int aFrom = 0);
143 };
144 
145 #endif // BPSGS1DATA_H
Public include file for BPS CORE library macros.
#define BPSCORE_EXPORT
Declare class to be an import from the shared library.
Definition: bpscore_global.h:22
#define BPS_PRIVATE(Class)
Declare pointer to private object in a public class.
Definition: bpsglobals.h:102
Parses and composes GS1 data records with AI elements.
Definition: bpsgs1data.h:16
QString text() const
int count() const
void clear()
Clear the record.
BpsGs1Data(const BpsGs1Data &aOther)
Copy constructor.
void fixup()
Fixup the record by removing elements in error, and recalculate the final checksum.
Status status() const
int indexOf(const QString &aAi, int aFrom=0)
Returns the index of the first element with this AI.
QString data(int aIndex) const
Get the element content.
bool gs(int aIndex) const
Get the GS (FNC1) requirement of an element.
void addElement(const QString &aAi, const QString &aData)
Add another element to the record.
BpsGs1Data & operator=(const BpsGs1Data &aOther)
Assignment.
Status status(int aIndex) const
Get an elements status.
int indexOf(const QRegExp &aAiRegExp, int aFrom=0)
Returns the index of the first element matching the search pattern by QRegExp::exactMatch(ai(index)).
BpsGs1Data(const QString &aString)
Construct a GS1 data object from parsing a string with the scanned content.
void setCode(const QString &aCode)
Set the code and parse it.
Status
Status of record and elements.
Definition: bpsgs1data.h:24
@ S_OK
The record or element is OK.
Definition: bpsgs1data.h:25
QString code() const
BpsGs1Data()
Construct an empty GS1 data object to compose a record.
QString ai(int aIndex) const
Get the application identifier of an element.