From b195e2c1aa0481ae77358492c60035e37a693ee8 Mon Sep 17 00:00:00 2001 From: Josh Ferrell Date: Fri, 18 Nov 2022 14:56:50 -0500 Subject: Add workaround from https://github.com/Tencent/rapidjson/pull/1877 --- rapidjson/document.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'rapidjson') diff --git a/rapidjson/document.h b/rapidjson/document.h index b42dd096..5ae54685 100644 --- a/rapidjson/document.h +++ b/rapidjson/document.h @@ -44,6 +44,16 @@ RAPIDJSON_DIAG_OFF(terminate) // ignore throwing RAPIDJSON_ASSERT in RAPIDJSON_N #endif #endif // __GNUC__ +#ifdef GetObject +// see https://github.com/Tencent/rapidjson/issues/1448 +// a former included windows.h might have defined a macro called GetObject, which affects +// GetObject defined here. This ensures the macro does not get applied +#pragma push_macro("GetObject") +#define RAPIDJSON_WINDOWS_GETOBJECT_WORKAROUND_APPLIED +#undef GetObject +#endif + + #ifndef RAPIDJSON_NOMEMBERITERATORCLASS #include // std::iterator, std::random_access_iterator_tag #endif @@ -1469,7 +1479,9 @@ public: } Object GetObject() { RAPIDJSON_ASSERT(IsObject()); return Object(*this); } + Object GetObj() { RAPIDJSON_ASSERT(IsObject()); return Object(*this); } ConstObject GetObject() const { RAPIDJSON_ASSERT(IsObject()); return ConstObject(*this); } + ConstObject GetObj() const { RAPIDJSON_ASSERT(IsObject()); return ConstObject(*this); } //@} @@ -2590,4 +2602,9 @@ private: RAPIDJSON_NAMESPACE_END RAPIDJSON_DIAG_POP +#ifdef RAPIDJSON_WINDOWS_GETOBJECT_WORKAROUND_APPLIED +#pragma pop_macro("GetObject") +#undef RAPIDJSON_WINDOWS_GETOBJECT_WORKAROUND_APPLIED +#endif + #endif // RAPIDJSON_DOCUMENT_H_ -- cgit v1.3.1