Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
third_party
skia
src
sksl
ir
SkSLSwitchCase.h
Go to the documentation of this file.
1
/*
2
* Copyright 2017 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_SWITCHCASE
9
#define SKSL_SWITCHCASE
10
11
#include "
include/private/base/SkAssert.h
"
12
#include "
src/sksl/SkSLDefines.h
"
13
#include "
src/sksl/SkSLPosition.h
"
14
#include "
src/sksl/ir/SkSLIRNode.h
"
15
#include "
src/sksl/ir/SkSLStatement.h
"
16
17
#include <memory>
18
#include <string>
19
#include <utility>
20
21
namespace
SkSL
{
22
23
/**
24
* A single case of a 'switch' statement.
25
*/
26
class
SwitchCase
final :
public
Statement
{
27
public
:
28
inline
static
constexpr
Kind
kIRNodeKind
= Kind::kSwitchCase;
29
30
static
std::unique_ptr<SwitchCase>
Make
(
Position
pos
,
31
SKSL_INT
value
,
32
std::unique_ptr<Statement>
statement
);
33
34
static
std::unique_ptr<SwitchCase>
MakeDefault
(
Position
pos
,
35
std::unique_ptr<Statement>
statement
);
36
37
bool
isDefault
()
const
{
38
return
fDefault;
39
}
40
41
SKSL_INT
value
()
const
{
42
SkASSERT
(!this->
isDefault
());
43
return
fValue;
44
}
45
46
std::unique_ptr<Statement>&
statement
() {
47
return
fStatement;
48
}
49
50
const
std::unique_ptr<Statement>&
statement
()
const
{
51
return
fStatement;
52
}
53
54
std::string
description
()
const override
;
55
56
private
:
57
SwitchCase
(
Position
pos
,
bool
isDefault
,
SKSL_INT
value
, std::unique_ptr<Statement>
statement
)
58
: INHERITED(
pos
,
kIRNodeKind
)
59
, fDefault(
isDefault
)
60
, fValue(
std
::move(
value
))
61
, fStatement(
std
::move(
statement
)) {}
62
63
bool
fDefault;
64
SKSL_INT
fValue;
65
std::unique_ptr<Statement> fStatement;
66
67
using
INHERITED = Statement;
68
};
69
70
}
// namespace SkSL
71
72
#endif
pos
SkPoint pos
Definition
ImageShaderTest.cpp:27
SkAssert.h
SkASSERT
#define SkASSERT(cond)
Definition
SkAssert.h:116
SkSLDefines.h
SKSL_INT
int64_t SKSL_INT
Definition
SkSLDefines.h:16
SkSLIRNode.h
SkSLPosition.h
SkSLStatement.h
SkSL::Position
Definition
SkSLPosition.h:18
SkSL::Statement
Definition
SkSLStatement.h:19
SkSL::SwitchCase
Definition
SkSLSwitchCase.h:26
SkSL::SwitchCase::MakeDefault
static std::unique_ptr< SwitchCase > MakeDefault(Position pos, std::unique_ptr< Statement > statement)
Definition
SkSLSwitchCase.cpp:19
SkSL::SwitchCase::value
SKSL_INT value() const
Definition
SkSLSwitchCase.h:41
SkSL::SwitchCase::isDefault
bool isDefault() const
Definition
SkSLSwitchCase.h:37
SkSL::SwitchCase::statement
const std::unique_ptr< Statement > & statement() const
Definition
SkSLSwitchCase.h:50
SkSL::SwitchCase::description
std::string description() const override
Definition
SkSLSwitchCase.cpp:25
SkSL::SwitchCase::Make
static std::unique_ptr< SwitchCase > Make(Position pos, SKSL_INT value, std::unique_ptr< Statement > statement)
Definition
SkSLSwitchCase.cpp:12
SkSL::SwitchCase::statement
std::unique_ptr< Statement > & statement()
Definition
SkSLSwitchCase.h:46
SkSL::SwitchCase::kIRNodeKind
static constexpr Kind kIRNodeKind
Definition
SkSLSwitchCase.h:28
SkSL
Definition
SkCapabilities.h:15
SkSL::StatementKind
StatementKind
Definition
SkSLIRNode.h:43
std
Definition
ref_ptr.h:256
Generated on Fri Apr 26 2024 06:17:32 for Flutter Engine by
1.9.8