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_ESCAPE_H_ | 5 #ifndef TOOLS_GN_ESCAPE_H_ |
6 #define TOOLS_GN_ESCAPE_H_ | 6 #define TOOLS_GN_ESCAPE_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
11 | 11 |
12 enum EscapingMode { | 12 enum EscapingMode { |
13 // No escaping. | 13 // No escaping. |
14 ESCAPE_NONE, | 14 ESCAPE_NONE, |
15 | 15 |
16 // Ninja string escaping. | 16 // Ninja string escaping. |
17 ESCAPE_NINJA = 1, | 17 ESCAPE_NINJA = 1, |
18 | 18 |
19 // Shell string escaping. | 19 // Shell string escaping. |
20 ESCAPE_SHELL = 2, | 20 ESCAPE_SHELL = 2, |
21 | 21 |
22 // For writing shell commands to ninja files. | 22 // For writing shell commands to ninja files. |
23 ESCAPE_NINJA_SHELL = ESCAPE_NINJA | ESCAPE_SHELL | 23 ESCAPE_NINJA_SHELL = ESCAPE_NINJA | ESCAPE_SHELL, |
24 | |
25 ESCAPE_JSON = 4, | |
scottmg
2013/10/15 19:58:21
probably should be "PYTHON_DICT" more correctly, b
| |
24 }; | 26 }; |
25 | 27 |
26 struct EscapeOptions { | 28 struct EscapeOptions { |
27 EscapeOptions() | 29 EscapeOptions() |
28 : mode(ESCAPE_NONE), | 30 : mode(ESCAPE_NONE), |
29 convert_slashes(false), | 31 convert_slashes(false), |
30 inhibit_quoting(false) { | 32 inhibit_quoting(false) { |
31 } | 33 } |
32 | 34 |
33 EscapingMode mode; | 35 EscapingMode mode; |
(...skipping 20 matching lines...) Expand all Loading... | |
54 const EscapeOptions& options, | 56 const EscapeOptions& options, |
55 bool* needed_quoting); | 57 bool* needed_quoting); |
56 | 58 |
57 // Same as EscapeString but writes the results to the given stream, saving a | 59 // Same as EscapeString but writes the results to the given stream, saving a |
58 // copy. | 60 // copy. |
59 void EscapeStringToStream(std::ostream& out, | 61 void EscapeStringToStream(std::ostream& out, |
60 const base::StringPiece& str, | 62 const base::StringPiece& str, |
61 const EscapeOptions& options); | 63 const EscapeOptions& options); |
62 | 64 |
63 #endif // TOOLS_GN_ESCAPE_H_ | 65 #endif // TOOLS_GN_ESCAPE_H_ |
OLD | NEW |