PLCnext API Documentation 26.6.0.38
RscStringBase.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/Base/Rsc/Commons/Rsc.hpp"
9
10namespace Arp::Base::Rsc::Commons
11{
12
13// Type imports
16
17// forwards
18class RscVariantBase;
19
26class ARP_EXPORT RscStringBase
27{
28 friend class RscVariantBase;
29
30protected: // construction
31 explicit RscStringBase(RscType stringType);
32
33 // canonical construction/destruction/assignment
36 RscStringBase& operator=(const RscStringBase& arg) = delete;
37 RscStringBase& operator=(RscStringBase&& arg)noexcept = delete;
39
40public: // operators
41 operator String(void)const; // implicit conversion is intended.
42
43public: // friend operators
44 friend bool operator==(const RscStringBase& left, const RscStringBase& right)noexcept
45 {
46 return left.Equals(right);
47 }
48 friend bool operator!=(const RscStringBase& left, const RscStringBase& right)noexcept
49 {
50 return !left.Equals(right);
51 }
52
53public: // properties
54 size_t GetLength(void)const;
55
56public: // operations
57 const char* CStr(void)const;
58 String ToString(void)const;
59 void Clear(void);
60 void Assign(const char* pChars);
61 void Assign(const String& str);
62
63public: // RSC operations
64 void Read(RscReader& reader);
65 void Write(RscWriter& writer)const;
66
67protected: // methods
68 void SetBufferInfo(char* pStringBuffer, size_t bufferSize, size_t strLength = 0);
69 void SetBufferInfo(char* pStringBuffer, size_t bufferSize, const char* pChars);
70 void SetBufferInfo(char* pStringBuffer, size_t bufferSize, const String& str);
71 void Assign(const char* pChars, size_t count);
72 void SetStringType(RscType value);
73 RscType GetStringType(void)const;
74 bool Equals(const RscStringBase& other)const;
75
76private: // methods
77 char* GetBuffer(void)const; // just used by RscVariantBase
78 size_t GetBufferSize(void)const;
79 size_t GetMaxStringLength(void)const;
80
81private: // fields
82 size_t length = 0;
83 size_t bufferSize = 0;
84 char* pBuffer = nullptr;
85 RscType stringType = RscType::None;
86};
87
88} // end of namespace Arp::Base::Rsc::Commons
This class represents the Arp String. The implementation is based on std::string.
Definition: String.hpp:39
This class is a base class of template class RscString.
Definition: RscStringBase.hpp:27
~RscStringBase(void)
Default destructor.
RscStringBase(RscStringBase &&arg) noexcept
Default move constructor.
RscStringBase(const RscStringBase &arg)
Default copy constructor.
This class is a base class of template class RscVariant.
Definition: RscVariantBase.hpp:41
Reads marshaled data of RSC services.
Definition: RscReader.hpp:34
Writes marshalled data of RSC services.
Definition: RscWriter.hpp:34
@ Equals
Start recording if TriggerVariable1 is equal to TriggerVariable2.
@ Write
Specifies write access to the file. Data can be written to the file and the file pointer can be moved...
@ Read
Specifies read access to the file. Data can be read from the file and the file pointer can be moved....