Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
|
tfarina
2015/12/17 18:52:44
no (c)
agrieve
2015/12/17 19:33:34
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef TOOLS_GN_LIB_FILE_H_ | |
| 6 #define TOOLS_GN_LIB_FILE_H_ | |
| 7 | |
| 8 #include <algorithm> | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/strings/string_piece.h" | |
| 12 #include "tools/gn/source_file.h" | |
| 13 | |
| 14 // Represents a file within the source tree. Always begins in a slash, never | |
|
tfarina
2015/12/17 18:52:44
This is too vague. A file could be anything. But t
agrieve
2015/12/17 19:33:34
Done.
| |
| 15 // ends in one. | |
| 16 class LibFile { | |
| 17 public: | |
| 18 LibFile(); | |
| 19 explicit LibFile(const base::StringPiece& lib_name); | |
| 20 explicit LibFile(const SourceFile& source_file); | |
| 21 | |
| 22 void swap(LibFile& other); | |
|
tfarina
2015/12/17 18:52:44
no non-const references.
agrieve
2015/12/17 19:33:34
Done.
| |
| 23 bool is_source_file() const { return name_.empty(); } | |
|
tfarina
2015/12/17 18:52:44
I would add a blank line after this.
agrieve
2015/12/17 19:33:34
Done.
| |
| 24 // Returns name, or source_file().value() (whichever is set). | |
| 25 const std::string& value() const; | |
| 26 const SourceFile& source_file() const; | |
| 27 | |
| 28 bool operator==(const LibFile& other) const { | |
| 29 return value() == other.value(); | |
| 30 } | |
| 31 bool operator!=(const LibFile& other) const { | |
| 32 return !operator==(other); | |
| 33 } | |
| 34 bool operator<(const LibFile& other) const { | |
| 35 return value() < other.value(); | |
| 36 } | |
|
tfarina
2015/12/17 18:52:44
blank line
agrieve
2015/12/17 19:33:34
Done.
| |
| 37 private: | |
| 38 std::string name_; | |
| 39 SourceFile source_file_; | |
| 40 }; | |
| 41 | |
| 42 namespace BASE_HASH_NAMESPACE { | |
| 43 | |
| 44 template<> struct hash<LibFile> { | |
| 45 std::size_t operator()(const LibFile& v) const { | |
| 46 hash<std::string> h; | |
| 47 return h(v.value()); | |
| 48 } | |
| 49 }; | |
| 50 | |
| 51 } // namespace BASE_HASH_NAMESPACE | |
| 52 | |
| 53 inline void swap(LibFile& lhs, LibFile& rhs) { | |
| 54 lhs.swap(rhs); | |
| 55 } | |
| 56 | |
| 57 #endif // TOOLS_GN_LIB_FILE_H_ | |
| OLD | NEW |