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_LOADERS_CONTENT_LOADER_H 17 #define META_INTERFACE_LOADERS_CONTENT_LOADER_H 18 19 #include <meta/base/meta_types.h> 20 #include <meta/interface/intf_object.h> 21 22 META_BEGIN_NAMESPACE() 23 24 META_REGISTER_INTERFACE(IContentLoader, "ad908b91-aab9-4962-a426-6fcecbf21261") 25 26 /** 27 * @brief The IContentLoader interface defines an interface for objects which 28 * can be used to create other objects. 29 * 30 * The most common use case is to use an IContentLoader object to automatically 31 * create ContentWidget content by setting the IContent::ContentLoader property. 32 */ 33 class IContentLoader : public CORE_NS::IInterface { 34 META_INTERFACE(CORE_NS::IInterface, IContentLoader) 35 public: 36 /** 37 * @brief Creates a new instance of the content this content loader can create. 38 * @param params Loader-specific parameters used for object creation. 39 */ 40 virtual IObject::Ptr Create(const IObject::Ptr& params) = 0; 41 }; 42 43 META_END_NAMESPACE() 44 45 META_TYPE(META_NS::IContentLoader::Ptr) 46 47 #endif 48