PLCnext API Documentation 26.6.0.38
IoException.hpp
1
2//
3// Copyright Phoenix Contact GmbH & Co. KG
4//
6#pragma once
8#include "Arp/Base/Core/PimplPtr.hxx"
9#include "Arp/Base/Commons/Exceptions/CommonExceptionBase.hpp"
10
11namespace Arp::Base::Commons::Exceptions::Io
12{
13
16class ARP_BASE_COMMONS_EXPORT IoException : public CommonExceptionBase
17{
18public: // Impl forward declaration
19 class Impl;
20
21public: // construction
22 template<typename... Args>
23 explicit IoException(const char* message, const Args& ... args);
24 explicit IoException(String&& message);
25 explicit IoException(const String& message);
26 IoException(String&& message, const Exception& innerException);
27 IoException(const String& message, const Exception& innerException);
28
29 // canonical construction/destruction/assignment
31 IoException(IoException&& arg)noexcept;
34 ~IoException(void)override;
35
36protected: // construction
37 IoException(ExceptionTypeId typeId, String&& message, StackCounter stackCounter);
38 IoException(ExceptionTypeId typeId, const String& message, StackCounter stackCounter);
39 IoException(ExceptionTypeId typeId, String&& message, const Exception& innerException, StackCounter stackCounter);
40 IoException(ExceptionTypeId typeId, const String& message, const Exception& innerException, StackCounter stackCounter);
41
42public: // static factory operations
43 static IoException Create(const String& message);
44 static IoException Create(const String& message, const String& path);
45
46public: // internal operations
47 Impl& GetImpl(void);
48 const Impl& GetImpl(void)const;
49
50protected: // overridden operations
51 Exception::Ptr Clone(void)const override;
52
53private: // static factory methods
54 static IoException CreateImpl(const String& message, StackCounter stackCounter);
55 static IoException CreateImpl(const String& message, const String& path, StackCounter stackCounter);
56
57private: // Impl usings
59
60private: // Impl fields
61 Pimpl pimpl;
62};
63
65// inline methods of class IoException
66
73template<typename... Args>
74inline IoException::IoException(const char* message, const Args& ... args)
75 : IoException(ExceptionTypeId::Io, String::Format(message, args...), StackCounter())
76{
77}
78
79} // end of namespace Arp::Base::Commons::Exceptions::Io
This class serves as base class for all Arp commons exceptions.
Definition: CommonExceptionBase.hpp:24
This exception is thrown when an unspecified IO error occurs.
Definition: IoException.hpp:17
IoException(const char *message, const Args &... args)
Creates an IoException with message.
Definition: IoException.hpp:74
IoException & operator=(const IoException &arg)
Default copy-assignment operator.
IoException & operator=(IoException &&arg) noexcept
Default move-assignment operator.
IoException(IoException &&arg) noexcept
Default move constructor.
IoException(const IoException &arg)
Default copy constructor.
~IoException(void) override
Default destructor.
This class is used to count sequenced operation calls, which are e.g. invoked during an exception thr...
Definition: StackCounter.hpp:20
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
Adapter class to implement PImpl idiom.
Definition: PimplPtr.hxx:15
This class represents the Arp String. The implementation is based on std::string.
Definition: String.hpp:39
@ 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