Unity Scopes API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
OperationInfo.h
1 /*
2  * Copyright (C) 2014 Canonical Ltd
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License version 3 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Marcus Tomlinson <marcus.tomlinson@canonical.com>
17  */
18 
19 #ifndef UNITY_SCOPES_OPERATIONINFO_H
20 #define UNITY_SCOPES_OPERATIONINFO_H
21 
22 #include <memory>
23 #include <string>
24 
25 namespace unity
26 {
27 
28 namespace scopes
29 {
30 
31 namespace internal
32 {
33 
34 class OperationInfoImpl;
35 
36 }
37 
43 class OperationInfo final
44 {
45 public:
52  enum InfoCode
53  {
54  Unknown, // A code unknown to the run-time was used
55  NoInternet, // No internet access
56  PoorInternet, // Slow or intermittent internet access
57  NoLocationData, // No location data available
58  InaccurateLocationData, // Location data available, but "fuzzy"
59  ResultsIncomplete, // Results are incomplete (e.g. not all data sources could be reached)
60  DefaultSettingsUsed, // Default settings used; results may be better with explicit settings
61  SettingsProblem, // Some required settings were not provided (e.g. URL for data source)
62  LastInfoCode_ = SettingsProblem // Dummy end marker
63  };
64 
70 
76  OperationInfo(InfoCode code, std::string message);
77 
81  //{@
82  OperationInfo(OperationInfo const& other);
84 
85  OperationInfo& operator=(OperationInfo const& other);
86  OperationInfo& operator=(OperationInfo&&);
88 
90  ~OperationInfo();
92 
97  InfoCode code() const noexcept;
98 
103  std::string message() const;
104 
105 private:
106  std::unique_ptr<internal::OperationInfoImpl> p;
107 };
108 
109 } // namespace scopes
110 
111 } // namespace unity
112 
113 #endif
std::string message() const
Get the message string.
Definition: OperationInfo.cpp:67
OperationInfo(InfoCode code)
Create OperationInfo with the given info code.
Definition: OperationInfo.cpp:28
InfoCode
Indicates the type of / cause for the information being reported.
Definition: OperationInfo.h:52
A container for details about something of interest that occurs during the operation of a request...
Definition: OperationInfo.h:43
InfoCode code() const noexcept
Get the info code.
Definition: OperationInfo.cpp:62