summaryrefslogtreecommitdiffstats
path: root/ui/qt/utils/field_information.h
blob: b0001b716c08ef06f5b83b33ec18ed45e13feafe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/** @file
 *
 * Wireshark - Network traffic analyzer
 * By Gerald Combs <gerald@wireshark.org>
 * Copyright 1998 Gerald Combs
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#ifndef FIELD_INFORMATION_H_
#define FIELD_INFORMATION_H_

#include <config.h>

#include <epan/proto.h>

#include <ui/qt/utils/proto_node.h>
#include "data_printer.h"

#include <QObject>

class FieldInformation : public QObject, public IDataPrintable
{
    Q_OBJECT
    Q_INTERFACES(IDataPrintable)

public:

    struct HeaderInfo
    {
        QString name;
        QString description;
        QString abbreviation;
        bool isValid;
        enum ftenum type;
        int parent;
        int id;
    };

    struct Position
    {
        int start;
        int length;
    };

    explicit FieldInformation(field_info * fi, QObject * parent = Q_NULLPTR);
    explicit FieldInformation(const ProtoNode * node, QObject * parent = Q_NULLPTR);

    bool isValid() const;
    bool isLink() const ;

    field_info * fieldInfo() const;

    HeaderInfo headerInfo() const;
    Position position() const;
    Position appendix() const;

    void setParentField(field_info * fi);
    int treeType();
    FieldInformation * parentField() const;
    bool tvbContains(FieldInformation *);
    unsigned flag(unsigned mask);
    const QString moduleName();
    QString toString();
    QString url();

    const QByteArray printableData();

private:

    field_info * fi_;
    field_info * parent_fi_;
};


#endif // FIELD_INFORMATION_H_