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_DYNAMIC_CONTENT_LOADER_H
17 #define META_INTERFACE_LOADERS_DYNAMIC_CONTENT_LOADER_H
18 
19 #include <meta/interface/interface_macros.h>
20 #include <meta/interface/property/property_events.h>
21 
22 #include "intf_content_loader.h"
23 
24 META_BEGIN_NAMESPACE()
25 
26 META_REGISTER_INTERFACE(IDynamicContentLoader, "273e318f-6edc-423c-b27d-f842c48cac8d")
27 
28 /**
29  * @brief The IDynamicContentLoader interface defines an interface for content loaders
30  *        whose content can change at runtime.
31  *
32  *        For example, a content loader which loads its content from a file can implement
33  *        IDynamicContentLoader to inform its users of a change in the content returned
34  *        by Create() call.
35  *
36  */
37 class IDynamicContentLoader : public IContentLoader {
38     META_INTERFACE(IContentLoader, IDynamicContentLoader)
39 public:
40     /**
41      * @brief ContentChanged event is invoked when the content created by this content loader
42      *        has changed.
43      *
44      *        If the users want to stay up to date, they should call Create() again after
45      *        ContentChanged event has been invoked.
46      */
47     META_EVENT(IOnChanged, ContentChanged)
48 
49     /**
50      * @brief Reload content loaded by this content loader. Causes ContentChanged event to
51      *        be invoked.
52      */
53     virtual void Reload() = 0;
54 };
55 
56 META_END_NAMESPACE()
57 
58 #endif
59