MGL(Win32)
読み取り中…
検索中…
一致する文字列を見つけられません
mgl_savedata.h
[詳解]
1// SPDX-License-Identifier: Zlib
2/* ------------------------------------------------------------------------- */
9/* ------------------------------------------------------------------------- */
10
11#ifndef INCGUARD_MGL_SAVEDATA_H_1628644650
12#define INCGUARD_MGL_SAVEDATA_H_1628644650
13
16
17namespace MGL::Savedata
18{
19/* ------------------------------------------------------------------------- */
26/* ------------------------------------------------------------------------- */
27template <class DelegateClass, class... Args>
28inline int32_t CreateServer(Args... args) noexcept
29{
31 {
32 return false;
33 }
34
35 auto &server = Server::CreateInstance();
36
37 STL::unique_ptr<ServerDelegate> delegate = STL::make_unique<DelegateClass>(args...);
38
39 return server.Initialize(delegate);
40}
41
42/* ------------------------------------------------------------------------- */
47/* ------------------------------------------------------------------------- */
48[[nodiscard]] inline Server *GetServer() noexcept
49{
51 {
52 return &Server::GetInstance();
53 }
54
55 return nullptr;
56}
57
58bool SaveRequests(const STL::vector<RequestInfo> &requests, bool haltOnError = true) noexcept;
59bool SaveRequests(DataIdentifier identifier, uint32_t index = 0) noexcept;
60bool LoadRequests(const STL::vector<RequestInfo> &requests, bool haltOnError = true, bool errorOnFileNotExist = true) noexcept;
61bool LoadRequests(DataIdentifier identifier, uint32_t index = 0, bool errorOnFileNotExist = true) noexcept;
62
63bool SaveSynchronously(const STL::vector<RequestInfo> &requests, bool haltOnError = true) noexcept;
64bool SaveSynchronously(DataIdentifier identifier, uint32_t index = 0) noexcept;
65bool LoadSynchronously(const STL::vector<RequestInfo> &requests, bool haltOnError = true, bool errorOnFileNotExist = true) noexcept;
66bool LoadSynchronously(DataIdentifier identifier, uint32_t index = 0, bool errorOnFileNotExist = true) noexcept;
67
68[[nodiscard]] bool IsLoading() noexcept;
69[[nodiscard]] bool IsSaving() noexcept;
70[[nodiscard]] bool IsReady() noexcept;
71[[nodiscard]] bool IsProcessing() noexcept;
72[[nodiscard]] bool IsSucceeded() noexcept;
73[[nodiscard]] STL::vector<Result> GetLastResults() noexcept;
74bool Wait() noexcept;
75} // namespace MGL::Savedata
76
77#endif // INCGUARD_MGL_SAVEDATA_H_1628644650
78
79// vim: et ts=4 sw=4 sts=4
セーブデータサーバ
Definition mgl_savedata_server.h:26
static Server & CreateInstance(Args... args) noexcept
Definition mgl_singleton.h:52
static Server & GetInstance() noexcept
Definition mgl_singleton.h:74
static bool HasInstance() noexcept
Definition mgl_singleton.h:102
Server * GetServer() noexcept
セーブデータサーバの取得
Definition mgl_savedata.h:48
MGL セーブデータチャンク登録クラス
MGL セーブデータサーバ
std::vector< T, Allocator< T > > vector
std::vectorの代替
Definition mgl_stl_containers.h:51
std::unique_ptr< T, Deleter > unique_ptr
MGLのアロケータを利用するユニークポインタ
Definition mgl_stl_memory.h:247