Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
SkSL::StructDefinition Class Referencefinal

#include <SkSLStructDefinition.h>

Inheritance diagram for SkSL::StructDefinition:
SkSL::ProgramElement SkSL::IRNode SkSL::Poolable

Public Member Functions

 StructDefinition (Position pos, const Type &type)
 
const Typetype () const
 
std::string description () const override
 
- Public Member Functions inherited from SkSL::ProgramElement
 ProgramElement (Position pos, Kind kind)
 
Kind kind () const
 
- Public Member Functions inherited from SkSL::IRNode
virtual ~IRNode ()
 
virtual std::string description () const =0
 
 IRNode (const IRNode &)=delete
 
IRNodeoperator= (const IRNode &)=delete
 
Position position () const
 
void setPosition (Position p)
 
template<typename T >
bool is () const
 
template<typename T >
const Tas () const
 
template<typename T >
Tas ()
 

Static Public Member Functions

static std::unique_ptr< StructDefinitionConvert (const Context &context, Position pos, std::string_view name, skia_private::TArray< Field > fields)
 
static std::unique_ptr< StructDefinitionMake (Position pos, const Type &type)
 
- Static Public Member Functions inherited from SkSL::Poolable
static void * operator new (const size_t size)
 
static void operator delete (void *ptr)
 

Static Public Attributes

static constexpr Kind kIRNodeKind = Kind::kStructDefinition
 

Additional Inherited Members

- Public Types inherited from SkSL::ProgramElement
using Kind = ProgramElementKind
 
- Public Attributes inherited from SkSL::IRNode
Position fPosition
 
- Protected Member Functions inherited from SkSL::IRNode
 IRNode (Position position, int kind)
 
- Protected Attributes inherited from SkSL::IRNode
int fKind
 

Detailed Description

A struct at global scope, as in:

struct RenderData { float3 color; bool highQuality; };

Definition at line 33 of file SkSLStructDefinition.h.

Constructor & Destructor Documentation

◆ StructDefinition()

SkSL::StructDefinition::StructDefinition ( Position  pos,
const Type type 
)
inline

Definition at line 37 of file SkSLStructDefinition.h.

38 : INHERITED(pos, kIRNodeKind)
39 , fType(&type) {}
SkPoint pos
const Type & type() const
static constexpr Kind kIRNodeKind

Member Function Documentation

◆ Convert()

std::unique_ptr< StructDefinition > SkSL::StructDefinition::Convert ( const Context context,
Position  pos,
std::string_view  name,
skia_private::TArray< Field fields 
)
static

Definition at line 23 of file SkSLStructDefinition.cpp.

26 {
27 std::unique_ptr<Type> ownedType = Type::MakeStructType(context, pos, name,
28 std::move(fields),
29 /*interfaceBlock=*/false);
30 const SkSL::Type* type = context.fSymbolTable->add(context, std::move(ownedType));
32}
static std::unique_ptr< StructDefinition > Make(Position pos, const Type &type)
static std::unique_ptr< Type > MakeStructType(const Context &context, Position pos, std::string_view name, skia_private::TArray< Field > fields, bool interfaceBlock=false)
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ description()

std::string SkSL::StructDefinition::description ( ) const
overridevirtual

Implements SkSL::IRNode.

Definition at line 38 of file SkSLStructDefinition.cpp.

38 {
39 std::string s = "struct ";
40 s += this->type().name();
41 s += " { ";
42 for (const auto& f : this->type().fields()) {
43 s += f.fLayout.description();
44 s += f.fModifierFlags.description();
45 s += ' ';
46 s += f.fType->description();
47 s += ' ';
48 s += f.fName;
49 s += "; ";
50 }
51 s += "};";
52 return s;
53}
std::string_view name() const
Definition: SkSLSymbol.h:51
struct MyStruct s

◆ Make()

std::unique_ptr< StructDefinition > SkSL::StructDefinition::Make ( Position  pos,
const Type type 
)
static

Definition at line 34 of file SkSLStructDefinition.cpp.

34 {
35 return std::make_unique<SkSL::StructDefinition>(pos, type);
36}

◆ type()

const Type & SkSL::StructDefinition::type ( ) const
inline

Definition at line 48 of file SkSLStructDefinition.h.

48 {
49 return *fType;
50 }

Member Data Documentation

◆ kIRNodeKind

constexpr Kind SkSL::StructDefinition::kIRNodeKind = Kind::kStructDefinition
inlinestaticconstexpr

Definition at line 35 of file SkSLStructDefinition.h.


The documentation for this class was generated from the following files: