skia2/include/sksl/DSLBlock.h
John Stiles 91e4c7847e Remove C++14 workaround code.
We no longer support compiling in C++14, so we don't need these
workarounds anymore.

Change-Id: Idec5a90e98c242928182f4b32dd47459be8ca47f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/541075
Reviewed-by: Arman Uguray <armansito@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
Commit-Queue: Arman Uguray <armansito@google.com>
2022-05-18 13:53:00 +00:00

67 lines
1.4 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_BLOCK
#define SKSL_DSL_BLOCK
#include "include/private/SkSLDefines.h"
#include "include/private/SkTArray.h"
#include "include/sksl/DSLStatement.h"
#include "include/sksl/SkSLPosition.h"
#include <memory>
#include <utility>
namespace SkSL {
class Block;
class SymbolTable;
namespace dsl {
class DSLBlock {
public:
template<class... Statements>
DSLBlock(Statements... statements) {
fStatements.reserve_back(sizeof...(statements));
((void)fStatements.push_back(DSLStatement(statements.release()).release()), ...);
}
DSLBlock(DSLBlock&& other) = default;
DSLBlock(SkSL::StatementArray statements, std::shared_ptr<SymbolTable> symbols = nullptr,
Position pos = {});
DSLBlock(SkTArray<DSLStatement> statements, std::shared_ptr<SymbolTable> symbols = nullptr,
Position pos = {});
~DSLBlock();
DSLBlock& operator=(DSLBlock&& other) {
fStatements = std::move(other.fStatements);
return *this;
}
void append(DSLStatement stmt);
std::unique_ptr<SkSL::Block> release();
private:
SkSL::StatementArray fStatements;
std::shared_ptr<SkSL::SymbolTable> fSymbols;
Position fPosition;
friend class DSLStatement;
friend class DSLFunction;
};
} // namespace dsl
} // namespace SkSL
#endif