PLCnext API Documentation 26.6.0.38
EndOfStreamException.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/Io/IoException.hpp"
10
11namespace Arp::Base::Commons::Exceptions::Io
12{
13
15class ARP_BASE_COMMONS_EXPORT EndOfStreamException : public IoException
16{
17public: // Impl forward declaration
18 class Impl;
19
20public: // construction
21 template<typename... Args>
22 explicit EndOfStreamException(const char* message, const Args& ... args);
23 explicit EndOfStreamException(String&& message);
24 explicit EndOfStreamException(const String& message);
25 EndOfStreamException(String&& message, const Exception& innerException);
26 EndOfStreamException(const String& message, const Exception& innerException);
27
28 // canonical construction/destruction/assignment
33 ~EndOfStreamException(void)override;
34
35protected: // construction
36 EndOfStreamException(ExceptionTypeId typeId, String&& message, StackCounter stackCounter);
37
38public: // static factory operations
39 static EndOfStreamException Create(const String& message);
40
41public: // internal operations
42 Impl& GetImpl(void);
43 const Impl& GetImpl(void)const;
44
45protected: // overridden operations
46 Exception::Ptr Clone(void)const override;
47
48private: // Impl usings
50
51private: // Impl fields
52 Pimpl pimpl;
53};
54
56// inline methods of class EndOfStreamException
57
64template<typename... Args>
65inline EndOfStreamException::EndOfStreamException(const char* message, const Args& ... args)
66 : EndOfStreamException(ExceptionTypeId::IoEndOfStream, String::Format(message, args...), StackCounter())
67{
68}
69
70} // end of namespace Arp::Base::Commons::Exceptions::Io
71
72namespace Arp {
73// Import exception into Arp namespace as Arp::System::Commons library does
75} // end of namespace Arp
77// template specialization of ArgumentException formatter
78template<> struct fmt::formatter<Arp::Base::Commons::Exceptions::Io::EndOfStreamException> : public fmt::ostream_formatter
79{
80};
81
This exception is thrown when the end of stream is reached duing a stream read operation.
Definition: EndOfStreamException.hpp:16
EndOfStreamException & operator=(const EndOfStreamException &arg)
Default copy-assignment operator.
EndOfStreamException(const char *message, const Args &... args)
Creates an EndOfStreamException with message.
Definition: EndOfStreamException.hpp:65
EndOfStreamException & operator=(EndOfStreamException &&arg) noexcept
Default move-assignment operator.
EndOfStreamException(const EndOfStreamException &arg)
Default copy constructor.
~EndOfStreamException(void) override
Default destructor.
EndOfStreamException(EndOfStreamException &&arg) noexcept
Default move constructor.
This exception is thrown when an unspecified IO error occurs.
Definition: IoException.hpp:17
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
Root namespace for the PLCnext API