Open Lighting Architecture 0.10.9
Loading...
Searching...
No Matches
Result.h
Go to the documentation of this file.
1/*
2 * This library is free software; you can redistribute it and/or
3 * modify it under the terms of the GNU Lesser General Public
4 * License as published by the Free Software Foundation; either
5 * version 2.1 of the License, or (at your option) any later version.
6 *
7 * This library is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10 * Lesser General Public License for more details.
11 *
12 * You should have received a copy of the GNU Lesser General Public
13 * License along with this library; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
15 *
16 * Result.h
17 * Copyright (C) 2013 Simon Newton
18 */
19
25#ifndef INCLUDE_OLA_CLIENT_RESULT_H_
26#define INCLUDE_OLA_CLIENT_RESULT_H_
27
28#include <ola/base/Macro.h>
29#include <string>
30
31namespace ola {
32namespace client {
33
52class Result {
53 public:
58 explicit Result(const std::string &error)
59 : m_error(error) {
60 }
61
67 bool Success() const { return m_error.empty(); }
68
73 const std::string& Error() const { return m_error; }
74
75 private:
76 const std::string m_error;
77
78 Result(const Result &) = delete;
79 const Result &operator=(const Result &) = delete;
80};
81} // namespace client
82} // namespace ola
83#endif // INCLUDE_OLA_CLIENT_RESULT_H_
Helper macros.
Indicates the result of a OLA API call.
Definition Result.h:52
const std::string & Error() const
Returns the error message if the action failed.
Definition Result.h:73
Result(const std::string &error)
Definition Result.h:58
bool Success() const
Indicates the status of the action. If the action failed Error() can be used to fetch the error messa...
Definition Result.h:67
The namespace containing all OLA symbols.
Definition Credentials.cpp:44