DFace C++ SDK  2.5.2
dface_general_exception.h
浏览该文件的文档.
1 //
2 // Created by asy on 11/21/18.
3 //
4 
5 #ifndef DF_ANDROID_DFACE_GENERAL_EXCEPTION_H
6 #define DF_ANDROID_DFACE_GENERAL_EXCEPTION_H
7 
8 #include <iostream>
9 #include <exception>
10 #include "../def.h"
11 
12 using namespace std;
13 
17 class DFACE_EXPORTS DFaceException : public std::exception {
18 public:
22  const int code;
26  const char* msg;
27 
28 public:
29  DFaceException(const char* msg, const int code);
30  const char* what () const throw ();
34  const char* getMsg() const;
38  const int getCode() const;
39 };
40 
41 
42 inline DFaceException::DFaceException(const char *msg, const int code):msg(msg), code(code){
43 
44 }
45 
46 inline const char* DFaceException::what() const throw(){
47 #ifdef _WIN32
48  return msg;
49 #else
50  int len = sizeof(msg) + sizeof(code) + 10;
51  char* buff = (char*)malloc(len);
52  sprintf(buff, "%s, %d", msg, code);
53  return buff;
54 #endif
55 }
56 
57 inline const int DFaceException::getCode() const {
58  return code;
59 }
60 
61 inline const char* DFaceException::getMsg() const {
62  return msg;
63 }
64 
65 
66 #endif //DF_ANDROID_DFACE_GENERAL_EXCEPTION_H
const char * msg
错误信息
Definition: dface_general_exception.h:26
DFace异常类
Definition: dface_general_exception.h:17
const char * getMsg() const
Definition: dface_general_exception.h:61
const char * what() const
Definition: dface_general_exception.h:46
#define DFACE_EXPORTS
Definition: def.h:15
const int getCode() const
Definition: dface_general_exception.h:57
const int code
错误码
Definition: dface_general_exception.h:22