PLCnext API Documentation 25.0.2.69
Public Types | Public Member Functions | List of all members
Arp::Base::Rsc::Commons::RscStructReader Class Reference

Utility class to read dynamic structs. More...

#include <RscStructReader.hpp>

Public Types

using ReadFieldFunction = RscVariantBase::ReadFieldFunction
 The prototype of the delegate to read a field.
 

Public Member Functions

 RscStructReader (const RscVariantBase &structVariant)
 Constructs a RscStructReader instance. More...
 
size_t GetFieldCount (void) const
 Gets the field count of the struct to read. More...
 
template<class T >
void ReadNextField (T &result)
 Reads the next primitive field of the struct. More...
 
template<int N>
void ReadNextField (RscString< N > &result)
 Reads the next string field of the struct. More...
 
template<int N>
void ReadNextField (RscVariant< N > &result)
 Reads the next field of the struct. This operation is used if the field is an object, an array, a struct or unknown. More...
 

Detailed Description

Utility class to read dynamic structs.

This class uses the struct information stored in RscVariant, which is passed as argument to the constructor.

Constructor & Destructor Documentation

◆ RscStructReader()

Arp::Base::Rsc::Commons::RscStructReader::RscStructReader ( const RscVariantBase structVariant)
explicit

Constructs a RscStructReader instance.

Parameters
structVariantThe RscVariant value representing a dynamic struct.

Member Function Documentation

◆ GetFieldCount()

size_t Arp::Base::Rsc::Commons::RscStructReader::GetFieldCount ( void  ) const

Gets the field count of the struct to read.

Returns
The field count of the struct.

◆ ReadNextField() [1/3]

template<int N>
void Arp::Base::Rsc::Commons::RscStructReader::ReadNextField ( RscString< N > &  result)
inline

Reads the next string field of the struct.

Parameters
resultThe resulting string.

◆ ReadNextField() [2/3]

template<int N>
void Arp::Base::Rsc::Commons::RscStructReader::ReadNextField ( RscVariant< N > &  result)
inline

Reads the next field of the struct. This operation is used if the field is an object, an array, a struct or unknown.

Parameters
resultThe resulting variant value.
Template Parameters
NDetermines the maximum string size of string array elements. If set to 0 strings are not supported.

◆ ReadNextField() [3/3]

template<class T >
void Arp::Base::Rsc::Commons::RscStructReader::ReadNextField ( T &  result)
inline

Reads the next primitive field of the struct.

The type of the field shall be known. This operation works just for primitive types.

Parameters
resultThe resulting value.
Template Parameters
TThe type of the value to read, which might be deduced by compiler.

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