diff options
Diffstat (limited to 'extensions/common/host_id.cc')
-rw-r--r-- | extensions/common/host_id.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/extensions/common/host_id.cc b/extensions/common/host_id.cc new file mode 100644 index 0000000..121e8e4 --- /dev/null +++ b/extensions/common/host_id.cc @@ -0,0 +1,32 @@ +// Copyright 2015 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "extensions/common/host_id.h" + +HostID::HostID() { +} + +HostID::HostID(HostType type, const std::string& id) + : type_(type), id_(id) { +} + +HostID::HostID(const HostID& host_id) + : type_(host_id.type()), + id_(host_id.id()) { +} + +HostID::~HostID() { +} + +bool HostID::operator<(const HostID& host_id) const { + if (type_ != host_id.type()) + return type_ < host_id.type(); + else if (id_ != host_id.id()) + return id_ < host_id.id(); + return false; +} + +bool HostID::operator==(const HostID& host_id) const { + return type_ == host_id.type() && id_ == host_id.id(); +} |