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.
4
5 #include "gn/config_values_extractors.h"
6
7 #include "gn/escape.h"
8
9 namespace {
10
11 class EscapedStringWriter {
12 public:
EscapedStringWriter(const EscapeOptions & escape_options)13 explicit EscapedStringWriter(const EscapeOptions& escape_options)
14 : escape_options_(escape_options) {}
15
operator ()(const std::string & s,std::ostream & out) const16 void operator()(const std::string& s, std::ostream& out) const {
17 out << " ";
18 EscapeStringToStream(out, s, escape_options_);
19 }
20
21 private:
22 const EscapeOptions& escape_options_;
23 };
24
25 } // namespace
26
RecursiveTargetConfigStringsToStream(RecursiveWriterConfig config,const Target * target,const std::vector<std::string> & (ConfigValues::* getter)()const,const EscapeOptions & escape_options,std::ostream & out)27 void RecursiveTargetConfigStringsToStream(
28 RecursiveWriterConfig config,
29 const Target* target,
30 const std::vector<std::string>& (ConfigValues::*getter)() const,
31 const EscapeOptions& escape_options,
32 std::ostream& out) {
33 RecursiveTargetConfigToStream(config, target, getter,
34 EscapedStringWriter(escape_options), out);
35 }
36