Stay organized with collections
Save and categorize content based on your preferences.
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(
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
)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-04-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-04-10 UTC."],[],[],null,["# google::play::Result Class Reference\n\ngoogle::play::Result\n====================\n\n\n`#include \u003clibraries/core/result.h\u003e`\n\nRepresents the outcome of an operation.\n\nSummary\n-------\n\nThis contains either a successful result with a value, or an error result with a error code and error message.\n\n| ### Constructors and Destructors ||\n|---|---|\n| [Result](#classgoogle_1_1play_1_1_result_1a15f06f490db525127057a359fd1c75dc)`(R code, const char *error_message)` ||\n| [Result](#classgoogle_1_1play_1_1_result_1ac69d05d9c8ad332e4020606af8b7a0be)`(V value)` ||\n| [Result](#classgoogle_1_1play_1_1_result_1ae7dcef355d3e881dfc6ab83173ee9147)`(R code, const char *error_message, V value)` ||\n\n| ### Public functions ||\n|------------------------------------------------------------------------------------------------|-----------------------------------------------------------|\n| [code](#classgoogle_1_1play_1_1_result_1ac7f206ec7d4cab8e26547a2deb270281)`() const ` | `R` Returns the error code associated with the result. |\n| [error_message](#classgoogle_1_1play_1_1_result_1acb25dbdfee0bd81f8185953edcd2ed33)`() const ` | `const std::string &` Returns the error message. |\n| [ok](#classgoogle_1_1play_1_1_result_1a29799d649b8f4445bd6c7f7af179ccfc)`() const ` | `bool` Returns true if the result is OK. |\n| [value](#classgoogle_1_1play_1_1_result_1a43ddba54fb9bf9f58e969a8792ae690c)`() const ` | `const V &` Returns the value associated with the result. |\n\n| ### Public static functions ||\n|------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|\n| [Error](#classgoogle_1_1play_1_1_result_1aa640c66a722becf4e760bf74a59b2419)`(R code, const char *error_message)` | [Result](/games/playgames/native-pc/reference/class/google/play/result#classgoogle_1_1play_1_1_result) |\n| [Ok](#classgoogle_1_1play_1_1_result_1a5f9a3aad208db65aa3f0b3baf4e25d87)`(V value)` | [Result](/games/playgames/native-pc/reference/class/google/play/result#classgoogle_1_1play_1_1_result) |\n\nPublic functions\n----------------\n\n### Result\n\n```gdscript\n Result(\n R code,\n const char *error_message\n)\n``` \n\n### Result\n\n```text\n Result(\n V value\n)\n``` \n\n### Result\n\n```gdscript\n Result(\n R code,\n const char *error_message,\n V value\n)\n``` \n\n### code\n\n```gdscript\nR code() const \n``` \nReturns the error code associated with the result. \n\n### error_message\n\n```gdscript\nconst std::string & error_message() const \n``` \nReturns the error message. \n\n### ok\n\n```gdscript\nbool ok() const \n``` \nReturns true if the result is OK. \n\n### value\n\n```gdscript\nconst V & value() const \n``` \nReturns the value associated with the result.\n\nOnly valid if the result is OK.\n\nPublic static functions\n-----------------------\n\n### Error\n\n```gdscript\nResult Error(\n R code,\n const char *error_message\n)\n``` \n\n### Ok\n\n```text\nResult Ok(\n V value\n)\n```"]]