Gazebo Fuel_tools

API Reference

7.3.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 // TODO(jrivero): rename the DELETE method which is a reserved word in Windows
33 #undef DELETE
34 #endif
35 
36 namespace ignition
37 {
38  namespace fuel_tools
39  {
40  // forward declaration
41  class ResultPrivate;
42  class Model;
43 
45  enum class ResultType
46  {
48  UNKNOWN = 0,
49 
51  DELETE,
52 
55 
59 
61  FETCH,
62 
65 
68 
72 
74  UPLOAD,
75 
78 
82 
85 
87  PATCH,
88  };
89 
91  class IGNITION_FUEL_TOOLS_VISIBLE Result
92  {
94  public: Result();
95 
97  public: ~Result();
98 
101  public: explicit Result(const ResultType _type);
102 
105  public: Result(const Result &_result);
106 
109  public: Result(Result &&_result) noexcept; // NOLINT
110 
113  public: Result &operator=(const Result &_result);
114 
118  public: Result &operator=(Result &&_result) noexcept; // NOLINT
119 
122  public: ResultType Type() const;
123 
126  public: virtual operator bool() const;
127 
130  public: virtual std::string ReadableResult() const;
131 
133  private: std::unique_ptr<ResultPrivate> dataPtr;
134  };
135  }
136 }
137 
138 #ifdef _MSC_VER
139 #pragma warning(pop)
140 #endif
141 
142 #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:91
@ UNKNOWN
Uninitialized type.
ResultType
Result type.
Definition: gz/fuel_tools/Result.hh:45
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.