File: scope_per_file_provider.h

package info (click to toggle)
qtwebengine-opensource-src 5.11.3%2Bdfsg-2%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,551,988 kB
  • sloc: cpp: 10,064,061; ansic: 3,832,841; asm: 590,489; python: 455,759; xml: 261,729; sh: 90,157; objc: 77,089; perl: 71,296; makefile: 27,041; cs: 23,492; yacc: 14,360; tcl: 12,756; php: 4,714; lex: 4,028; pascal: 3,741; ml: 3,543; ruby: 1,497; lisp: 1,490; awk: 183; csh: 117; sed: 54
file content (51 lines) | stat: -rw-r--r-- 1,684 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright (c) 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef TOOLS_GN_SCOPE_PER_FILE_PROVIDER_H_
#define TOOLS_GN_SCOPE_PER_FILE_PROVIDER_H_

#include <memory>

#include "base/macros.h"
#include "tools/gn/scope.h"

// ProgrammaticProvider for a scope to provide it with per-file built-in
// variable support.
class ScopePerFileProvider : public Scope::ProgrammaticProvider {
 public:
  // allow_target_vars allows the target-related variables to get resolved.
  // When allow_target_vars is unset, the target-related values will be
  // undefined to GN script.
  ScopePerFileProvider(Scope* scope, bool allow_target_vars);
  ~ScopePerFileProvider() override;

  // ProgrammaticProvider implementation.
  const Value* GetProgrammaticValue(const base::StringPiece& ident) override;

 private:
  const Value* GetCurrentToolchain();
  const Value* GetDefaultToolchain();
  const Value* GetPythonPath();
  const Value* GetRootBuildDir();
  const Value* GetRootGenDir();
  const Value* GetRootOutDir();
  const Value* GetTargetGenDir();
  const Value* GetTargetOutDir();

  bool allow_target_vars_;

  // All values are lazily created.
  std::unique_ptr<Value> current_toolchain_;
  std::unique_ptr<Value> default_toolchain_;
  std::unique_ptr<Value> python_path_;
  std::unique_ptr<Value> root_build_dir_;
  std::unique_ptr<Value> root_gen_dir_;
  std::unique_ptr<Value> root_out_dir_;
  std::unique_ptr<Value> target_gen_dir_;
  std::unique_ptr<Value> target_out_dir_;

  DISALLOW_COPY_AND_ASSIGN(ScopePerFileProvider);
};

#endif  // TOOLS_GN_SCOPE_PER_FILE_PROVIDER_H_