1// Copyright (C) 2023 basysKom GmbH, opensource@basyskom.com
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#pragma once
5
6#include "xmlelement.h"
7
8class Field : public XmlElement
9{
10public:
11 Field(const QString &name, const QString &typeName, const QString &lengthField = QString());
12 ~Field() override = default;
13
14 void print() const override;
15 virtual void accept(Visitor *visitor) override;
16
17 QString typeName() const;
18 QString typeNameSecondPart() const;
19 void setTypeName(const QString &typeName);
20
21 QString lengthField() const;
22 void setLengthField(const QString &lengthField);
23
24 bool hasLengthField() const;
25 void setHasLengthField(bool hasLengthField);
26
27 bool needContainer() const;
28 void setNeedContainer(bool needContainer);
29
30 bool isInStructuredTypeBitMask() const;
31 void setIsInStructuredTypeBitMask(bool isInStructuredTypeBitMask);
32
33 int length() const;
34 void setLength(int length);
35
36 QString switchField() const;
37 void setSwitchField(const QString &switchField);
38
39 int switchValue() const;
40 void setSwitchValue(int switchValue);
41
42 bool isUnion() const;
43 void setIsUnion(bool isUnion);
44
45 bool recursive() const;
46 void setRecursive(bool recursive);
47
48 bool isEnum() const;
49 void setIsEnum(bool newIsEnum);
50private:
51 bool m_hasLengthField{false};
52 bool m_needContainer{false};
53 bool m_isInStructuredTypeBitMask{false};
54 bool m_isUnion{false};
55 int m_length;
56 int m_switchValue{0};
57 bool m_recursive{false};
58 bool m_isEnum{false};
59 QString m_lengthField;
60 QString m_switchField;
61 QString m_typeName;
62};
63

Provided by KDAB

Privacy Policy
Start learning QML with our Intro Training
Find out more

source code of qtopcua/tools/datatypecodegenerator/field.h