All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Exception.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------------------
2 // Copyright (c) 2001-2024 by Apryse Software Inc. All Rights Reserved.
3 // Consult legal.txt regarding legal and license information.
4 //---------------------------------------------------------------------------------------
5 #ifndef PDFTRON_H_CPPCommonException
6 #define PDFTRON_H_CPPCommonException
7 
8 #include <typeinfo>
9 #include <string>
10 #include <memory>
11 #include <cstdio>
12 #include <C/Common/TRN_Exception.h>
13 
14 namespace pdftron {
15  namespace Common {
16 
24 class Exception : public std::exception
25 {
26 public:
27 
31  Exception(){};
32 
33  Exception(TRN_Exception e);
34 
44  Exception(const char* cond_expr,
45  TRN_Int32 line_number,
46  const char* file_name,
47  const char* function,
48  const char* message,
49  TRN_UInt32 error_code = 0);
50 
51  ~Exception() throw() {};
52 
56  const char* GetCondExpr();
57 
61  const char* GetFileName();
62 
66  TRN_Int32 GetLineNumber();
67 
71  const char* GetFunction();
72 
76  const char* GetMessage();
77 
81  std::string ToString();
82 
86  std::ostream& Print(std::ostream& stream);
87 
91  TRN_UInt32 GetErrorCode();
92 
97  virtual const char* what() const throw();
98 
99  TRN_Exception e;
100 
101 };
102 
103 
112 inline std::ostream& operator<<(std::ostream& stream, Exception& e)
113 {
114  return e.Print(stream);
115 }
116 
117 #include <Impl/Exception.inl>
118 
119  }; // namespace Common
120 }; // namespace pdftron
121 
122 #endif // PDFTRON_H_CPPCommonException
const char * GetCondExpr()
std::ostream & Print(std::ostream &stream)
const char * GetFunction()
virtual const char * what() const
const char * GetFileName()