• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2016 Google Inc.
3  *
4  * Use of this source code is governed by a BSD-style license that can be
5  * found in the LICENSE file.
6  */
7 
8 #ifndef SKSL_MODIFIERDECLARATION
9 #define SKSL_MODIFIERDECLARATION
10 
11 #include "include/private/SkSLModifiers.h"
12 #include "include/private/SkSLProgramElement.h"
13 
14 namespace SkSL {
15 
16 /**
17  * A declaration that consists only of modifiers, e.g.:
18  *
19  * layout(blend_support_all_equations) out;
20  */
21 class ModifiersDeclaration final : public ProgramElement {
22 public:
23     inline static constexpr Kind kProgramElementKind = Kind::kModifiers;
24 
ModifiersDeclaration(const Modifiers * modifiers)25     ModifiersDeclaration(const Modifiers* modifiers)
26         : INHERITED(-1, kProgramElementKind)
27         , fModifiers(modifiers) {}
28 
modifiers()29     const Modifiers& modifiers() const {
30         return *fModifiers;
31     }
32 
clone()33     std::unique_ptr<ProgramElement> clone() const override {
34         return std::make_unique<ModifiersDeclaration>(&this->modifiers());
35     }
36 
description()37     String description() const override {
38         return this->modifiers().description() + ";";
39     }
40 
41 private:
42     const Modifiers* fModifiers;
43 
44     using INHERITED = ProgramElement;
45 };
46 
47 }  // namespace SkSL
48 
49 #endif
50