PLCnext API Documentation 25.0.2.69
InvalidOperationException.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/InvalidOperationException.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 InvalidOperationException : public CommonException
22{
23public: // construction/destruction
24 template<typename... Args>
25 InvalidOperationException(const char* message, const Args& ... args);
26 InvalidOperationException(const String& message);
27 InvalidOperationException(String&& message);
28 InvalidOperationException(const String& message, const Exception& innerException);
29 InvalidOperationException(String&& message, Exception&& innerException);
30 InvalidOperationException(const InvalidOperationException& arg) = default;
31 InvalidOperationException(InvalidOperationException&& arg) = default;
32 virtual ~InvalidOperationException(void) = default;
33
34protected: // overridden operations
35 Exception::Ptr Clone(void)const override;
36
37private: // deleted methods
38 InvalidOperationException& operator=(const InvalidOperationException& arg) = delete;
39};
40
42// inline methods of class InvalidOperationException
43
45template<typename... Args>
46inline InvalidOperationException::InvalidOperationException(const char* message, const Args& ... args)
47 : CommonException(ExceptionTypeId::InvalidOperation, String::Format(message, args...))
48{
49}
50
52inline InvalidOperationException::InvalidOperationException(const String& message)
53 : CommonException(ExceptionTypeId::InvalidOperation, message)
54{
55}
56
58inline InvalidOperationException::InvalidOperationException(String&& message)
59 : CommonException(ExceptionTypeId::InvalidOperation, std::move(message))
60{
61}
62
64inline InvalidOperationException::InvalidOperationException(const String& message, const Exception& innerException)
65 : CommonException(ExceptionTypeId::InvalidOperation, message, innerException)
66{
67}
68
70inline InvalidOperationException::InvalidOperationException(String&& message, Exception&& innerException)
71 : CommonException(ExceptionTypeId::InvalidOperation, std::move(message), std::move(innerException))
72{
73}
74
75}}} // end of namesapce Arp::System::Commons
76
78// template specialization of InvalidOperationException formatter
79template<> struct fmt::formatter<Arp::System::Commons::InvalidOperationException> : public fmt::ostream_formatter {};
80
81#endif // ndef ARP_USE_ARP_SYSTEM_COMMONS_EXCEPTIONS
This exception is thrown when an operation cannot be executed because the related state is invalid.
Definition: InvalidOperationException.hpp:16
InvalidOperationException(const char *message, const Args &... args)
Creates an InvalidOperationException with message.
Definition: InvalidOperationException.hpp:64
std::unique_ptr< Exception > Ptr
The smart pointer type of this class.
Definition: Exception.hpp:27
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