PLCnext API Documentation 25.0.2.69
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/destruction/assignment
21 template<typename... Args>
22 explicit PathNotExistException(const char* message, const Args& ... args);
24 PathNotExistException(const String& message);
25 PathNotExistException(String&& message, const Exception& innerException);
26 PathNotExistException(const String& message, const Exception& innerException);
27
33
34protected: // construction
35 PathNotExistException(ExceptionTypeId typeId, String&& message, StackCounter stackCounter);
36 PathNotExistException(ExceptionTypeId typeId, String&& message, const Exception& innerException, StackCounter stackCounter);
37
38public: // static factory operations
39 static PathNotExistException Create(const String& path);
40 static PathNotExistException Create(const String& path, const Exception& innerException);
41
42public: // internal operations
43 Impl& GetImpl(void);
44 const Impl& GetImpl(void)const;
45
46protected: // overridden operations
47 Exception::Ptr Clone(void)const override;
48
49private: // static factory methods
50 static PathNotExistException CreateImpl(const String& path, StackCounter stackCounter);
51 static PathNotExistException CreateImpl(const String& path, const Exception& innerException, StackCounter stackCounter);
52
53private: // Impl usings
55
56private: // Impl fields
57 Pimpl pimpl;
58};
59
61// inline methods of class ArgumentException
62
69template<typename... Args>
70inline PathNotExistException::PathNotExistException(const char* message, const Args& ... args)
71 : PathNotExistException(ExceptionTypeId::IoPathNotExist, String::Format(message, args...), StackCounter())
72{
73}
74
75} // end of namespace Arp::Base::Commons::Exceptions::Io
76
77namespace Arp {
78// Import exception into Arp namespace as Arp::System::Commons library does
80} // end of namespace Arp
82// template specialization of IndexOutOfRangeException formatter
83template<> struct fmt::formatter<Arp::Base::Commons::Exceptions::Io::PathNotExistException> : public fmt::ostream_formatter
84{
85};
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:70
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