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

Utility class to write dynamic structs. More...

#include <RscStructWriter.hpp>

Public Types

using WriteElementFunction = RscVariantBase::WriteElementFunction
 The prototype of the delegate to write a field.
 

Public Member Functions

 RscStructWriter (const RscVariantBase &structVariant)
 Constructs a RscStructWriter instance. More...
 
size_t GetFieldCount (void) const
 Gets the field count of the struct to write. More...
 
template<class T >
void WriteNextField (const T &value)
 Writes the next field of the struct. This operation is used if the field is an object, an array, a struct or unknown. More...
 
template<int N>
void WriteNextField (const RscString< N > &value)
 Writes the next string field of the struct. More...
 
template<int N>
void WriteNextField (const RscVariant< N > &value)
 Writes 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 write dynamic structs.

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

Constructor & Destructor Documentation

◆ RscStructWriter()

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

Constructs a RscStructWriter instance.

Parameters
structVariantThe RscVariant value representing a dynamic struct.
Template Parameters
NThe maximal length of a string, excluding NUL terminator, if one of the struct fields is of type string.

Member Function Documentation

◆ GetFieldCount()

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

Gets the field count of the struct to write.

Returns
The field count of the struct.

◆ WriteNextField() [1/3]

template<int N>
void Arp::Base::Rsc::Commons::RscStructWriter::WriteNextField ( const RscString< N > &  value)
inline

Writes the next string field of the struct.

Parameters
valueThe string to write.
Template Parameters
NDetermines the maximum string size of string array elements. If set to 0 strings are be supported.

◆ WriteNextField() [2/3]

template<int N>
void Arp::Base::Rsc::Commons::RscStructWriter::WriteNextField ( const RscVariant< N > &  value)
inline

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

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

◆ WriteNextField() [3/3]

template<class T >
void Arp::Base::Rsc::Commons::RscStructWriter::WriteNextField ( const T &  value)
inline

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

Parameters
valueThe resulting variant value.

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