PLCnext API Documentation 25.0.2.69
StringException.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/System/Commons/Exceptions/Plc/PlcException.hpp"
9
10namespace Arp { namespace System { namespace Commons { namespace Plc
11{
12
14{
15public: // construction/destruction
16 template<typename... Args>
17 StringException(const char* message, const Args& ... args);
18 StringException(const String& message);
19 StringException(String&& message);
20 StringException(const String& message, int skipStackTraceDepth);
21 StringException(String&& message, int skipStackTraceDepth);
22 StringException(const String& message, const Exception& innerException);
23 StringException(String&& message, Exception&& innerException);
24 StringException(const StringException& arg) = default;
25 StringException(StringException&& arg) = default;
26 virtual ~StringException(void) = default;
27
28public: // static factory methods
29 static StringException Create(const String& message);
30 static StringException CreateWithStackTrace(const String& message, const String& additionalStackTrace, int skipStackTraceDepth = 0);
31
32protected: // overridden operations
33 Exception::Ptr Clone(void)const override;
34
35private: // deleted methods
36 StringException& operator=(const StringException& arg) = delete;
37};
38
40// inline methods of class StringException
41
43template<typename... Args>
44inline StringException::StringException(const char* message, const Args& ... args)
45 : PlcException(ExceptionTypeId::PlcString, String::Format(message, args...))
46{
47}
48
49}}}} // end of namesapce Arp::System::Commons::Plc
50
52// template specialization of StringException formatter
53template<> struct fmt::formatter<Arp::System::Commons::Plc::StringException> : public fmt::ostream_formatter {};
This is the base class of all Arp exception classes.
Definition: Exception.hpp:21
std::unique_ptr< Exception > Ptr
The smart pointer type of this class.
Definition: Exception.hpp:27
This class represents the Arp String. The implementation is based on std::string.
Definition: String.hpp:39
Definition: PlcException.hpp:14
Definition: StringException.hpp:14
static StringException Create(const String &message)
Creates an StringException instance using a default message text.
Definition: StringException.cpp:19
StringException(const char *message, const Args &... args)
Constructs an StringException instance.
Definition: StringException.hpp:44
Exception::Ptr Clone(void) const override
This operation clones this instance polymorpically as a deep copy.
Definition: StringException.cpp:13
ExceptionTypeId
Specifies the type id of any exception derived by <see cref="CommonException".
Definition: ExceptionTypeId.hpp:15
Root namespace for the PLCnext API