diff --git a/ebml/EbmlElement.h b/ebml/EbmlElement.h index c609f88b..0ef67c40 100644 --- a/ebml/EbmlElement.h +++ b/ebml/EbmlElement.h @@ -170,58 +170,45 @@ class EbmlElement; #define DEFINE_SEMANTIC_ITEM_STRING(m,u,d,c) EbmlSemantic(m, u, static_cast(d), EBML_INFO(c)), #define DEFINE_SEMANTIC_ITEM_UTF8(m,u,d,c) EbmlSemantic(m, u, static_cast(d), EBML_INFO(c)), -#define DECLARE_xxx_MASTER(x,DllApi) class DllApi x : public EbmlMaster { \ +#define DECLARE_xxx_BASE_DEFAULT(x, DllApi, BaseClass, StorageType) \ +class DllApi x : public BaseClass { \ private: \ - static const EbmlCallbacks ClassInfos; \ - public: \ - x(); -#define DECLARE_xxx_UINTEGER(x,DllApi) class DllApi x : public EbmlUInteger { \ - private: \ - static const EbmlCallbacksDefault ClassInfos; \ - public: \ - const EbmlCallbacksDefault & ElementSpec() const override { return ClassInfos; } \ - static const EbmlCallbacksDefault & GetElementSpec() { return ClassInfos; } \ - x(); -#define DECLARE_xxx_SINTEGER(x,DllApi) class DllApi x : public EbmlSInteger { \ - private: \ - static const EbmlCallbacksDefault ClassInfos; \ + static const EbmlCallbacksDefault ClassInfos; \ public: \ - const EbmlCallbacksDefault & ElementSpec() const override { return ClassInfos; } \ - static const EbmlCallbacksDefault & GetElementSpec() { return ClassInfos; } \ + const EbmlCallbacksDefault & ElementSpec() const override { return ClassInfos; } \ + static const EbmlCallbacksDefault & GetElementSpec() { return ClassInfos; } \ x(); -#define DECLARE_xxx_STRING(x,DllApi) class DllApi x : public EbmlString { \ - private: \ - static const EbmlCallbacksDefault ClassInfos; \ - public: \ - const EbmlCallbacksDefault & ElementSpec() const override { return ClassInfos; } \ - static const EbmlCallbacksDefault & GetElementSpec() { return ClassInfos; } \ - x(); -#define DECLARE_xxx_UNISTRING(x,DllApi) class DllApi x : public EbmlUnicodeString { \ - private: \ - static const EbmlCallbacksDefault ClassInfos; \ - public: \ - const EbmlCallbacksDefault & ElementSpec() const override { return ClassInfos; } \ - static const EbmlCallbacksDefault & GetElementSpec() { return ClassInfos; } \ - x(); -#define DECLARE_xxx_BINARY(x,DllApi) class DllApi x : public EbmlBinary { \ + +#define DECLARE_xxx_BASE(x, DllApi, BaseClass) \ +class DllApi x : public BaseClass { \ private: \ static const EbmlCallbacks ClassInfos; \ public: \ x(); -#define DECLARE_xxx_DATE(x,DllApi) class DllApi x : public EbmlDate { \ - private: \ - static const EbmlCallbacksDefault ClassInfos; \ - public: \ - const EbmlCallbacksDefault & ElementSpec() const override { return ClassInfos; } \ - static const EbmlCallbacksDefault & GetElementSpec() { return ClassInfos; } \ - x(); -#define DECLARE_xxx_FLOAT(x,DllApi) class DllApi x : public EbmlFloat { \ - private: \ - static const EbmlCallbacksDefault ClassInfos; \ - public: \ - const EbmlCallbacksDefault & ElementSpec() const override { return ClassInfos; } \ - static const EbmlCallbacksDefault & GetElementSpec() { return ClassInfos; } \ - x(); + +#define DECLARE_xxx_MASTER(x,DllApi) \ + DECLARE_xxx_BASE(x, DllApi, EbmlMaster) + +#define DECLARE_xxx_UINTEGER(x,DllApi) \ + DECLARE_xxx_BASE_DEFAULT(x, DllApi, EbmlUInteger, std::uint64_t) + +#define DECLARE_xxx_SINTEGER(x,DllApi) \ + DECLARE_xxx_BASE_DEFAULT(x, DllApi, EbmlSInteger, std::int64_t) + +#define DECLARE_xxx_STRING(x,DllApi) \ + DECLARE_xxx_BASE_DEFAULT(x, DllApi, EbmlString, const char *) + +#define DECLARE_xxx_UNISTRING(x,DllApi) \ + DECLARE_xxx_BASE_DEFAULT(x, DllApi, EbmlUnicodeString, const wchar_t *) + +#define DECLARE_xxx_BINARY(x,DllApi) \ + DECLARE_xxx_BASE(x, DllApi, EbmlBinary) + +#define DECLARE_xxx_DATE(x,DllApi) \ + DECLARE_xxx_BASE_DEFAULT(x, DllApi, EbmlDate, std::int64_t) + +#define DECLARE_xxx_FLOAT(x,DllApi) \ + DECLARE_xxx_BASE_DEFAULT(x, DllApi, EbmlFloat, double) #define DECLARE_EBML_MASTER(x) DECLARE_xxx_MASTER( x,EBML_DLL_API) #define DECLARE_EBML_UINTEGER(x) DECLARE_xxx_UINTEGER(x,EBML_DLL_API)