Sese Framework
x.y.z
A cross-platform framework
载入中...
搜索中...
未找到
Marco.h
浏览该文件的文档.
1
// Copyright 2024 libsese
2
//
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
22
#pragma once
23
24
#include "
sese/plugin/ModuleInfo.h
"
25
#include "
sese/Util.h
"
26
27
#ifdef SESE_PLATFORM_WINDOWS
28
#define SESE_EXTERN extern "C" __declspec(dllexport)
29
#else
30
#define SESE_EXTERN extern "C"
31
#endif
32
33
#define GET_MODULE_INFO_FUNC_NAME getModuleInfo
34
#define GET_CLASS_FACTORY_FUNC_NAME getFactory
35
36
#define REGISTER_CLASS(type) \
37
{ \
38
auto t = &typeid(type); \
39
auto real_name = sese::getClassName(t); \
40
this->infoMap[real_name] = {t, [] { return std::make_shared<type>(); }}; \
41
} \
42
SESE_MARCO_END
43
44
#define DEFINE_CLASS_FACTORY(name, version, description) \
45
class name final : public sese::plugin::ClassFactory { \
46
public: \
47
name() : ClassFactory() { \
48
} \
49
void init() override; \
50
}; \
51
SESE_EXTERN sese::plugin::ModuleInfo *GET_MODULE_INFO_FUNC_NAME() { \
52
static sese::plugin::ModuleInfo info{#name, version, description}; \
53
return &info; \
54
} \
55
SESE_EXTERN sese::plugin::ClassFactory *GET_CLASS_FACTORY_FUNC_NAME() { \
56
static name factory; \
57
return &factory; \
58
} \
59
void name::init()
sese
plugin
Marco.h
生成于 2024年 十一月 4日 星期一 09:58:02 , 为 Sese Framework使用
1.11.0