PLCnext API Documentation 26.6.0.38
PathNotExistException.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 PathNotExistException : public IoException
16{
17public: // Impl forward declaration
18 class Impl;
19
20public: // construction
21 template<typename... Args>
22 explicit PathNotExistException(const char* message, const Args& ... args);
23 explicit PathNotExistException(String&& message);
24 explicit PathNotExistException(const String& message);
25 PathNotExistException(String&& message, const Exception& innerException);
26 PathNotExistException(const String& message, const Exception& innerException);
27
28 // canonical construction/destruction/assignment
34
35protected: // construction
36 PathNotExistException(ExceptionTypeId typeId, String&& message, StackCounter stackCounter);
37 PathNotExistException(ExceptionTypeId typeId, String&& message, const Exception& innerException, StackCounter stackCounter);
38
39public: // static factory operations
40 static PathNotExistException Create(const String& path);
41 static PathNotExistException Create(const String& path, const Exception& innerException);
42
43public: // internal operations
44 Impl& GetImpl(void);
45 const Impl& GetImpl(void)const;
46
47protected: // overridden operations
48 Exception::Ptr Clone(void)const override;
49
50private: // static factory methods
51 static PathNotExistException CreateImpl(const String& path, StackCounter stackCounter);
52 static PathNotExistException CreateImpl(const String& path, const Exception& innerException, StackCounter stackCounter);
53
54private: // Impl usings
56
57private: // Impl fields
58 Pimpl pimpl;
59};
60
62// inline methods of class ArgumentException
63
70template<typename... Args>
71inline PathNotExistException::PathNotExistException(const char* message, const Args& ... args)
72 : PathNotExistException(ExceptionTypeId::IoPathNotExist, String::Format(message, args...), StackCounter())
73{
74}
75
76} // end of namespace Arp::Base::Commons::Exceptions::Io
77
78namespace Arp {
79// Import exception into Arp namespace as Arp::System::Commons library does
81} // end of namespace Arp
83// template specialization of IndexOutOfRangeException formatter
84template<> struct fmt::formatter<Arp::Base::Commons::Exceptions::Io::PathNotExistException> : public fmt::ostream_formatter
85{
86};
This exception is thrown when an unspecified IO error occurs.
Definition: IoException.hpp:17
This exception is thrown when a specified path does not exists during a file operation.
Definition: PathNotExistException.hpp:16
PathNotExistException(const char *message, const Args &... args)
Creates an PathNotExistException with message.
Definition: PathNotExistException.hpp:71
PathNotExistException(PathNotExistException &&arg) noexcept
Default move constructor.
PathNotExistException(const PathNotExistException &arg)
Default copy constructor.
~PathNotExistException(void) override
Default destructor.
PathNotExistException & operator=(const PathNotExistException &arg)
Default copy-assignment operator.
PathNotExistException & operator=(PathNotExistException &&arg) noexcept
Default move-assignment operator.
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