PLCnext API Documentation  21.0.0.35466
StringException.hpp
1 //
3 // Copyright PHOENIX CONTACT Electronics GmbH
4 //
6 #pragma once
7 #include "Arp/System/Core/Arp.h"
8 #include "Arp/System/Commons/Exceptions/Plc/PlcException.hpp"
9 
10 namespace Arp { namespace System { namespace Commons { namespace Plc
11 {
12 
15 {
16 public: // construction/destruction
17  template<typename... Args>
18  StringException(const char* message, const Args& ... args);
19  StringException(const String& message);
20  StringException(String&& message);
21  StringException(const String& message, const Exception& innerException);
22  StringException(String&& message, Exception&& innerException);
23  StringException(const StringException& arg) = default;
24  StringException(StringException&& arg) = default;
25  virtual ~StringException(void) = default;
26 
27 public: // static factory methods
28  static StringException Create(const String& stackTrace);
29 
30 protected: // overridden operations
31  Exception::Ptr Clone(void)const override;
32 
33 private: // deleted methods
34  StringException& operator=(const StringException& arg) = delete;
35 };
36 
38 // inline methods of class StringException
39 
41 template<typename... Args>
42 inline StringException::StringException(const char* message, const Args& ... args)
43  : PlcException(ExceptionTypeId::PlcString, String::Format(message, args...))
44 {
45 }
46 
49  : PlcException(ExceptionTypeId::PlcString, message)
50 {
51 }
52 
55  : PlcException(ExceptionTypeId::PlcString, std::move(message))
56 {
57 }
58 
60 inline StringException::StringException(const String& message, const Exception& innerException)
61  : PlcException(ExceptionTypeId::PlcString, message, innerException)
62 {
63 }
64 
66 inline StringException::StringException(String&& message, Exception&& innerException)
67  : PlcException(ExceptionTypeId::PlcString, std::move(message), std::move(innerException))
68 {
69 }
70 
71 }}}} // end of namesapce Arp::System::Commons::Plc
Exception::Ptr Clone(void) const override
Clones this instance.
String Format(int indentLevel, bool withInnerException) const override
Formats this exception using the given indent level.
StringException(const char *message, const Args &... args)
Constructs an StringException instance.
Definition: StringException.hpp:42
Namespace of the C++ standard library
This exception is used when a $$$TODO$$$ occurs.
Definition: PlcException.hpp:16
std::shared_ptr< Exception > Ptr
The smart pointer tpye of this class.
Definition: Exception.hpp:19
ExceptionTypeId
Specifies the type id of any exception derived by <see cref="CommonException".
Definition: ExceptionTypeId.hpp:14
This exception is used when a $$$TODO$$$ occurs.
Definition: StringException.hpp:14
Root namespace for the PLCnext API
System components used by the System, Device, Plc or Io domains.
This is the base class of all Arp exception classes.
Definition: Exception.hpp:15