dmlite  0.6
status.h
Go to the documentation of this file.
1 /// @file include/dmlite/cpp/status.h
2 /// @brief Status objects used by the API
3 /// @author Georgios Bitzes <georgios.bitzes@cern.ch>
4 #ifndef DMLITE_CPP_STATUS_H
5 #define DMLITE_CPP_STATUS_H
6 
7 #include "dmlite/common/config.h"
8 #include "dmlite/common/errno.h"
9 #include "exceptions.h"
10 
11 #include <cstdarg>
12 #include <exception>
13 #include <string>
14 
15 namespace dmlite {
16 
17 class DmStatus {
18 public:
19  DmStatus();
20  DmStatus(int code);
21  DmStatus(int code, const std::string &string);
22  DmStatus(int code, const char* fmt, va_list args);
23  DmStatus(int code, const char* fmt, ...);
24 
25  DmStatus(const DmStatus &de);
26  DmStatus(const DmException &de);
27 
28  virtual ~DmStatus() throw();
29 
30  int code() const throw();
31  const char* what() const throw();
32 
33  bool ok() const throw();
34  DmException exception() const throw();
35 
36 protected:
38  std::string errorMsg_;
39 
40  void setMessage(const char* fmt, va_list args);
41 };
42 
43 };
44 #endif // DMLITE_CPP_STATUS_H
DmException exception() const
Error codes.
Definition: status.h:17
const char * what() const
virtual ~DmStatus()
Base exception class.
Definition: exceptions.h:17
int code() const
void setMessage(const char *fmt, va_list args)
int errorCode_
Definition: status.h:37
Exceptions used by the API.
bool ok() const
std::string errorMsg_
Definition: status.h:38
Namespace for the dmlite C++ API.
Definition: authn.h:16