NetSim 1.0.0
An educational network simulation software for students
Loading...
Searching...
No Matches
Public Member Functions | List of all members
NetSim::HeaderAttribute Class Reference

Class representing an attribute of a header. More...

#include <headerAttribute.h>

Public Member Functions

 HeaderAttribute (const QString &name, quint32 sizeInBit, const QVector< quint8 > &content)
 Constructor for QVector<quint8> content.
 
 HeaderAttribute (const QString &name, quint32 sizeInBit, quint8 content)
 Constructor for quint8 content.
 
 HeaderAttribute (const QString &name, quint32 sizeInBit, quint16 content)
 Constructor for quint16 content.
 
 HeaderAttribute (const QString &name, quint32 sizeInBit, quint32 content)
 Constructor for quint32 content.
 
 HeaderAttribute (const QString &name, quint32 sizeInBit, quint64 content)
 Constructor for quint64 content.
 
 HeaderAttribute (const QString &name, quint32 sizeInBit, const QString &content)
 Constructor for QString content.
 
 HeaderAttribute ()=default
 Default constructor.
 
QString name () const
 Returns the name of the attribute.
 
quint32 size () const
 Returns the size of the attribute content in bits.
 
quint64 toInt () const
 Converts the content to an integer.
 
QVector< quint8 > toArray () const
 Converts the content to a byte array.
 
void setContent (QVector< quint8 > content)
 Sets the content using a byte array.
 

Detailed Description

Class representing an attribute of a header.

Constructor & Destructor Documentation

◆ HeaderAttribute() [1/7]

HeaderAttribute::HeaderAttribute ( const QString &  name,
quint32  sizeInBit,
const QVector< quint8 > &  content 
)

Constructor for QVector<quint8> content.

Parameters
nameAttribute name.
sizeInBitSize of the content in bits.
contentContent in bytes.

◆ HeaderAttribute() [2/7]

HeaderAttribute::HeaderAttribute ( const QString &  name,
quint32  sizeInBit,
quint8  content 
)

Constructor for quint8 content.

Parameters
nameAttribute name.
sizeInBitSize of the content in bits.
contentSingle byte content.

◆ HeaderAttribute() [3/7]

HeaderAttribute::HeaderAttribute ( const QString &  name,
quint32  sizeInBit,
quint16  content 
)

Constructor for quint16 content.

Parameters
nameAttribute name.
sizeInBitSize of the content in bits.
contentDouble byte content.

◆ HeaderAttribute() [4/7]

HeaderAttribute::HeaderAttribute ( const QString &  name,
quint32  sizeInBit,
quint32  content 
)

Constructor for quint32 content.

Parameters
nameAttribute name.
sizeInBitSize of the content in bits.
contentFour byte content.

◆ HeaderAttribute() [5/7]

HeaderAttribute::HeaderAttribute ( const QString &  name,
quint32  sizeInBit,
quint64  content 
)

Constructor for quint64 content.

Parameters
nameAttribute name.
sizeInBitSize of the content in bits.
contentEight byte content.

◆ HeaderAttribute() [6/7]

HeaderAttribute::HeaderAttribute ( const QString &  name,
quint32  sizeInBit,
const QString &  content 
)

Constructor for QString content.

Parameters
nameAttribute name.
sizeInBitSize of the content in bits.
contentContent as QString.

◆ HeaderAttribute() [7/7]

NetSim::HeaderAttribute::HeaderAttribute ( )
default

Default constructor.

Member Function Documentation

◆ name()

QString HeaderAttribute::name ( ) const

Returns the name of the attribute.

Return values
QStringName of the attribute.

◆ setContent()

void HeaderAttribute::setContent ( QVector< quint8 >  content)

Sets the content using a byte array.

Parameters
contentContent to be set.

◆ size()

quint32 HeaderAttribute::size ( ) const

Returns the size of the attribute content in bits.

Return values
quint32Size in bits.

◆ toArray()

QVector< quint8 > HeaderAttribute::toArray ( ) const

Converts the content to a byte array.

Return values
QVector<quint8>Content as a byte array.
Here is the caller graph for this function:

◆ toInt()

quint64 HeaderAttribute::toInt ( ) const

Converts the content to an integer.

Return values
quint64Content as an integer.

The documentation for this class was generated from the following files: