google::play::Result

#include <libraries/core/result.h>

Represents the outcome of an operation.

Summary

This contains either a successful result with a value, or an error result with a error code and error message.

Constructors and Destructors

Result(R code, const char *error_message)
Result(V value)
Result(R code, const char *error_message, V value)

Public functions

code() const
R
Returns the error code associated with the result.
error_message() const
const std::string &
Returns the error message.
ok() const
bool
Returns true if the result is OK.
value() const
const V &
Returns the value associated with the result.

Public static functions

Error(R code, const char *error_message)
Ok(V value)

Public functions

Result

 Result(
  R code,
  const char *error_message
)

Result

 Result(
  V value
)

Result

 Result(
  R code,
  const char *error_message,
  V value
)

code

R code() const 

Returns the error code associated with the result.

error_message

const std::string & error_message() const 

Returns the error message.

ok

bool ok() const 

Returns true if the result is OK.

value

const V & value() const 

Returns the value associated with the result.

Only valid if the result is OK.

Public static functions

Error

Result Error(
  R code,
  const char *error_message
)

Ok

Result Ok(
  V value
)