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
3 // found in the LICENSE file.
5 #ifndef TOOLS_GN_OUTPUT_FILE_H_
6 #define TOOLS_GN_OUTPUT_FILE_H_
10 #include "tools/gn/build_settings.h"
11 #include "tools/gn/source_file.h"
13 // A simple wrapper around a string that indicates the string is a path
14 // relative to the output directory.
17 OutputFile() : value_() {}
18 explicit OutputFile(const base::StringPiece
& str
)
19 : value_(str
.data(), str
.size()) {
22 std::string
& value() { return value_
; }
23 const std::string
& value() const { return value_
; }
25 // Converts to a SourceFile by prepending the build directory to the file.
26 SourceFile
GetSourceFile(const BuildSettings
* build_settings
) const {
27 return SourceFile(build_settings
->build_dir().value() + value_
);
30 bool operator==(const OutputFile
& other
) const {
31 return value_
== other
.value_
;
33 bool operator!=(const OutputFile
& other
) const {
34 return value_
!= other
.value_
;
36 bool operator<(const OutputFile
& other
) const {
37 return value_
< other
.value_
;
44 #endif // TOOLS_GN_OUTPUT_FILE_H_