| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef TOOLS_GN_LABEL_H_ | 5 #ifndef TOOLS_GN_LABEL_H_ |
| 6 #define TOOLS_GN_LABEL_H_ | 6 #define TOOLS_GN_LABEL_H_ |
| 7 | 7 |
| 8 #include "base/containers/hash_tables.h" | 8 #include "base/containers/hash_tables.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "tools/gn/source_dir.h" | 10 #include "tools/gn/source_dir.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // (one for operator==, one for <). | 76 // (one for operator==, one for <). |
| 77 if (dir_ != other.dir_) | 77 if (dir_ != other.dir_) |
| 78 return dir_ < other.dir_; | 78 return dir_ < other.dir_; |
| 79 if (name_ != other.name_) | 79 if (name_ != other.name_) |
| 80 return name_ < other.name_; | 80 return name_ < other.name_; |
| 81 if (toolchain_dir_ != other.toolchain_dir_) | 81 if (toolchain_dir_ != other.toolchain_dir_) |
| 82 return toolchain_dir_ < other.toolchain_dir_; | 82 return toolchain_dir_ < other.toolchain_dir_; |
| 83 return toolchain_name_ < other.toolchain_name_; | 83 return toolchain_name_ < other.toolchain_name_; |
| 84 } | 84 } |
| 85 | 85 |
| 86 void swap(Label& other) { |
| 87 dir_.swap(other.dir_); |
| 88 name_.swap(other.name_); |
| 89 toolchain_dir_.swap(other.toolchain_dir_); |
| 90 toolchain_name_.swap(other.toolchain_name_); |
| 91 } |
| 92 |
| 86 // Returns true if the toolchain dir/name of this object matches some | 93 // Returns true if the toolchain dir/name of this object matches some |
| 87 // other object. | 94 // other object. |
| 88 bool ToolchainsEqual(const Label& other) const { | 95 bool ToolchainsEqual(const Label& other) const { |
| 89 return toolchain_dir_ == other.toolchain_dir_ && | 96 return toolchain_dir_ == other.toolchain_dir_ && |
| 90 toolchain_name_ == other.toolchain_name_; | 97 toolchain_name_ == other.toolchain_name_; |
| 91 } | 98 } |
| 92 | 99 |
| 93 private: | 100 private: |
| 94 SourceDir dir_; | 101 SourceDir dir_; |
| 95 std::string name_; | 102 std::string name_; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 114 inline size_t hash_value(const Label& v) { | 121 inline size_t hash_value(const Label& v) { |
| 115 return ((hash_value(v.dir().value()) * 131 + | 122 return ((hash_value(v.dir().value()) * 131 + |
| 116 hash_value(v.name())) * 131 + | 123 hash_value(v.name())) * 131 + |
| 117 hash_value(v.toolchain_dir().value())) * 131 + | 124 hash_value(v.toolchain_dir().value())) * 131 + |
| 118 hash_value(v.toolchain_name()); | 125 hash_value(v.toolchain_name()); |
| 119 } | 126 } |
| 120 #endif // COMPILER... | 127 #endif // COMPILER... |
| 121 | 128 |
| 122 } // namespace BASE_HASH_NAMESPACE | 129 } // namespace BASE_HASH_NAMESPACE |
| 123 | 130 |
| 131 inline void swap(Label& lhs, Label& rhs) { |
| 132 lhs.swap(rhs); |
| 133 } |
| 134 |
| 124 #endif // TOOLS_GN_LABEL_H_ | 135 #endif // TOOLS_GN_LABEL_H_ |
| OLD | NEW |