daed2592bb
In addition to the unsurprising changes to eliminate references to src/, we also had to tighten up some C++17-isms as they are not permitted in public headers. Change-Id: Ie5005a33d7a135e69fb66beca5e7a5f960dbd453 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/378496 Reviewed-by: Brian Osman <brianosman@google.com>
60 lines
1.3 KiB
C++
60 lines
1.3 KiB
C++
/*
|
|
* Copyright 2021 Google LLC.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SKSL_DSL_CASE
|
|
#define SKSL_DSL_CASE
|
|
|
|
#include "include/private/SkSLDefines.h"
|
|
#include "include/sksl/DSLExpression.h"
|
|
#include "include/sksl/DSLStatement.h"
|
|
|
|
#include <memory>
|
|
|
|
namespace SkSL {
|
|
|
|
class Statement;
|
|
|
|
namespace dsl {
|
|
|
|
class DSLCase {
|
|
public:
|
|
// An empty expression means 'default:'.
|
|
template<class... Statements>
|
|
DSLCase(DSLExpression value, Statements... statements)
|
|
: fValue(std::move(value)) {
|
|
fStatements.reserve_back(sizeof...(statements));
|
|
// in C++17, we could just do:
|
|
// (fStatements.push_back(DSLStatement(std::move(statements)).release()), ...);
|
|
int unused[] =
|
|
{0,
|
|
(static_cast<void>(fStatements.push_back(DSLStatement(std::move(statements)).release())),
|
|
0)...};
|
|
static_cast<void>(unused);
|
|
}
|
|
|
|
DSLCase(DSLCase&&);
|
|
|
|
DSLCase(DSLExpression value, SkSL::StatementArray statements);
|
|
|
|
~DSLCase();
|
|
|
|
void append(DSLStatement stmt);
|
|
|
|
private:
|
|
DSLExpression fValue;
|
|
SkSL::StatementArray fStatements;
|
|
|
|
template<class... Cases>
|
|
friend DSLPossibleStatement Switch(DSLExpression value, Cases... cases);
|
|
};
|
|
|
|
} // namespace dsl
|
|
|
|
} // namespace SkSL
|
|
|
|
#endif
|