1 /** 2 * Copyright (c) 2021-2024 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 // NOTE(maksenov): remove this file after refactoring js_runtime 23 // NOTE(a.urakov): move here current InspectorExtension instead 24 namespace ark::tooling { 25 class PtMethod { 26 public: 27 PtMethod() = default; PtMethod(void *)28 explicit PtMethod(void * /* unused */) {} 29 }; 30 31 class PtClass { 32 public: 33 PtClass() = default; PtClass(void *)34 explicit PtClass(void * /* unused */) {} 35 }; 36 37 class PtLangExt { 38 public: 39 PtLangExt() = default; 40 virtual ~PtLangExt() = default; 41 42 // PtValue API 43 virtual PtObject ValueToObject(PtValue value) const = 0; 44 45 // PtClass API 46 virtual PtClass GetClass(PtObject object) const = 0; 47 virtual PtClass GetClass(PtProperty property) const = 0; 48 virtual void ReleaseClass(PtClass klass) const = 0; 49 virtual const char *GetClassDescriptor(PtClass klass) const = 0; 50 51 // PtObject API 52 virtual PandaList<PtProperty> GetProperties(PtObject object) const = 0; 53 virtual PtProperty GetProperty(PtObject object, const char *propertyName) const = 0; 54 virtual bool AddProperty(PtObject object, const char *propertyName, PtValue value) const = 0; 55 virtual bool RemoveProperty(PtObject object, const char *propertyName) const = 0; 56 57 // PtProperty API 58 virtual const char *GetPropertyName(PtProperty propery) const = 0; 59 virtual PtValue GetPropertyValue(PtProperty property) const = 0; 60 virtual void SetPropertyPtValue(PtProperty property, PtValue value) const = 0; 61 virtual void ReleasePtValue(const PtValue *value) const = 0; 62 63 NO_COPY_SEMANTIC(PtLangExt); 64 NO_MOVE_SEMANTIC(PtLangExt); 65 }; 66 } // namespace ark::tooling 67 68 #endif // PANDA_TOOLING_PT_LANG_EXTENSION_H 69