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_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 "base/containers/hash_tables.h" |
11 #include "tools/gn/build_settings.h" | 11 #include "tools/gn/build_settings.h" |
12 | 12 |
13 class SourceFile; | 13 class SourceFile; |
14 | 14 |
15 // A simple wrapper around a string that indicates the string is a path | 15 // A simple wrapper around a string that indicates the string is a path |
16 // relative to the output directory. | 16 // relative to the output directory. |
17 class OutputFile { | 17 class OutputFile { |
18 public: | 18 public: |
19 OutputFile(); | 19 OutputFile(); |
20 explicit OutputFile(const base::StringPiece& str); | 20 explicit OutputFile(std::string&& v); |
| 21 explicit OutputFile(const std::string& v); |
21 OutputFile(const BuildSettings* build_settings, | 22 OutputFile(const BuildSettings* build_settings, |
22 const SourceFile& source_file); | 23 const SourceFile& source_file); |
23 ~OutputFile(); | 24 ~OutputFile(); |
24 | 25 |
25 std::string& value() { return value_; } | 26 std::string& value() { return value_; } |
26 const std::string& value() const { return value_; } | 27 const std::string& value() const { return value_; } |
27 | 28 |
28 // Converts to a SourceFile by prepending the build directory to the file. | 29 // Converts to a SourceFile by prepending the build directory to the file. |
29 // The *Dir version requires that the current OutputFile ends in a slash, and | 30 // The *Dir version requires that the current OutputFile ends in a slash, and |
30 // the *File version is the opposite. | 31 // the *File version is the opposite. |
(...skipping 23 matching lines...) Expand all Loading... |
54 } | 55 } |
55 }; | 56 }; |
56 | 57 |
57 } // namespace BASE_HASH_NAMESPACE | 58 } // namespace BASE_HASH_NAMESPACE |
58 | 59 |
59 inline void swap(OutputFile& lhs, OutputFile& rhs) { | 60 inline void swap(OutputFile& lhs, OutputFile& rhs) { |
60 lhs.value().swap(rhs.value()); | 61 lhs.value().swap(rhs.value()); |
61 } | 62 } |
62 | 63 |
63 #endif // TOOLS_GN_OUTPUT_FILE_H_ | 64 #endif // TOOLS_GN_OUTPUT_FILE_H_ |
OLD | NEW |