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_PATH_OUTPUT_H_ | 5 #ifndef TOOLS_GN_PATH_OUTPUT_H_ |
6 #define TOOLS_GN_PATH_OUTPUT_H_ | 6 #define TOOLS_GN_PATH_OUTPUT_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 const SourceDir& current_dir() const { return current_dir_; } | 42 const SourceDir& current_dir() const { return current_dir_; } |
43 | 43 |
44 // Getter/setters for flags inside the escape options. | 44 // Getter/setters for flags inside the escape options. |
45 bool inhibit_quoting() const { return options_.inhibit_quoting; } | 45 bool inhibit_quoting() const { return options_.inhibit_quoting; } |
46 void set_inhibit_quoting(bool iq) { options_.inhibit_quoting = iq; } | 46 void set_inhibit_quoting(bool iq) { options_.inhibit_quoting = iq; } |
47 void set_escape_platform(EscapingPlatform p) { options_.platform = p; } | 47 void set_escape_platform(EscapingPlatform p) { options_.platform = p; } |
48 | 48 |
49 void WriteFile(std::ostream& out, const SourceFile& file) const; | 49 void WriteFile(std::ostream& out, const SourceFile& file) const; |
50 void WriteFile(std::ostream& out, const OutputFile& file) const; | 50 void WriteFile(std::ostream& out, const OutputFile& file) const; |
51 void WriteFile(std::ostream& out, const base::FilePath& file) const; | 51 void WriteFile(std::ostream& out, const base::FilePath& file) const; |
| 52 |
| 53 // This variant assumes the dir ends in a trailing slash or is empty. |
52 void WriteDir(std::ostream& out, | 54 void WriteDir(std::ostream& out, |
53 const SourceDir& dir, | 55 const SourceDir& dir, |
54 DirSlashEnding slash_ending) const; | 56 DirSlashEnding slash_ending) const; |
55 | 57 |
| 58 void WriteDir(std::ostream& out, |
| 59 const OutputFile& file, |
| 60 DirSlashEnding slash_ending) const; |
| 61 |
56 // Backend for WriteFile and WriteDir. This appends the given file or | 62 // Backend for WriteFile and WriteDir. This appends the given file or |
57 // directory string to the file. | 63 // directory string to the file. |
58 void WritePathStr(std::ostream& out, const base::StringPiece& str) const; | 64 void WritePathStr(std::ostream& out, const base::StringPiece& str) const; |
59 | 65 |
60 private: | 66 private: |
61 // Takes the given string and writes it out, appending to the inverse | 67 // Takes the given string and writes it out, appending to the inverse |
62 // current dir. This assumes leading slashes have been trimmed. | 68 // current dir. This assumes leading slashes have been trimmed. |
63 void WriteSourceRelativeString(std::ostream& out, | 69 void WriteSourceRelativeString(std::ostream& out, |
64 const base::StringPiece& str) const; | 70 const base::StringPiece& str) const; |
65 | 71 |
66 SourceDir current_dir_; | 72 SourceDir current_dir_; |
67 | 73 |
68 // Uses system slashes if convert_slashes_to_system_. | 74 // Uses system slashes if convert_slashes_to_system_. |
69 std::string inverse_current_dir_; | 75 std::string inverse_current_dir_; |
70 | 76 |
71 // Since the inverse_current_dir_ depends on some of these, we don't expose | 77 // Since the inverse_current_dir_ depends on some of these, we don't expose |
72 // this directly to modification. | 78 // this directly to modification. |
73 EscapeOptions options_; | 79 EscapeOptions options_; |
74 }; | 80 }; |
75 | 81 |
76 #endif // TOOLS_GN_PATH_OUTPUT_H_ | 82 #endif // TOOLS_GN_PATH_OUTPUT_H_ |
OLD | NEW |