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_PROPERTY_STACK_RESETABLE_H
17 #define META_INTERFACE_PROPERTY_STACK_RESETABLE_H
18 
19 #include <meta/base/interface_macros.h>
20 #include <meta/base/namespace.h>
21 #include <meta/base/types.h>
22 #include <meta/interface/intf_function.h>
23 
24 META_BEGIN_NAMESPACE()
25 
26 enum ResetResult : uint8_t {
27     RESET_CONTINUE = 0,  /// Continue evaluation of the stack (implied if no RESET_STOP)
28     RESET_STOP = 1,      /// Stop evaluating resets
29     RESET_REMOVE_ME = 2, /// Remove
30 };
31 
32 inline ResetResult operator|(ResetResult l, ResetResult r)
33 {
34     return ResetResult(uint8_t(l) | uint8_t(r));
35 }
36 
37 META_REGISTER_INTERFACE(IStackResetable, "b3f9bdc6-6b6f-43ff-b727-86f21e4e0c8d")
38 
39 class IStackResetable : public CORE_NS::IInterface {
40     META_INTERFACE(CORE_NS::IInterface, IStackResetable)
41 public:
42     virtual ResetResult ProcessOnReset(const IAny& defaultValue) = 0;
43 };
44 
45 META_INTERFACE_TYPE(IStackResetable);
46 
47 META_END_NAMESPACE()
48 
49 #endif
50