1 /* 2 * Copyright (c) 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 16 #ifndef META_INTERFACE_SERIALIZATION_IGLOBAL_SERIALISATION_DATA_H 17 #define META_INTERFACE_SERIALIZATION_IGLOBAL_SERIALISATION_DATA_H 18 19 #include <base/containers/unique_ptr.h> 20 #include <core/plugin/intf_interface.h> 21 22 #include <meta/base/interface_macros.h> 23 #include <meta/base/namespace.h> 24 #include <meta/interface/intf_any.h> 25 #include <meta/interface/intf_object.h> 26 #include <meta/interface/serialization/intf_value_serializer.h> 27 28 META_BEGIN_NAMESPACE() 29 30 struct SerializationSettings { 31 /** 32 * @brief Export property default value. 33 */ 34 /** 35 * @brief Do not export native properties which have default value set 36 */ 37 /** 38 * @brief Do not export native properties which value is set the same as the set default value (non-binding) 39 * (user can set the same value as default and this is not considered as default value). 40 */ 41 /** 42 * @brief Do not export native properties which have non-serializable binding set. 43 */ 44 }; 45 46 /// Interface to access global serialization data 47 class IGlobalSerializationData : public CORE_NS::IInterface { 48 META_INTERFACE(CORE_NS::IInterface, IGlobalSerializationData, "f738d4d6-2575-4ae8-bb97-70a23bb6565a") 49 public: 50 /// Get global serialisation settings 51 virtual SerializationSettings GetDefaultSettings() const = 0; 52 /// Set global serialisation setting 53 virtual void SetDefaultSettings(const SerializationSettings& settings) = 0; 54 /// Register global object which is then serialised as reference 55 virtual void RegisterGlobalObject(const IObject::Ptr& object) = 0; 56 /// Unregister global object 57 virtual void UnregisterGlobalObject(const IObject::Ptr& object) = 0; 58 /// Get global object of given instance id 59 virtual IObject::Ptr GetGlobalObject(const InstanceId& id) const = 0; 60 /// Register value serializer for exporting and importing 61 virtual void RegisterValueSerializer(const IValueSerializer::Ptr&) = 0; 62 /// Unregister value serializer 63 virtual void UnregisterValueSerializer(const TypeId& id) = 0; 64 /// Get value serializer for given type id (that is, the type it serialises) 65 virtual IValueSerializer::Ptr GetValueSerializer(const TypeId& id) const = 0; 66 }; 67 68 META_INTERFACE_TYPE(META_NS::IGlobalSerializationData) 69 70 META_END_NAMESPACE() 71 72 #endif 73