Gazebo Fuel_tools

API Reference

8.2.0
gz/fuel_tools/Result.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef GZ_FUEL_TOOLS_RESULT_HH_
19 #define GZ_FUEL_TOOLS_RESULT_HH_
20 
21 #include <memory>
22 #include <string>
23 
24 #include "gz/fuel_tools/Export.hh"
25 
26 #ifdef _WIN32
27 // Disable warning C4251 which is triggered by
28 // std::unique_ptr
29 #pragma warning(push)
30 #pragma warning(disable: 4251)
31 // TODO(jrivero): rename the DELETE method which is a reserved word in Windows
32 #undef DELETE
33 #endif
34 
35 namespace gz
36 {
37  namespace fuel_tools
38  {
39  // forward declaration
40  class ResultPrivate;
41  class Model;
42 
44  enum class ResultType
45  {
47  UNKNOWN = 0,
48 
50  DELETE,
51 
54 
58 
60  FETCH,
61 
64 
67 
71 
73  UPLOAD,
74 
77 
81 
84 
86  PATCH,
87  };
88 
90  class GZ_FUEL_TOOLS_VISIBLE Result
91  {
93  public: Result();
94 
96  public: virtual ~Result();
97 
100  public: explicit Result(const ResultType _type);
101 
104  public: Result(const Result &_result);
105 
108  public: Result(Result &&_result) noexcept; // NOLINT
109 
112  public: Result &operator=(const Result &_result);
113 
117  public: Result &operator=(Result &&_result) noexcept; // NOLINT
118 
121  public: ResultType Type() const;
122 
125  public: virtual operator bool() const;
126 
129  public: virtual std::string ReadableResult() const;
130 
132  private: std::unique_ptr<ResultPrivate> dataPtr;
133  };
134  }
135 }
136 
137 #ifdef _MSC_VER
138 #pragma warning(pop)
139 #endif
140 
141 #endif