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
15#pragma once
16
18#include <sese/util/Singleton.h>
19
20#define SESE_DEF_RESOURCE(resClass, resName, resSize, resBuf)\
21 class resClass final : public sese::res::Resource { \
22 public: \
23 resClass() : sese::res::Resource(resBuf, resSize) {} \
24 }
25
26#define SESE_MAKE_RESOURCE(resName, resBuf, resSize) \
27 std::make_shared<sese::res::Resource>(resName, resBuf, resSize)
28
29#define SESE_DEF_RES_STREAM(streamClass, streamSize, streamBuf) \
30 class streamClass final : public sese::res::ResourceStream { \
31 public: \
32 streamClass() : sese::res::ResourceStream(streamBuf, streamSize) {} \
33 };
34
35#define SESE_MAKE_RES_STREAM(streamBuf, streamSize) \
36 std::make_unique<sese::res::ResourceStream>(streamBuf, streamSize)
37
38#define SESE_ADD_RES(resName, resSize, resBuf) \
39 this->resourceMap[resName] = SESE_MAKE_RESOURCE(resName, resBuf, resSize);
40
41#define SESE_DEF_RES_MANAGER(managerName) \
42 class managerName final : public sese::res::ResourceManager { \
43 public: \
44 managerName() : sese::res::ResourceManager() {
45
46#define SESE_DEF_RES_MANAGER_END(managerName) \
47 } \
48 }; \
49 using managerName##Instance = sese::SingletonPtr<managerName>;