NetSim
1.0.0
An educational network simulation software for students
Loading...
Searching...
No Matches
NetSim
src
protocols
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
11
namespace
NetSim
{
12
15
21
class
HeaderAttribute
{
22
public
:
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
119
private
:
120
QString m_name{};
121
quint32 m_sizeInBit{0};
122
QVector<quint8> m_content{};
123
};
124
125
}
// namespace NetSim
126
127
#endif
// HEADERATTRIBUTE_H
NetSim::HeaderAttribute
Class representing an attribute of a header.
Definition
headerAttribute.h:21
NetSim::HeaderAttribute::toArray
QVector< quint8 > toArray() const
Converts the content to a byte array.
Definition
headerAttribute.cpp:68
NetSim::HeaderAttribute::name
QString name() const
Returns the name of the attribute.
Definition
headerAttribute.cpp:52
NetSim::HeaderAttribute::size
quint32 size() const
Returns the size of the attribute content in bits.
Definition
headerAttribute.cpp:54
NetSim::HeaderAttribute::HeaderAttribute
HeaderAttribute()=default
Default constructor.
NetSim::HeaderAttribute::toInt
quint64 toInt() const
Converts the content to an integer.
Definition
headerAttribute.cpp:56
NetSim::HeaderAttribute::setContent
void setContent(QVector< quint8 > content)
Sets the content using a byte array.
Definition
headerAttribute.cpp:70
NetSim
Definition
logger.h:12
Generated by
1.9.7