1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef OP_ITEM_H 17 #define OP_ITEM_H 18 19 #include <utility> 20 21 namespace OHOS { 22 namespace Rosen { 23 namespace Drawing { 24 class OpItem { 25 public: OpItem(uint32_t type)26 explicit OpItem(uint32_t type) : type_(type) {} 27 virtual ~OpItem() = default; 28 29 /** 30 * @brief Gets the offset of next OpItem. 31 */ GetNextOpItemOffset()32 size_t GetNextOpItemOffset() const 33 { 34 return nextOpItem_; 35 } 36 37 /** 38 * @brief Sets the offset of next OpItem. 39 * @param offset The offset of next OpItem. 40 */ SetNextOpItemOffset(size_t offset)41 void SetNextOpItemOffset(size_t offset) 42 { 43 nextOpItem_ = offset; 44 } 45 46 /** 47 * @brief Gets the type of OpItem. 48 */ GetType()49 uint32_t GetType() const 50 { 51 return type_; 52 } 53 54 OpItem(OpItem&&) = delete; 55 OpItem(const OpItem&) = default; 56 OpItem& operator=(OpItem&&) = delete; 57 OpItem& operator=(const OpItem&) = default; 58 private: 59 size_t nextOpItem_ = 0; 60 uint32_t type_; 61 }; 62 } // namespace Drawing 63 } // namespace Rosen 64 } // namespace OHOS 65 66 #endif // OP_ITEM_H 67