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 Extension(int offset,String name)22 Extension(int offset, String name) 23 : INHERITED(offset, kProgramElementKind) 24 , fName(std::move(name)) {} 25 name()26 const String& name() const { 27 return fName; 28 } 29 clone()30 std::unique_ptr<ProgramElement> clone() const override { 31 return std::unique_ptr<ProgramElement>(new Extension(fOffset, this->name())); 32 } 33 description()34 String description() const override { 35 return "#extension " + this->name() + " : enable"; 36 } 37 38 private: 39 String fName; 40 41 using INHERITED = ProgramElement; 42 }; 43 44 } // namespace SkSL 45 46 #endif 47