Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: tools/gn/escape.h

Issue 213353004: GN: Move towards only using / on Windows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: only generate / in various places Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 10 matching lines...) Expand all
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 24
25 ESCAPE_JSON = 4, 25 ESCAPE_JSON = 4,
26 }; 26 };
27 27
28 struct EscapeOptions { 28 struct EscapeOptions {
29 EscapeOptions() 29 EscapeOptions()
30 : mode(ESCAPE_NONE), 30 : mode(ESCAPE_NONE),
31 convert_slashes(false),
32 inhibit_quoting(false) { 31 inhibit_quoting(false) {
33 } 32 }
34 33
35 EscapingMode mode; 34 EscapingMode mode;
36 35
37 // When set, converts forward-slashes to system-specific path separators.
38 bool convert_slashes;
39
40 // When the escaping mode is ESCAPE_SHELL, the escaper will normally put 36 // When the escaping mode is ESCAPE_SHELL, the escaper will normally put
41 // quotes around things with spaces. If this value is set to true, we'll 37 // quotes around things with spaces. If this value is set to true, we'll
42 // disable the quoting feature and just add the spaces. 38 // disable the quoting feature and just add the spaces.
43 // 39 //
44 // This mode is for when quoting is done at some higher-level. Defaults to 40 // This mode is for when quoting is done at some higher-level. Defaults to
45 // false. 41 // false.
46 bool inhibit_quoting; 42 bool inhibit_quoting;
47 }; 43 };
48 44
49 // Escapes the given input, returnining the result. 45 // Escapes the given input, returnining the result.
50 // 46 //
51 // If needed_quoting is non-null, whether the string was or should have been 47 // If needed_quoting is non-null, whether the string was or should have been
52 // (if inhibit_quoting was set) quoted will be written to it. This value should 48 // (if inhibit_quoting was set) quoted will be written to it. This value should
53 // be initialized to false by the caller and will be written to only if it's 49 // be initialized to false by the caller and will be written to only if it's
54 // true (the common use-case is for chaining calls). 50 // true (the common use-case is for chaining calls).
55 std::string EscapeString(const base::StringPiece& str, 51 std::string EscapeString(const base::StringPiece& str,
56 const EscapeOptions& options, 52 const EscapeOptions& options,
57 bool* needed_quoting); 53 bool* needed_quoting);
58 54
59 // Same as EscapeString but writes the results to the given stream, saving a 55 // Same as EscapeString but writes the results to the given stream, saving a
60 // copy. 56 // copy.
61 void EscapeStringToStream(std::ostream& out, 57 void EscapeStringToStream(std::ostream& out,
62 const base::StringPiece& str, 58 const base::StringPiece& str,
63 const EscapeOptions& options); 59 const EscapeOptions& options);
64 60
65 #endif // TOOLS_GN_ESCAPE_H_ 61 #endif // TOOLS_GN_ESCAPE_H_
OLDNEW
« tools/gn/build_settings.cc ('K') | « tools/gn/command_desc.cc ('k') | tools/gn/escape.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698