Unity Scopes API
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 #pragma once
20 
21 #include <memory>
22 #include <string>
23 
24 namespace unity
25 {
26 
27 namespace scopes
28 {
29 
30 namespace internal
31 {
32 
33 class OperationInfoImpl;
34 
35 }
36 
42 class OperationInfo final
43 {
44 public:
51  enum InfoCode
52  {
53  Unknown, // A code unknown to the run-time was used
54  NoInternet, // No internet access
55  PoorInternet, // Slow or intermittent internet access
56  NoLocationData, // No location data available
57  InaccurateLocationData, // Location data available, but "fuzzy"
58  ResultsIncomplete, // Results are incomplete (e.g. not all data sources could be reached)
59  DefaultSettingsUsed, // Default settings used; results may be better with explicit settings
60  SettingsProblem, // Some required settings were not provided (e.g. URL for data source)
61  LastInfoCode_ = SettingsProblem // Dummy end marker
62  };
63 
69 
75  OperationInfo(InfoCode code, std::string message);
76 
80  //{@
81  OperationInfo(OperationInfo const& other);
83 
84  OperationInfo& operator=(OperationInfo const& other);
85  OperationInfo& operator=(OperationInfo&&);
87 
89  ~OperationInfo();
91 
96  InfoCode code() const noexcept;
97 
102  std::string message() const;
103 
104 private:
105  std::unique_ptr<internal::OperationInfoImpl> p;
106 };
107 
108 } // namespace scopes
109 
110 } // namespace unity
std::string message() const
Get the message string.
Definition: OperationInfo.cpp:67
Top-level namespace for all things Unity-related.
Definition: Version.h:49
OperationInfo(InfoCode code)
Create OperationInfo with the given info code.
Definition: OperationInfo.cpp:28
Definition: ActionMetadata.h:31
InfoCode
Indicates the type of / cause for the information being reported.
Definition: OperationInfo.h:51
A container for details about something of interest that occurs during the operation of a request...
Definition: OperationInfo.h:42
InfoCode code() const noexcept
Get the info code.
Definition: OperationInfo.cpp:62