PLCnext API Documentation 25.0.2.69
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: // properties
44 size_t GetLength(void)const;
45
46public: // operations
47 const char* CStr(void)const;
48 String ToString(void)const;
49 void Clear(void);
50 void Assign(const char* pChars);
51 void Assign(const String& str);
52
53public: // RSC operations
54 void Read(RscReader& reader);
55 void Write(RscWriter& writer)const;
56
57protected: // methods
58 void SetBufferInfo(char* pStringBuffer, size_t bufferSize, size_t strLength = 0);
59 void SetBufferInfo(char* pStringBuffer, size_t bufferSize, const char* pChars);
60 void SetBufferInfo(char* pStringBuffer, size_t bufferSize, const String& str);
61 void Assign(const char* pChars, size_t count);
62 void SetStringType(RscType value);
63 RscType GetStringType(void)const;
64
65private: // methods
66 char* GetBuffer(void)const; // just used by RscVariantBase
67 size_t GetBufferSize(void)const;
68 size_t GetMaxStringLength(void)const;
69
70private: // fields
71 size_t length = 0;
72 size_t bufferSize = 0;
73 char* pBuffer = nullptr;
74 RscType stringType = RscType::None;
75};
76
77} // 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:40
Reads marshaled data of RSC services.
Definition: RscReader.hpp:34
Writes marshalled data of RSC services.
Definition: RscWriter.hpp:34
@ 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....