LongPort OpenAPI C++ SDK
status.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <stdint.h>
4 
5 typedef struct lb_error_t lb_error_t;
6 
7 namespace longport {
8 class Status
9 {
10 private:
11  const lb_error_t* err_;
12  bool need_free_;
13 
14 public:
15  Status();
16  Status(const lb_error_t* err);
18  Status(Status&& status) noexcept;
20 
21  inline operator bool() { return is_ok(); }
22 
24  bool is_ok() const;
25 
27  bool is_err() const;
28 
30  int64_t code() const;
31 
33  const char* message() const;
34 };
35 
36 } // namespace longport
Definition: status.hpp:9
bool is_ok() const
Returns true if no errors occurs.
Status(const lb_error_t *err)
int64_t code() const
Returns the error code.
bool is_err() const
Returns true if an errors occurs.
Status(Status &&status) noexcept
Status(lb_error_t *err)
const char * message() const
Returns the error message.
Definition: async_result.hpp:7
struct lb_error_t lb_error_t
Definition: status.hpp:5