The Qt OPC UA data type generator

Starting with Qt 6.7, Qt OPC UA comes with a data type generator named qopcuaxmldatatypes2cpp which generates Qt OPC UA compatible C++ enumerations and data classes from enums and structured types in .bsd files.

The generator is a command line tool which can be controlled by the following argument:

Long Short 目的
–input -i A .bsd file for which all contained enum and struct types will be generated. Can be used more than once to generate code for multiple models.
–dependencyinput -d A dependency input .bsd file where only types required by a struct from an input file passed via —input will be generated. Can be used more than once to accommodate models with dependencies to multiple other models.
–output -o The output directory where the generated files will be placed.
–prefix -p The prefix for the generated file, enum and class names. The default value is GeneratedOpcUa .

The following files are generated for each run:

  • One .h file containing a namespace with all enumerated types
  • One .h and one .cpp file for each structured type
  • One .h and one .cpp file containing encoding and decoding methods