|
PLCnext API Documentation 26.6.0.38
|
Rsc class for variant data types like primitive data type, strings or information about arrays or structs. ArrayInformation and StructInformation are used in combination with RscArrayReader, RscArrayWriter, RscStructReader and RscStructWriter More...
#include <RscVariant.hxx>

Public Member Functions | |
| RscVariant (void) | |
| The default constructor creates an empty instance of RscVariant. More... | |
| RscVariant (RscType type) | |
| Creates an empty but typed instance of RscVariant. More... | |
| RscVariant (const String &value) | |
| Creates a new instance of RscVariant with a value of type String. More... | |
| RscVariant (const char *value) | |
| Creates a new instance of RscVariant with a value of type String. More... | |
| RscVariant (const char8u *value) | |
| Creates a new instance of RscVariant with a value of type String. More... | |
| RscVariant (const char16 *input, size_t length) | |
| Creates a new instance of RscVariant with a value of type String. More... | |
| template<int M> | |
| RscVariant (const RscString< M > &value) | |
| Creates a new instance of RscVariant with a value of type String. More... | |
| template<int M> | |
| RscVariant (const RscSecureString< M > &value) | |
| Creates a new instance of RscVariant with a value of type String. More... | |
| template<int M> | |
| RscVariant (const char value[M]) | |
| Creates a new instance of RscVariant with a value of type String. More... | |
| template<int M> | |
| RscVariant (char value[M]) | |
| template<class T > | |
| RscVariant (const T &value) | |
| Creates a new instance of RscVariant with an initial value. More... | |
| RscVariant (const RscVariant &arg) | |
| The copy constructor. More... | |
| RscVariant (RscVariant &&arg) noexcept | |
| The move constructor. More... | |
| RscVariant & | operator= (const RscVariant &arg) |
| The assign operator. More... | |
| RscVariant & | operator= (RscVariant &&arg) noexcept |
| The move-assign operator. More... | |
| ~RscVariant (void) | |
| Default destructor. | |
| RscVariant & | operator= (const String &value) |
| Assign operator for type String. More... | |
| RscVariant & | operator= (const char *value) |
Assign operator for type char*. More... | |
| RscVariant & | operator= (const char8u *value) |
Assign operator for type char8u*. More... | |
| template<class T > | |
| RscVariant & | operator= (const T &value) |
| template<int M> | |
| RscVariant & | operator= (const RscString< M > &value) |
| template<int M> | |
| RscVariant & | operator= (const RscSecureString< M > &value) |
| bool | operator== (const RscVariant &arg) const |
| Compares this instance to arg on equality More... | |
| bool | operator!= (const RscVariant &arg) const |
| Compares this instance to arg on inequality More... | |
| template<class T > | |
| RscVariant< N > & | operator= (const T &value) |
| Assign operator for values of arbitrary type. More... | |
| template<int M> | |
| RscVariant< N > & | operator= (const RscString< M > &value) |
| Assign operator for values of type RscString. More... | |
| template<int M> | |
| RscVariant< N > & | operator= (const RscSecureString< M > &value) |
| Assign operator for values of type SecureString. More... | |
Public Member Functions inherited from Arp::Base::Rsc::Commons::RscVariantBase | |
| RscVariantBase (RscType type=RscType::None) | |
| The default constructor creates an empty instance of RscVariantBase. More... | |
| RscVariantBase (RscType type, byte *pBuffer) | |
| Creates a typed instance of RscVariant which refers to an external buffer. More... | |
| RscVariantBase (RscType type, char *pBuffer, size_t bufferSize) | |
| Creates a typed instance of RscVariant which refers to an external buffer. More... | |
| RscVariantBase (const RscStringBase &data) | |
| Creates a typed instance of RscVariant which refers to an external buffer. More... | |
| RscVariantBase (const RscArrayInfo &arrayInfo) | |
| Creates a typed instance of RscVariant which represents an array. More... | |
| RscVariantBase (const RscStructInfo &structInfo) | |
| Creates a typed instance of RscVariant which represents a struct. More... | |
| RscVariantBase (const RscVariantBase &arg) | |
| The copy constructor. More... | |
| RscVariantBase (RscVariantBase &&arg) noexcept | |
| The move constructor. More... | |
| RscVariantBase & | operator= (const RscVariantBase &arg) |
| The assign operator. More... | |
| RscVariantBase & | operator= (RscVariantBase &&arg) noexcept |
| The move-assign operator. More... | |
| ~RscVariantBase (void) | |
| The default destructor. | |
| RscVariantBase & | operator= (const String &value) |
| Assign operator for type String. More... | |
| RscVariantBase & | operator= (const char *value) |
Assign operator for type char*. More... | |
| RscVariantBase & | operator= (const char8u *value) |
Assign operator for type char8u*. More... | |
| template<class T > | |
| RscVariantBase & | operator= (const T &value) |
| Assign operator for values of arbitrary type. More... | |
| template<int N> | |
| RscVariantBase & | operator= (const RscString< N > &value) |
| Assign operator for values of type RscString. More... | |
| template<int N> | |
| RscVariantBase & | operator= (const RscSecureString< N > &value) |
| Assign operator for values of type SecureString. More... | |
| void | SetType (RscType value) |
| Forces the internal RscType to be set to another RscType. More... | |
| RscType | GetType (void) const |
| Gets the RscType of the contained element More... | |
| RscType | GetValueType (void) const |
| Gets the raw value type as RscType of the contained element. More... | |
| bool | IsComplexType (void) const |
| Determines if this instance represents a complex type, i.e. an array or a struct. More... | |
| bool | IsArray (void) const |
| Determines if this instance represents an array. More... | |
| bool | IsStruct (void) const |
| Determines if this instance represents a struct. More... | |
| bool | IsFormattable (void) const |
| Determines if this instance is convertible to String using the ToString() operation. More... | |
| size_t | GetDataSize (void) const |
| Gets the data size of the contained element. More... | |
| size_t | GetMaxStringSize (void) const |
| Gets the maximal length of strings which are provided by this instance. More... | |
| size_t | GetBufferSize (void) const |
| Gets the buffer size of this instance. More... | |
| RscType | GetArrayElementType (void) const |
| Gets the RscType of the array elements, if this instance represents an array. More... | |
| size_t | GetArraySize (void) const |
| Gets the array size, if this instance represents an array. More... | |
| size_t | GetArrayDimensions (void) const |
| Gets the count of array dimensions (1 for simple array, 2 for array of array etc.), if this instance represents an array. More... | |
| size_t | GetArrayFieldCount (void) const |
| Gets the field count of the struct elements, if this instance represents an array of structs. More... | |
| size_t | GetFieldCount (void) const |
| Gets the field count, if this instance represents a struct. More... | |
| byte * | GetDataAddress (void) |
| Gets a writable raw pointer to the internal data buffer. More... | |
| const byte * | GetDataAddress (void) const |
| const char * | GetChars (void) const |
| Gets a readable pointer to internal string buffer. More... | |
| void | Assign (const char *input, RscType rscType=RscType::String) |
| Assigns an UTF8 string to this instance. More... | |
| void | Assign (const char *input, size_t length, RscType rscType=RscType::String) |
| Assigns an UTF8 string to this instance. More... | |
| void | Assign (const char16 *input, size_t length) |
| Assigns an UTF16 string to this instance. More... | |
| void | Assign (const String &value) |
Assigns the given value of type String. More... | |
| void | CopyTo (String &value) const |
| Copies the content of this variant to a string. More... | |
| String | ToString (void) const |
| Converts this instance to String if the variant type has a reasonable string representation. More... | |
| void | Clear (bool clearBuffer=false) |
| Clears the type and all other infos of this instance. More... | |
| bool | Equals (const RscVariantBase &arg) const |
| Checks if this instance is equal to arg . More... | |
| void | Read (RscReader &reader, bool omitTag) |
| Reads this instance from RSC. More... | |
| void | Write (RscWriter &writer, bool omitTag) const |
| Writes this instance to RSC. More... | |
| bool | HasArrayInfo (void) const |
| Determines if the array info of this instance was set yet. More... | |
| void | SetArrayInfo (const RscArrayInfo &arrayInfo) |
| Set the array info of this instance. More... | |
| void | SetArrayInfo (size_t size, RscType elementType=RscType::None, size_t dimensions=1, size_t fieldCount=0) |
| Sets the array info of this instance. More... | |
| RscArrayInfo & | GetArrayInfo (void) |
| Gets the array info of this instance. More... | |
| const RscArrayInfo & | GetArrayInfo (void) const |
| bool | HasStructInfo (void) const |
| Determines if the struct info of this instance was set yet. More... | |
| void | SetStructInfo (size_t fieldCount) |
| Sets the struct info of this instance. More... | |
| RscStructInfo & | GetStructInfo (void) |
| Gets the struct info of this instance. More... | |
| const RscStructInfo & | GetStructInfo (void) const |
| bool | HasReadElementFunction (void) const |
| Determines if this instance provides an element read function. More... | |
| ReadElementFunction | GetReadElementFunction (void) const |
| Gets the element read function if available. More... | |
| void | SetReadElementFunction (ReadElementFunction &function) |
| Sets the element read function. More... | |
| bool | HasWriteElementFunction (void) const |
| Determines if this instance provides an element write function. More... | |
| WriteElementFunction | GetWriteElementFunction (void) const |
| Gets the element write function if available. More... | |
| void | SetWriteElementFunction (WriteElementFunction &function) const |
| Sets the element write function. More... | |
| void | ResetComplexTypeInfo (void) |
| Clears reader, writer and read/write element functions. | |
| template<int N> | |
| void | Assign (char value[N]) |
| Assigns the given value of type T . More... | |
| template<int N> | |
| void | Assign (const char value[N]) |
| template<int N> | |
| void | Assign (const RscString< N > &value) |
Assigns the given value of type RscString. More... | |
| template<int N> | |
| void | Assign (const RscSecureString< N > &value) |
Assigns the given value of type SecureString. More... | |
| template<class T > | |
| void | Assign (const T &value) |
| Assigns the given value of type T . More... | |
| template<class T > | |
| void | CopyTo (T &value) const |
| Copies the value of this instance to the out parameter value . More... | |
| template<int N> | |
| void | CopyTo (RscString< N > &value) const |
| Copies the value of this instance to the out parameter result . More... | |
| template<int N> | |
| void | CopyTo (RscSecureString< N > &value) const |
| Copies the value of this instance to the out parameter result . More... | |
| template<class T > | |
| T | GetValue (void) const |
| Converts this value to the given type T . More... | |
| template<class T > | |
| T * | GetValueAddress (void) |
| Gets the address of the contained value as type T *. More... | |
| template<class T > | |
| const T * | GetValueAddress (void) const |
| Gets the address of the contained value as type const T *. More... | |
Static Public Member Functions | |
| static RscVariant | CreateStructVariant (size_t fieldCount) |
| Creates a new RscVariant initialized with RscStructInfo More... | |
| static RscVariant | CreateStructVariant (size_t fieldCount, ReadElementFunction &readFunction) |
| Creates a new RscVariant initialized with RscStructInfo More... | |
| static RscVariant | CreateStructVariant (size_t fieldCount, WriteElementFunction &writeFunction) |
| Creates a new RscVariant initialized with RscStructInfo More... | |
| static RscVariant | CreateArrayVariant (size_t arraySize, RscType elementType, size_t dimensions=1, size_t fieldCount=0) |
| Creates a new RscVariant representing an array. More... | |
| static RscVariant | CreateArrayVariant (size_t arraySize, RscType elementType, ReadElementFunction &readFunction, size_t dimensions=1, size_t fieldCount=0) |
| Creates a new RscVariant representing an array for reading. More... | |
| static RscVariant | CreateArrayVariant (size_t arraySize, RscType elementType, WriteElementFunction &writeFunction, size_t dimensions=1, size_t fieldCount=0) |
| Creates a new RscVariant representing an array for writing. More... | |
Friends | |
| class | Arp::Base::Rsc::Commons::Internal::RscVariantAccessor |
| std::ostream & | operator<< (std::ostream &os, const RscVariant &arg) |
| The ostream operator is used for logging and string formatting. More... | |
Additional Inherited Members | |
Public Types inherited from Arp::Base::Rsc::Commons::RscVariantBase | |
| using | ReadFieldFunction = std::function< void(RscType fieldType, RscVariantBase &value)> |
| The read field delegate type. | |
| using | WriteFieldFunction = std::function< void(RscType fieldType, const RscVariantBase &value)> |
| The write field delegate type. | |
| using | ReadElementFunction = std::function< void(RscType elementType, RscVariantBase &value)> |
| The read element delegate type. | |
| using | WriteElementFunction = std::function< void(RscType elementType, const RscVariantBase &value)> |
| The write element delegate type. | |
Protected Member Functions inherited from Arp::Base::Rsc::Commons::RscVariantBase | |
| void | SetBufferInfo (byte *pDataBuffer, size_t dataBufferSize, bool isDynamicString) |
| Sets the buffer properties which are provided by super class RscVariant. More... | |
| bool | HasReader (void) const |
| Determines if this instance has a reader for deserialization. More... | |
| bool | HasWriter (void) const |
| Determines if this instance has a write for serialization. More... | |
| void | SetReader (RscReader &reader) |
| Sets the RSC reader, if this instance represents a complex type (array or struct). More... | |
| void | SetWriter (RscWriter &writer) const |
| Sets the RSC writer, if this instance represents a complex type (array or struct). More... | |
| RscReader * | GetReader (void) const |
| Gets a reader for deserialization. More... | |
| RscWriter * | GetWriter (void) const |
| Gets a writer for serialization. More... | |
Protected Attributes inherited from Arp::Base::Rsc::Commons::RscVariantBase | |
| RscType | type = RscType::None |
| The RSC type of this variant. | |
| byte * | pBuffer = nullptr |
| The buffer of this variant (usually applied by RscVariant<T>) | |
| size_t | bufferSize = 0 |
| The size of the applied buffer. | |
| bool | providesDynamicString = false |
| Determines if this variant supports dynamic strings (see String) | |
| String | dynamicString |
| The dynamic string storage. | |
| ComplexTypeInfo | typeInfo |
| The type info of this variant. | |
Rsc class for variant data types like primitive data type, strings or information about arrays or structs. ArrayInformation and StructInformation are used in combination with RscArrayReader, RscArrayWriter, RscStructReader and RscStructWriter
| N | The maximum count of characters for strings. If this value is zero, strings are not supported. |
The following types are supported by RscVariant:
| RscType | C++ type |
|---|---|
| Void | void |
| Bool | Arp::boolean |
| Int8 | Arp::int8 |
| Uint8 | Arp::uint8 |
| Int16 | Arp::int16 |
| Uint16 | Arp::uint16 |
| Int32 | Arp::int32 |
| Uint32 | Arp::uint32 |
| Uint32 | Arp::uint32 |
| Int64 | Arp::int64 |
| Uint64 | Arp::uint64 |
| Real32 | Arp::float32 |
| Real64 | Arp::float64 |
| String | Arp::StringOnly if N is not zero. |
| Struct | struct derived by Arp::Base::Rsc::Commons::RscSerializable |
| Array | std::vector<T> or RSC enumerators |
| DateTime | Arp::DateTime |
| Version | Arp::Base::Rsc::Commons::RscVersion |
| Guid | Arp::Base::Rsc::Commons::RscGuid |
| SecureString | Arp::Base::Rsc::Commons::RscSecureString |
| SecurityToken | Arp::Base::Commons::Security::SecurityToken |
|
inline |
The default constructor creates an empty instance of RscVariant.
| N | The maximum size for strings. |
|
inline |
Creates an empty but typed instance of RscVariant.
| type | The initial Rsc type. |
| N | The maximum size for strings. |
|
inlineexplicit |
Creates a new instance of RscVariant with a value of type String.
| value | The String value to copy to this instance. |
| N | The maximum size for strings. |
|
inlineexplicit |
Creates a new instance of RscVariant with a value of type String.
| value | The String value to copy to this instance. |
| N | The maximum size for strings. |
|
inlineexplicit |
Creates a new instance of RscVariant with a value of type String.
| value | The String value to copy to this instance. |
| N | The maximum size for strings. |
|
inlineexplicit |
Creates a new instance of RscVariant with a value of type String.
| input | The UTF16 encoded string to copy to this instance. |
| length | The string length of the input string (number of char16 characters). |
The input string is converted to an UTF8 string for marshalling.
| N | The maximum size for strings. |
|
inlineexplicit |
Creates a new instance of RscVariant with a value of type String.
| value | The String value to copy to this instance. |
| N | The maximum size for strings. |
| M | The maximum size of the as argument passed string. |
|
inlineexplicit |
Creates a new instance of RscVariant with a value of type String.
| value | The String value to copy to this instance. |
| N | The maximum size for strings. |
| M | The maximum size of the as argument passed string. |
|
inlineexplicit |
Creates a new instance of RscVariant with a value of type String.
| value | The string to copy to this instance. |
| N | The maximum size for strings. |
| M | The maximum size of the as argument passed string. |
|
inlineexplicit |
Creates a new instance of RscVariant with an initial value.
| value | The initial value to copy to this instance. |
The RscType is deduced automatically through type deduction of T.
| N | The maximum size for strings. |
|
inline |
The copy constructor.
| arg | The argument to copy. |
| N | The maximum size for strings. |
|
inlinenoexcept |
The move constructor.
| arg | The argument to move. |
| N | The maximum size for strings. |
|
inlinestatic |
Creates a new RscVariant representing an array for reading.
| arraySize | Size of array. |
| elementType | The element type as RscType. |
| readFunction | The function to read elements. |
| dimensions | Number of array dimensions. |
| fieldCount | Number of fields if the element type is a struct type. |
| N | The maximum size for strings. |
|
inlinestatic |
Creates a new RscVariant representing an array.
| arraySize | Size of array. |
| elementType | The element type as RscType. |
| dimensions | Number of array dimensions. |
| fieldCount | Number of fields if the element type is a struct type. |
| N | The maximum size for strings. |
|
inlinestatic |
Creates a new RscVariant representing an array for writing.
| arraySize | Size of array. |
| elementType | The element type as RscType. |
| writeFunction | The function to write elements. |
| dimensions | Number of array dimensions. |
| fieldCount | Number of fields if the element type is a struct type. |
| N | The maximum size for strings. |
|
inlinestatic |
Creates a new RscVariant initialized with RscStructInfo
| fieldCount | Count of struct fields |
| N | The maximum size for strings. |
|
inlinestatic |
Creates a new RscVariant initialized with RscStructInfo
| fieldCount | Count of struct fields |
| readFunction | The function to read a single element. |
| N | The maximum size for strings. |
|
inlinestatic |
Creates a new RscVariant initialized with RscStructInfo
| fieldCount | Count of struct fields |
| writeFunction | The function to write a single element. |
| N | The maximum size for strings. |
|
inline |
Compares this instance to arg on inequality
| arg | The argument to compare this instance to. |
true if arg is not equal to this instance, otherwise false.| N | The maximum size for strings. |
|
inline |
Assign operator for type char*.
| value | The string to assign. |
| N | The maximum size for strings. |
|
inline |
Assign operator for type char8u*.
| value | The string to assign. |
| N | The maximum size for strings. |
|
inline |
Assign operator for values of type SecureString.
| value | The string to assign. |
| M | The maximal string length. |
| N | The maximum size for strings. |
|
inline |
Assign operator for values of type RscString.
| value | The string to assign. |
| M | The maximal string length. |
| N | The maximum size for strings. |
|
inline |
The assign operator.
| arg | The argument to assign. |
| N | The maximum size for strings. |
|
inline |
Assign operator for type String.
| value | The string to assign. |
| N | The maximum size for strings. |
|
inline |
Assign operator for values of arbitrary type.
| value | The value to assign. |
| T | The type of the value. |
| N | The maximum size for strings. |
|
inlinenoexcept |
The move-assign operator.
| arg | The argument to move. |
| N | The maximum size for strings. |
|
inline |
Compares this instance to arg on equality
| arg | The argument to compare this instance to. |
true if arg is equal to this instance, otherwise false.| N | The maximum size for strings. |
|
friend |
The ostream operator is used for logging and string formatting.
| os | The stream to write to. |
| arg | The variant to write to the stream. |