PLCnext API Documentation 25.0.2.69
NotSupportedException.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
7#ifndef ARP_USE_ARP_SYSTEM_COMMONS_EXCEPTIONS
8#include "Arp/Base/Commons/Exceptions/NotSupportedException.hpp"
9namespace Arp
10{
12}
13#else
14#include "Arp/System/Core/Arp.h"
15#include "Arp/System/Commons/Exceptions/CommonException.hpp"
16
17namespace Arp { namespace System { namespace Commons
18{
19
21class NotSupportedException : public CommonException
22{
23public: // construction/destruction
24 template<typename... Args>
25 NotSupportedException(const char* message, const Args& ... args);
26 NotSupportedException(const String& message);
27 NotSupportedException(String&& message);
28 NotSupportedException(const String& message, const Exception& innerException);
29 NotSupportedException(String&& message, Exception&& innerException);
30 NotSupportedException(const NotSupportedException& arg) = default;
31 NotSupportedException(NotSupportedException&& arg) = default;
32 virtual ~NotSupportedException(void) = default;
33
34public: // static factory methods
35 static NotSupportedException Create(const char* functionName);
36 static NotSupportedException Create(const char* functionName, const Exception& innerException);
37
38protected: // overridden operations
39 Exception::Ptr Clone(void)const override;
40
41private: // deleted methods
42 NotSupportedException& operator=(const NotSupportedException& arg) = delete;
43
44private:
45 static const char* const defaultMessage;
46};
47
49// inline methods of class NotSupportedException
50
52template<typename... Args>
53inline NotSupportedException::NotSupportedException(const char* message, const Args& ... args)
54 : CommonException(ExceptionTypeId::NotSupported, String::Format(message, args...))
55{
56}
57
59inline NotSupportedException::NotSupportedException(const String& message)
60 : CommonException(ExceptionTypeId::NotSupported, message)
61{
62}
63
65inline NotSupportedException::NotSupportedException(String&& message)
66 : CommonException(ExceptionTypeId::NotSupported, std::move(message))
67{
68}
69
71inline NotSupportedException::NotSupportedException(const String& message, const Exception& innerException)
72 : CommonException(ExceptionTypeId::NotSupported, message, innerException)
73{
74}
75
77inline NotSupportedException::NotSupportedException(String&& message, Exception&& innerException)
78 : CommonException(ExceptionTypeId::NotSupported, std::move(message), std::move(innerException))
79{
80}
81
83inline NotSupportedException NotSupportedException::Create(const char* functionName)
84{
85 return NotSupportedException(defaultMessage, functionName);
86}
87
89inline NotSupportedException NotSupportedException::Create(const char* functionName, const Exception& innerException)
90{
91 return NotSupportedException(String::Format(defaultMessage, functionName), innerException);
92}
93
94}}} // end of namesapce Arp::System::Commons
95
97// template specialization of NotSupportedException formatter
98template<> struct fmt::formatter<Arp::System::Commons::NotSupportedException> : public fmt::ostream_formatter {};
99
100#endif // ndef ARP_USE_ARP_SYSTEM_COMMONS_EXCEPTIONS
This exception is thrown when a not supported operation is invoked.
Definition: NotSupportedException.hpp:16
NotSupportedException(const char *message, const Args &... args)
Creates an NotSupportedException with message.
Definition: NotSupportedException.hpp:67
std::unique_ptr< Exception > Ptr
The smart pointer type of this class.
Definition: Exception.hpp:27
@ Create
Creates a new file. If the file already exists, it is overwritten.
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