PLCnext API Documentation 23.6.0.37
StringException.hpp
1
2//
3// Copyright PHOENIX CONTACT Electronics GmbH
4//
6#pragma once
8#include "Arp/System/Commons/Exceptions/Plc/PlcException.hpp"
9
10namespace Arp { namespace System { namespace Commons { namespace Plc
11{
12
15{
16public: // construction/destruction
17 template<typename... Args>
18 StringException(const char* message, const Args& ... args);
19 StringException(const String& message);
20 StringException(String&& message);
21 StringException(const String& message, int skipStackTraceDepth);
22 StringException(String&& message, int skipStackTraceDepth);
23 StringException(const String& message, const Exception& innerException);
24 StringException(String&& message, Exception&& innerException);
25 StringException(const StringException& arg) = default;
26 StringException(StringException&& arg) = default;
27 virtual ~StringException(void) = default;
28
29public: // static factory methods
30 static StringException Create(const String& message);
31 static StringException CreateWithStackTrace(const String& message, const String& additionalStackTrace, int skipStackTraceDepth = 0);
32
33protected: // overridden operations
34 Exception::Ptr Clone(void)const override;
35
36private: // deleted methods
37 StringException& operator=(const StringException& arg) = delete;
38};
39
41// inline methods of class StringException
42
44template<typename... Args>
45inline StringException::StringException(const char* message, const Args& ... args)
46 : PlcException(ExceptionTypeId::PlcString, String::Format(message, args...))
47{
48}
49
52 : PlcException(ExceptionTypeId::PlcString, message)
53{
54}
55
58 : PlcException(ExceptionTypeId::PlcString, std::move(message))
59{
60}
61
63inline StringException::StringException(const String& message, int skipStackTraceDepth)
64 : PlcException(ExceptionTypeId::PlcString, message, skipStackTraceDepth)
65{
66}
67
69inline StringException::StringException(String&& message, int skipStackTraceDepth)
70 : PlcException(ExceptionTypeId::PlcString, std::move(message), skipStackTraceDepth)
71{
72}
73
75inline StringException::StringException(const String& message, const Exception& innerException)
76 : PlcException(ExceptionTypeId::PlcString, message, innerException)
77{
78}
79
81inline StringException::StringException(String&& message, Exception&& innerException)
82 : PlcException(ExceptionTypeId::PlcString, std::move(message), std::move(innerException))
83{
84}
85
86}}}} // end of namesapce Arp::System::Commons::Plc
This is the base class of all Arp exception classes.
Definition: Exception.hpp:16
std::shared_ptr< Exception > Ptr
The smart pointer tpye of this class.
Definition: Exception.hpp:19
This exception is used when a $$$TODO$$$ occurs.
Definition: PlcException.hpp:15
This exception is used when a $$$TODO$$$ occurs.
Definition: StringException.hpp:15
StringException(const char *message, const Args &... args)
Constructs an StringException instance.
Definition: StringException.hpp:45
Exception::Ptr Clone(void) const override
Clones this instance.
@ System
System components used by the System, Device, Plc or Io domains.
ExceptionTypeId
Specifies the type id of any exception derived by <see cref="CommonException".
Definition: ExceptionTypeId.hpp:15
Root namespace for the PLCnext API
Namespace of the C++ standard library