Index: ash/public/cpp/app_launch_id.cc |
diff --git a/ash/public/cpp/app_launch_id.cc b/ash/public/cpp/app_launch_id.cc |
index fc437c3afe5deb63f1808241b80a8cf0d23f7f13..a32cb6dfc4cf2eead20c927b3efc5c94860ef5bb 100644 |
--- a/ash/public/cpp/app_launch_id.cc |
+++ b/ash/public/cpp/app_launch_id.cc |
@@ -11,15 +11,30 @@ namespace ash { |
AppLaunchId::AppLaunchId(const std::string& app_id, |
const std::string& launch_id) |
: app_id_(app_id), launch_id_(launch_id) { |
- DCHECK(!app_id.empty()); |
+ DCHECK(launch_id.empty() || !app_id.empty()) << "launch ids require app ids."; |
} |
-AppLaunchId::AppLaunchId(const std::string& app_id) : app_id_(app_id) { |
- DCHECK(!app_id.empty()); |
-} |
+AppLaunchId::AppLaunchId(const std::string& app_id) : app_id_(app_id) {} |
James Cook
2017/05/04 16:38:48
optional: = default (and below)
msw
2017/05/04 19:05:56
Doneish, it works for the empty-arg default ctor a
|
AppLaunchId::AppLaunchId() {} |
AppLaunchId::~AppLaunchId() {} |
+bool AppLaunchId::operator==(const AppLaunchId& other) const { |
+ return app_id_ == other.app_id_ && launch_id_ == other.launch_id_; |
+} |
+ |
+bool AppLaunchId::operator!=(const AppLaunchId& other) const { |
+ return !(*this == other); |
+} |
+ |
+bool AppLaunchId::operator<(const AppLaunchId& other) const { |
+ return app_id_ < other.app_id_ || |
+ (app_id_ == other.app_id_ && launch_id_ < other.launch_id_); |
+} |
+ |
+bool AppLaunchId::IsEmpty() const { |
+ return app_id_.empty() && launch_id_.empty(); |
+} |
+ |
} // namespace ash |