Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(452)

Side by Side Diff: tools/gn/output_file.h

Issue 26537002: Add a UniqueVector class to GN (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: REview comments, remove npos Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/gn/ninja_binary_target_writer_unittest.cc ('k') | tools/gn/source_dir.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_OUTPUT_FILE_H_ 5 #ifndef TOOLS_GN_OUTPUT_FILE_H_
6 #define TOOLS_GN_OUTPUT_FILE_H_ 6 #define TOOLS_GN_OUTPUT_FILE_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/containers/hash_tables.h"
10 #include "tools/gn/build_settings.h" 11 #include "tools/gn/build_settings.h"
11 #include "tools/gn/source_file.h" 12 #include "tools/gn/source_file.h"
12 13
13 // A simple wrapper around a string that indicates the string is a path 14 // A simple wrapper around a string that indicates the string is a path
14 // relative to the output directory. 15 // relative to the output directory.
15 class OutputFile { 16 class OutputFile {
16 public: 17 public:
17 OutputFile() : value_() {} 18 OutputFile() : value_() {}
18 explicit OutputFile(const base::StringPiece& str) 19 explicit OutputFile(const base::StringPiece& str)
19 : value_(str.data(), str.size()) { 20 : value_(str.data(), str.size()) {
(...skipping 14 matching lines...) Expand all
34 return value_ != other.value_; 35 return value_ != other.value_;
35 } 36 }
36 bool operator<(const OutputFile& other) const { 37 bool operator<(const OutputFile& other) const {
37 return value_ < other.value_; 38 return value_ < other.value_;
38 } 39 }
39 40
40 private: 41 private:
41 std::string value_; 42 std::string value_;
42 }; 43 };
43 44
45 namespace BASE_HASH_NAMESPACE {
46
47 #if defined(COMPILER_GCC)
48 template<> struct hash<OutputFile> {
49 std::size_t operator()(const OutputFile& v) const {
50 hash<std::string> h;
51 return h(v.value());
52 }
53 };
54 #elif defined(COMPILER_MSVC)
55 inline size_t hash_value(const OutputFile& v) {
56 return hash_value(v.value());
57 }
58 #endif // COMPILER...
59
60 } // namespace BASE_HASH_NAMESPACE
61
62 inline void swap(OutputFile& lhs, OutputFile& rhs) {
63 lhs.value().swap(rhs.value());
64 }
65
44 #endif // TOOLS_GN_OUTPUT_FILE_H_ 66 #endif // TOOLS_GN_OUTPUT_FILE_H_
OLDNEW
« no previous file with comments | « tools/gn/ninja_binary_target_writer_unittest.cc ('k') | tools/gn/source_dir.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698