PLCnext API Documentation 25.0.2.69
SafeString.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/Base/Core/Exception.hpp"
9#include <cstddef>
10#include <span>
11
12namespace Arp::Base::Core
13{
14
15class ARP_EXPORT SafeString
16{
17public: // construction
18 SafeString(void) = delete; // makes this class pure static
19
20public: // static operations
21 static size_t GetBufferSizeLimit(void);
22 static size_t GetStringLengthLimit(void);
23 static bool IsNullOrEmpty(const char* str);
24 static size_t GetLength(std::span<const char> str);
25 static size_t GetLength(const char* str, size_t bufferSize);
26 static bool TryGetLength(std::span<const char> str, size_t& result);
27 static bool TryGetLength(const char* str, size_t bufferSize, size_t& result);
28 static void Copy(std::span<char> destStr, const char* srcStr);
29 static void Copy(std::span<char> destStr, const char* srcStr, size_t count);
30 static void Copy(char* destStr, size_t bufferSize, const char* srcStr);
31 static void Copy(char* destStr, size_t bufferSize, const char* srcStr, size_t count);
32
33private: // methods
34 static Exception CreateException(const char* reason);
35};
36
37} // end of namespace Arp::Base::Core
38
39namespace Arp {
42}
This is the base class of all Arp exception classes.
Definition: Exception.hpp:21
Definition: SafeString.hpp:16
Root namespace for the PLCnext API