18bf80f4bSopenharmony_ci/*
28bf80f4bSopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
38bf80f4bSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
48bf80f4bSopenharmony_ci * you may not use this file except in compliance with the License.
58bf80f4bSopenharmony_ci * You may obtain a copy of the License at
68bf80f4bSopenharmony_ci *
78bf80f4bSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
88bf80f4bSopenharmony_ci *
98bf80f4bSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
108bf80f4bSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
118bf80f4bSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
128bf80f4bSopenharmony_ci * See the License for the specific language governing permissions and
138bf80f4bSopenharmony_ci * limitations under the License.
148bf80f4bSopenharmony_ci */
158bf80f4bSopenharmony_ci#include <base/math/matrix.h>
168bf80f4bSopenharmony_ci#include <base/math/quaternion.h>
178bf80f4bSopenharmony_ci#include <base/math/vector.h>
188bf80f4bSopenharmony_ci
198bf80f4bSopenharmony_ci#include <meta/base/meta_types.h>
208bf80f4bSopenharmony_ci#include <meta/base/namespace.h>
218bf80f4bSopenharmony_ci#include <meta/base/time_span.h>
228bf80f4bSopenharmony_ci#include <meta/base/type_traits.h>
238bf80f4bSopenharmony_ci#include <meta/ext/any_builder.h>
248bf80f4bSopenharmony_ci#include <meta/interface/animation/intf_animation.h>
258bf80f4bSopenharmony_ci#include <meta/interface/animation/intf_animation_controller.h>
268bf80f4bSopenharmony_ci#include <meta/interface/curves/intf_curve_1d.h>
278bf80f4bSopenharmony_ci#include <meta/interface/detail/any.h>
288bf80f4bSopenharmony_ci#include <meta/interface/intf_attach.h>
298bf80f4bSopenharmony_ci#include <meta/interface/intf_object_registry.h>
308bf80f4bSopenharmony_ci#include <meta/interface/loaders/intf_content_loader.h>
318bf80f4bSopenharmony_ci
328bf80f4bSopenharmony_ciMETA_BEGIN_NAMESPACE()
338bf80f4bSopenharmony_ci
348bf80f4bSopenharmony_ci// clang-format off
358bf80f4bSopenharmony_ciusing BasicTypes = TypeList<
368bf80f4bSopenharmony_ci    float,
378bf80f4bSopenharmony_ci    double,
388bf80f4bSopenharmony_ci    bool,
398bf80f4bSopenharmony_ci    uint8_t,
408bf80f4bSopenharmony_ci    uint16_t,
418bf80f4bSopenharmony_ci    uint32_t,
428bf80f4bSopenharmony_ci    uint64_t,
438bf80f4bSopenharmony_ci    int8_t,
448bf80f4bSopenharmony_ci    int16_t,
458bf80f4bSopenharmony_ci    int32_t,
468bf80f4bSopenharmony_ci    int64_t,
478bf80f4bSopenharmony_ci    BASE_NS::Uid,
488bf80f4bSopenharmony_ci    BASE_NS::string,
498bf80f4bSopenharmony_ci    BASE_NS::Math::Vec2,
508bf80f4bSopenharmony_ci    BASE_NS::Math::UVec2,
518bf80f4bSopenharmony_ci    BASE_NS::Math::IVec2,
528bf80f4bSopenharmony_ci    BASE_NS::Math::Vec3,
538bf80f4bSopenharmony_ci    BASE_NS::Math::UVec3,
548bf80f4bSopenharmony_ci    BASE_NS::Math::IVec3,
558bf80f4bSopenharmony_ci    BASE_NS::Math::Vec4,
568bf80f4bSopenharmony_ci    BASE_NS::Math::UVec4,
578bf80f4bSopenharmony_ci    BASE_NS::Math::IVec4,
588bf80f4bSopenharmony_ci    BASE_NS::Math::Quat,
598bf80f4bSopenharmony_ci    BASE_NS::Math::Mat3X3,
608bf80f4bSopenharmony_ci    BASE_NS::Math::Mat4X4,
618bf80f4bSopenharmony_ci    TimeSpan
628bf80f4bSopenharmony_ci    >;
638bf80f4bSopenharmony_ciusing ObjectTypes = TypeList<
648bf80f4bSopenharmony_ci    SharedPtrIInterface,
658bf80f4bSopenharmony_ci    SharedPtrConstIInterface,
668bf80f4bSopenharmony_ci    WeakPtrIInterface,
678bf80f4bSopenharmony_ci    WeakPtrConstIInterface,
688bf80f4bSopenharmony_ci    IObject::Ptr,
698bf80f4bSopenharmony_ci    IObject::ConstPtr,
708bf80f4bSopenharmony_ci    IObject::WeakPtr,
718bf80f4bSopenharmony_ci    IObject::ConstWeakPtr,
728bf80f4bSopenharmony_ci    IAny::Ptr,
738bf80f4bSopenharmony_ci    IContentLoader::Ptr,
748bf80f4bSopenharmony_ci    IProperty::WeakPtr,
758bf80f4bSopenharmony_ci    IAnimation::Ptr,
768bf80f4bSopenharmony_ci    IAnimation::WeakPtr,
778bf80f4bSopenharmony_ci    IAnimationController::WeakPtr,
788bf80f4bSopenharmony_ci    ICurve1D::Ptr,
798bf80f4bSopenharmony_ci    IAttach::WeakPtr,
808bf80f4bSopenharmony_ci    IFunction::Ptr,
818bf80f4bSopenharmony_ci    IFunction::ConstPtr,
828bf80f4bSopenharmony_ci    IFunction::WeakPtr
838bf80f4bSopenharmony_ci    >;
848bf80f4bSopenharmony_ci// clang-format on
858bf80f4bSopenharmony_ci
868bf80f4bSopenharmony_cinamespace Internal {
878bf80f4bSopenharmony_ci
888bf80f4bSopenharmony_citemplate<typename... List>
898bf80f4bSopenharmony_cistatic void RegisterTypes(IPropertyRegister& pr, TypeList<List...>)
908bf80f4bSopenharmony_ci{
918bf80f4bSopenharmony_ci    (pr.RegisterAny(CreateShared<DefaultAnyBuilder<Any<List>>>()), ...);
928bf80f4bSopenharmony_ci    (pr.RegisterAny(CreateShared<DefaultAnyBuilder<ArrayAny<List>>>()), ...);
938bf80f4bSopenharmony_ci}
948bf80f4bSopenharmony_ci
958bf80f4bSopenharmony_citemplate<typename... List>
968bf80f4bSopenharmony_cistatic void UnregisterTypes(IPropertyRegister& pr, TypeList<List...>)
978bf80f4bSopenharmony_ci{
988bf80f4bSopenharmony_ci    (pr.UnregisterAny(ArrayAny<List>::StaticGetClassId()), ...);
998bf80f4bSopenharmony_ci    (pr.UnregisterAny(Any<List>::StaticGetClassId()), ...);
1008bf80f4bSopenharmony_ci}
1018bf80f4bSopenharmony_ci
1028bf80f4bSopenharmony_civoid RegisterAnys(IObjectRegistry& registry)
1038bf80f4bSopenharmony_ci{
1048bf80f4bSopenharmony_ci    auto& pr = registry.GetPropertyRegister();
1058bf80f4bSopenharmony_ci    RegisterTypes(pr, BasicTypes {});
1068bf80f4bSopenharmony_ci    RegisterTypes(pr, ObjectTypes {});
1078bf80f4bSopenharmony_ci}
1088bf80f4bSopenharmony_ci
1098bf80f4bSopenharmony_civoid UnRegisterAnys(IObjectRegistry& registry)
1108bf80f4bSopenharmony_ci{
1118bf80f4bSopenharmony_ci    auto& pr = registry.GetPropertyRegister();
1128bf80f4bSopenharmony_ci    UnregisterTypes(pr, ObjectTypes {});
1138bf80f4bSopenharmony_ci    UnregisterTypes(pr, BasicTypes {});
1148bf80f4bSopenharmony_ci}
1158bf80f4bSopenharmony_ci
1168bf80f4bSopenharmony_ci} // namespace Internal
1178bf80f4bSopenharmony_ciMETA_END_NAMESPACE()
118