NetSim 1.0.0
An educational network simulation software for students
Loading...
Searching...
No Matches
headerAttribute.h
Go to the documentation of this file.
1#ifndef HEADERATTRIBUTE_H
2#define HEADERATTRIBUTE_H
3
7
8#include <QString>
9#include <QVector>
10
11namespace NetSim {
12
15
22public:
30 HeaderAttribute(const QString &name, quint32 sizeInBit,
31 const QVector<quint8> &content);
32
40 HeaderAttribute(const QString &name, quint32 sizeInBit, quint8 content);
41
49 HeaderAttribute(const QString &name, quint32 sizeInBit, quint16 content);
50
58 HeaderAttribute(const QString &name, quint32 sizeInBit, quint32 content);
59
67 HeaderAttribute(const QString &name, quint32 sizeInBit, quint64 content);
68
76 HeaderAttribute(const QString &name, quint32 sizeInBit,
77 const QString &content);
78
82 HeaderAttribute() = default;
83
89 QString name() const;
90
96 quint32 size() const;
97
103 quint64 toInt() const;
104
110 QVector<quint8> toArray() const;
111
117 void setContent(QVector<quint8> content);
118
119private:
120 QString m_name{};
121 quint32 m_sizeInBit{0};
122 QVector<quint8> m_content{};
123};
124
125} // namespace NetSim
126
127#endif // HEADERATTRIBUTE_H
Class representing an attribute of a header.
Definition headerAttribute.h:21
QVector< quint8 > toArray() const
Converts the content to a byte array.
Definition headerAttribute.cpp:68
QString name() const
Returns the name of the attribute.
Definition headerAttribute.cpp:52
quint32 size() const
Returns the size of the attribute content in bits.
Definition headerAttribute.cpp:54
HeaderAttribute()=default
Default constructor.
quint64 toInt() const
Converts the content to an integer.
Definition headerAttribute.cpp:56
void setContent(QVector< quint8 > content)
Sets the content using a byte array.
Definition headerAttribute.cpp:70
Definition logger.h:12