Gazebo Fuel_tools

API Reference

4.9.1
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 #include <gz/fuel_tools/config.hh>
26 
27 #ifdef _WIN32
28 // Disable warning C4251 which is triggered by
29 // std::unique_ptr
30 #pragma warning(push)
31 #pragma warning(disable: 4251)
32 #endif
33 
34 namespace ignition
35 {
36  namespace fuel_tools
37  {
38  // forward declaration
39  class ResultPrivate;
40  class Model;
41 
43  enum class ResultType
44  {
46  UNKNOWN = 0,
47 
49  DELETE,
50 
53 
57 
59  FETCH,
60 
63 
66 
70 
72  UPLOAD,
73 
76 
80 
83 
85  PATCH,
86  };
87 
89  class IGNITION_FUEL_TOOLS_VISIBLE Result
90  {
92  public: Result();
93 
95  public: ~Result();
96 
99  public: explicit Result(const ResultType _type);
100 
103  public: Result(const Result &_result);
104 
107  public: Result(Result &&_result) noexcept; // NOLINT
108 
111  public: Result &operator=(const Result &_result);
112 
116  public: Result &operator=(Result &&_result) noexcept; // NOLINT
117 
120  public: ResultType Type() const;
121 
124  public: virtual operator bool() const;
125 
128  public: virtual std::string ReadableResult() const;
129 
131  private: std::unique_ptr<ResultPrivate> dataPtr;
132  };
133  }
134 }
135 
136 #ifdef _MSC_VER
137 #pragma warning(pop)
138 #endif
139 
140 #endif
virtual std::string ReadableResult() const
Get human readable result string.
STL class.
@ UPLOAD_ALREADY_EXISTS
Model already exists.
Class describing a result of an operation.
Definition: gz/fuel_tools/Result.hh:89
@ UNKNOWN
Uninitialized type.
ResultType
Result type.
Definition: gz/fuel_tools/Result.hh:43
Result()
Default constructor.
@ DELETE_ERROR
Delete failed. Other errors.
@ FETCH_NOT_FOUND
Model not found.
@ UPLOAD_ERROR
Upload failed. Other errors.
Result & operator=(const Result &_result)
Copy assignment operator.
@ FETCH_ERROR
Fetch failed. Other errors.
@ FETCH_ALREADY_EXISTS
Model already exists.
ResultType Type() const
Get the type of result.
@ DELETE_NOT_FOUND
Model not found.