/src/skia/src/sksl/ir/SkSLExtension.h
Line | Count | Source (jump to first uncovered line) |
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_EXTENSION |
9 | | #define SKSL_EXTENSION |
10 | | |
11 | | #include "include/private/SkSLProgramElement.h" |
12 | | |
13 | | namespace SkSL { |
14 | | |
15 | | /** |
16 | | * An extension declaration. |
17 | | */ |
18 | | class Extension final : public ProgramElement { |
19 | | public: |
20 | | static constexpr Kind kProgramElementKind = Kind::kExtension; |
21 | | |
22 | | Extension(int offset, skstd::string_view name) |
23 | | : INHERITED(offset, kProgramElementKind) |
24 | 73 | , fName(name) {} |
25 | | |
26 | 45 | skstd::string_view name() const { |
27 | 45 | return fName; |
28 | 45 | } |
29 | | |
30 | 0 | std::unique_ptr<ProgramElement> clone() const override { |
31 | 0 | return std::unique_ptr<ProgramElement>(new Extension(fOffset, this->name())); |
32 | 0 | } |
33 | | |
34 | 0 | String description() const override { |
35 | 0 | return "#extension " + this->name() + " : enable"; |
36 | 0 | } |
37 | | |
38 | | private: |
39 | | skstd::string_view fName; |
40 | | |
41 | | using INHERITED = ProgramElement; |
42 | | }; |
43 | | |
44 | | } // namespace SkSL |
45 | | |
46 | | #endif |