1 /** 2 * Copyright (c) 2021-2022 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 LIBPANDAFILE_METHOD_HANDLE_DATA_ACCESSOR_H 17 #define LIBPANDAFILE_METHOD_HANDLE_DATA_ACCESSOR_H 18 19 #include "file.h" 20 #include "file_items.h" 21 22 namespace panda::panda_file { 23 24 // NOLINTNEXTLINE(cppcoreguidelines-special-member-functions, hicpp-special-member-functions) 25 class MethodHandleDataAccessor { 26 public: 27 MethodHandleDataAccessor(const File &panda_file, File::EntityId method_handle_id); 28 29 ~MethodHandleDataAccessor() = default; 30 GetType()31 MethodHandleType GetType() const 32 { 33 return type_; 34 } 35 GetSize()36 size_t GetSize() const 37 { 38 return size_; 39 } 40 GetPandaFile()41 const File &GetPandaFile() const 42 { 43 return panda_file_; 44 } 45 GetMethodHandleId()46 File::EntityId GetMethodHandleId() const 47 { 48 return method_handle_id_; 49 } 50 GetEntityId()51 File::EntityId GetEntityId() const 52 { 53 return File::EntityId(offset_); 54 } 55 56 private: 57 const File &panda_file_; 58 File::EntityId method_handle_id_; 59 60 MethodHandleType type_; 61 uint32_t offset_; 62 63 size_t size_ {0}; 64 }; 65 66 } // namespace panda::panda_file 67 68 #endif // LIBPANDAFILE_METHOD_HANDLE_DATA_ACCESSOR_H 69