2021-12-05 17:54:36 +00:00
|
|
|
#pragma once
|
|
|
|
|
2023-03-17 14:36:21 +00:00
|
|
|
#include "CDClientDatabase.h"
|
2024-02-09 13:37:58 +00:00
|
|
|
#include "CDClientManager.h"
|
2023-03-17 14:36:21 +00:00
|
|
|
#include "Singleton.h"
|
2023-03-20 13:10:52 +00:00
|
|
|
#include "DluAssert.h"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
#include <functional>
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
2023-11-22 02:05:15 +00:00
|
|
|
#include <cstdint>
|
2021-12-05 17:54:36 +00:00
|
|
|
|
|
|
|
// CPPLinq
|
2022-01-01 09:38:45 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
#define NOMINMAX
|
|
|
|
// windows.h has min and max macros that breaks cpplinq
|
2022-07-28 13:39:57 +00:00
|
|
|
#endif
|
2021-12-05 17:54:36 +00:00
|
|
|
#include "cpplinq.hpp"
|
|
|
|
|
2023-03-26 10:09:04 +00:00
|
|
|
// Used for legacy
|
|
|
|
#define UNUSED(x)
|
|
|
|
|
2023-03-20 13:10:52 +00:00
|
|
|
// Enable this to skip some unused columns in some tables
|
|
|
|
#define UNUSED_COLUMN(v)
|
|
|
|
|
2024-01-08 23:32:09 +00:00
|
|
|
// Use this to skip unused defaults for unused entries in some tables
|
|
|
|
#define UNUSED_ENTRY(v, x)
|
|
|
|
|
2021-12-05 17:54:36 +00:00
|
|
|
#pragma warning (disable : 4244) //Disable double to float conversion warnings
|
2024-02-09 13:37:58 +00:00
|
|
|
// #pragma warning (disable : 4715) //Disable "not all control paths return a value"
|
2021-12-05 17:54:36 +00:00
|
|
|
|
2024-02-09 13:37:58 +00:00
|
|
|
template<class Table, typename Storage>
|
2023-03-17 14:36:21 +00:00
|
|
|
class CDTable : public Singleton<Table> {
|
2024-02-09 13:37:58 +00:00
|
|
|
public:
|
|
|
|
typedef Storage StorageType;
|
|
|
|
|
2023-03-17 14:36:21 +00:00
|
|
|
protected:
|
|
|
|
virtual ~CDTable() = default;
|
2023-03-20 13:10:52 +00:00
|
|
|
|
2024-02-09 13:37:58 +00:00
|
|
|
// If you need these for a specific table, override it such that there is a public variant.
|
|
|
|
[[nodiscard]] StorageType& GetEntriesMutable() const {
|
|
|
|
return CDClientManager::GetEntriesMutable<Table>();
|
|
|
|
}
|
|
|
|
|
|
|
|
// If you need these for a specific table, override it such that there is a public variant.
|
|
|
|
[[nodiscard]] const StorageType& GetEntries() const {
|
|
|
|
return GetEntriesMutable();
|
|
|
|
}
|
2023-03-20 13:10:52 +00:00
|
|
|
};
|