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 #ifndef PANDA_TOOLING_PT_LANG_EXTENSION_H 16 #define PANDA_TOOLING_PT_LANG_EXTENSION_H 17 18 #include "runtime/include/tooling/pt_object.h" 19 #include "runtime/include/tooling/pt_property.h" 20 #include "runtime/include/tooling/pt_value.h" 21 22 // TODO(maksenov): remove this file after refactoring ets_runtime 23 namespace panda::tooling { 24 class PtMethod { 25 public: 26 PtMethod() = default; PtMethod(void *)27 explicit PtMethod(void * /* unused */) {} 28 }; 29 30 class PtClass { 31 public: 32 PtClass() = default; PtClass(void *)33 explicit PtClass(void * /* unused */) {} 34 }; 35 36 class PtLangExt { 37 public: 38 PtLangExt() = default; 39 virtual ~PtLangExt() = default; 40 41 // PtValue API 42 virtual PtObject ValueToObject(PtValue value) const = 0; 43 44 // PtClass API 45 virtual PtClass GetClass(PtObject object) const = 0; 46 virtual PtClass GetClass(PtProperty property) const = 0; 47 virtual void ReleaseClass(PtClass klass) const = 0; 48 virtual const char *GetClassDescriptor(PtClass klass) const = 0; 49 50 // PtObject API 51 virtual PandaList<PtProperty> GetProperties(PtObject object) const = 0; 52 virtual PtProperty GetProperty(PtObject object, const char *propertyName) const = 0; 53 virtual bool AddProperty(PtObject object, const char *propertyName, PtValue value) const = 0; 54 virtual bool RemoveProperty(PtObject object, const char *propertyName) const = 0; 55 56 // PtProperty API 57 virtual const char *GetPropertyName(PtProperty propery) const = 0; 58 virtual PtValue GetPropertyValue(PtProperty property) const = 0; 59 virtual void SetPropertyPtValue(PtProperty property, PtValue value) const = 0; 60 virtual void ReleasePtValue(const PtValue *value) const = 0; 61 62 NO_COPY_SEMANTIC(PtLangExt); 63 NO_MOVE_SEMANTIC(PtLangExt); 64 }; 65 } // namespace panda::tooling 66 67 #endif // PANDA_TOOLING_PT_LANG_EXTENSION_H 68