Flutter Engine
The Flutter Engine
|
#include <SkSLLiteral.h>
Public Member Functions | |
Literal (Position pos, double value, const Type *type) | |
float | floatValue () const |
SKSL_INT | intValue () const |
SKSL_INT | boolValue () const |
double | value () const |
std::string | description (OperatorPrecedence) const override |
ComparisonResult | compareConstant (const Expression &other) const override |
std::unique_ptr< Expression > | clone (Position pos) const override |
bool | supportsConstantValues () const override |
std::optional< double > | getConstantValue (int n) const override |
Public Member Functions inherited from SkSL::Expression | |
Expression (Position pos, Kind kind, const Type *type) | |
Kind | kind () const |
const Type & | type () const |
bool | isAnyConstructor () const |
bool | isIntLiteral () const |
bool | isFloatLiteral () const |
bool | isBoolLiteral () const |
AnyConstructor & | asAnyConstructor () |
const AnyConstructor & | asAnyConstructor () const |
bool | isIncomplete (const Context &context) const |
virtual ComparisonResult | compareConstant (const Expression &other) const |
CoercionCost | coercionCost (const Type &target) const |
virtual bool | supportsConstantValues () const |
virtual std::optional< double > | getConstantValue (int n) const |
virtual std::unique_ptr< Expression > | clone (Position pos) const =0 |
std::unique_ptr< Expression > | clone () const |
std::string | description () const final |
virtual std::string | description (OperatorPrecedence parentPrecedence) const =0 |
Public Member Functions inherited from SkSL::IRNode | |
virtual | ~IRNode () |
virtual std::string | description () const =0 |
IRNode (const IRNode &)=delete | |
IRNode & | operator= (const IRNode &)=delete |
Position | position () const |
void | setPosition (Position p) |
template<typename T > | |
bool | is () const |
template<typename T > | |
const T & | as () const |
template<typename T > | |
T & | as () |
Static Public Member Functions | |
static std::unique_ptr< Literal > | MakeFloat (const Context &context, Position pos, float value) |
static std::unique_ptr< Literal > | MakeFloat (Position pos, float value, const Type *type) |
static std::unique_ptr< Literal > | MakeInt (const Context &context, Position pos, SKSL_INT value) |
static std::unique_ptr< Literal > | MakeInt (Position pos, SKSL_INT value, const Type *type) |
static std::unique_ptr< Literal > | MakeBool (const Context &context, Position pos, bool value) |
static std::unique_ptr< Literal > | MakeBool (Position pos, bool value, const Type *type) |
static std::unique_ptr< Literal > | Make (Position pos, double value, 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::kLiteral |
Additional Inherited Members | |
Public Types inherited from SkSL::Expression | |
enum class | ComparisonResult { kUnknown = -1 , kNotEqual , kEqual } |
using | Kind = ExpressionKind |
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 |
A literal value. These can contain ints, floats, or booleans.
Definition at line 34 of file SkSLLiteral.h.
Definition at line 38 of file SkSLLiteral.h.
|
inline |
Definition at line 102 of file SkSLLiteral.h.
|
inlineoverridevirtual |
Implements SkSL::Expression.
Definition at line 122 of file SkSLLiteral.h.
|
inlineoverridevirtual |
Reimplemented from SkSL::Expression.
Definition at line 113 of file SkSLLiteral.h.
|
overridevirtual |
Implements SkSL::Expression.
Definition at line 13 of file SkSLLiteral.cpp.
|
inline |
Definition at line 92 of file SkSLLiteral.h.
|
inlineoverridevirtual |
Returns the n'th compile-time constant value within a literal or constructor. Use Type::slotCount to determine the number of slots within an expression. Slots which do not contain compile-time constant values will return nullopt. vec4(1, vec2(2), 3)
contains four compile-time constants: (1, 2, 2, 3) mat2(f)
contains four slots, and two are constant: (nullopt, 0, 0, nullopt) All classes which override this function must also implement supportsConstantValues
.
Reimplemented from SkSL::Expression.
Definition at line 130 of file SkSLLiteral.h.
|
inline |
Definition at line 97 of file SkSLLiteral.h.
|
inlinestatic |
Definition at line 81 of file SkSLLiteral.h.
|
inlinestatic |
Definition at line 69 of file SkSLLiteral.h.
|
inlinestatic |
Definition at line 43 of file SkSLLiteral.h.
|
inlinestatic |
Definition at line 54 of file SkSLLiteral.h.
|
inlinestatic |
Definition at line 59 of file SkSLLiteral.h.
|
inlineoverridevirtual |
Returns true if this expression type supports getConstantValue
. (This particular expression may or may not actually contain a constant value.) It's harmless to call getConstantValue
on expressions which don't support constant values or don't contain any constant values, but if supportsConstantValues
returns false, you can assume that getConstantValue
will return nullopt for every slot of this expression. This allows for early-out opportunities in some cases. (Some expressions have tons of slots but never hold a constant value; e.g. a variable holding a very large array.)
Reimplemented from SkSL::Expression.
Definition at line 126 of file SkSLLiteral.h.
|
inline |
Definition at line 107 of file SkSLLiteral.h.
|
inlinestaticconstexpr |
Definition at line 36 of file SkSLLiteral.h.