/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
META_BEGIN_NAMESPACE()
// clang-format off
using BasicTypes = TypeList<
float,
double,
bool,
uint8_t,
uint16_t,
uint32_t,
uint64_t,
int8_t,
int16_t,
int32_t,
int64_t,
BASE_NS::Uid,
BASE_NS::string,
BASE_NS::Math::Vec2,
BASE_NS::Math::UVec2,
BASE_NS::Math::IVec2,
BASE_NS::Math::Vec3,
BASE_NS::Math::UVec3,
BASE_NS::Math::IVec3,
BASE_NS::Math::Vec4,
BASE_NS::Math::UVec4,
BASE_NS::Math::IVec4,
BASE_NS::Math::Quat,
BASE_NS::Math::Mat3X3,
BASE_NS::Math::Mat4X4,
TimeSpan
>;
using ObjectTypes = TypeList<
SharedPtrIInterface,
SharedPtrConstIInterface,
WeakPtrIInterface,
WeakPtrConstIInterface,
IObject::Ptr,
IObject::ConstPtr,
IObject::WeakPtr,
IObject::ConstWeakPtr,
IAny::Ptr,
IContentLoader::Ptr,
IProperty::WeakPtr,
IAnimation::Ptr,
IAnimation::WeakPtr,
IAnimationController::WeakPtr,
ICurve1D::Ptr,
IAttach::WeakPtr,
IFunction::Ptr,
IFunction::ConstPtr,
IFunction::WeakPtr
>;
// clang-format on
namespace Internal {
template
static void RegisterTypes(IPropertyRegister& pr, TypeList)
{
(pr.RegisterAny(CreateShared>>()), ...);
(pr.RegisterAny(CreateShared>>()), ...);
}
template
static void UnregisterTypes(IPropertyRegister& pr, TypeList)
{
(pr.UnregisterAny(ArrayAny::StaticGetClassId()), ...);
(pr.UnregisterAny(Any::StaticGetClassId()), ...);
}
void RegisterAnys(IObjectRegistry& registry)
{
auto& pr = registry.GetPropertyRegister();
RegisterTypes(pr, BasicTypes {});
RegisterTypes(pr, ObjectTypes {});
}
void UnRegisterAnys(IObjectRegistry& registry)
{
auto& pr = registry.GetPropertyRegister();
UnregisterTypes(pr, ObjectTypes {});
UnregisterTypes(pr, BasicTypes {});
}
} // namespace Internal
META_END_NAMESPACE()