8#include "Arp/Base/Rsc/Commons/RscTypeInfo.hpp"
9#include "Arp/Base/Rsc/Commons/RscVariantBase.hpp"
10#include "Arp/Base/Commons/Exceptions/InvalidOperationException.hpp"
12namespace Arp::Base::Rsc::Commons
32 size_t GetFieldCount(
void)
const;
35 template<
class T>
void WriteNextField(
const T& value);
36 template<
int N>
void WriteNextField(
const RscString<N>& value);
37 template<
int N>
void WriteNextField(
const RscVariant<N>& value);
67 this->writeFieldFunction(type, currentVariant);
81 if(value.
GetType() == RscType::Array)
83 this->writeFieldFunction(RscType::Array, value);
84 if(this->pWriter ==
nullptr)
90 this->SetWriterTo(value);
93 else if (value.
GetType() == RscType::Struct)
95 this->writeFieldFunction(RscType::Struct, value);
96 if (this->pWriter ==
nullptr)
102 this->SetWriterTo(value);
107 this->writeFieldFunction(value.
GetType(), value);
120 this->writeFieldFunction(RscType::String, variantField);
This exception is thrown when an operation cannot be executed because the related state is invalid.
Definition: InvalidOperationException.hpp:16
Contains a static string with string lentgh up to N characters. The string shall be null terminated.
Definition: RscString.hxx:24
Contains information to marshal structs.
Definition: RscStructInfo.hpp:17
Utility class to write dynamic structs.
Definition: RscStructWriter.hpp:24
RscVariantBase::WriteElementFunction WriteElementFunction
The prototype of the delegate to write a field.
Definition: RscStructWriter.hpp:26
void WriteNextField(const T &value)
Writes the next field of the struct. This operation is used if the field is an object,...
Definition: RscStructWriter.hpp:58
static constexpr RscType GetFrom(const T &)
Gets the RscType of the as argument passed parameter.
Definition: RscTypeDeduction.hpp:77
static bool IsStringType(RscType type)
Determines if the supplied RscType is a string type.
Definition: RscTypeInfo.cpp:184
static bool IsSimpleType(RscType type)
Determines if the supplied RscType is a simple type.
Definition: RscTypeInfo.cpp:141
This class is a base class of template class RscVariant.
Definition: RscVariantBase.hpp:40
RscType GetType(void) const
Gets the RscType of the contained element
Definition: RscVariantBase.cpp:290
std::function< void(RscType elementType, const RscVariantBase &value)> WriteElementFunction
The write element delegate type.
Definition: RscVariantBase.hpp:47
void SetWriteElementFunction(WriteElementFunction &function) const
Sets the element write function.
Definition: RscVariantBase.cpp:768
Rsc class for variant data types like primitive data type, strings or information about arrays or str...
Definition: RscVariant.hxx:57
Writes marshalled data of RSC services.
Definition: RscWriter.hpp:34