18 #ifndef LUNCHBOX_RESULT_H
19 #define LUNCHBOX_RESULT_H
33 typedef void (
Result::*bool_t)()
const;
34 void bool_true()
const {}
37 static const int32_t SUCCESS = 0;
40 explicit Result(
const int32_t code ) : code_( code ){}
46 operator bool_t()
const {
return code_ == SUCCESS ? &Result::bool_true : 0;}
52 bool operator == (
const int32_t code )
const {
return code_ == code; }
55 bool operator != (
const int32_t code )
const {
return code != code_; }
62 {
return code_ == SUCCESS ?
"success" :
"result"; }
68 inline std::ostream&
operator << ( std::ostream& os,
const Result& result )
70 return os << result.getString() <<
" (" << result.getCode() <<
")";
74 #endif //LUNCHBOX_RESULT_H
Defines export visibility macros for library Lunchbox.
Basic type definitions not provided by the operating system.
virtual std::string getString() const
bool operator==(const int32_t code) const
A result returns an error code and behaves like a boolean.
Result(const int32_t code)
Construct a new result.
Abstraction layer and common utilities for multi-threaded programming.
std::ostream & operator<<(std::ostream &os, const Array< T > &array)
Pretty-print all members of the array.
virtual ~Result()
Destruct the result.
bool operator!=(const int32_t code) const
This file contains logging classes.