feat(General): L_DECLARE_PRIVATE can declare a LINPHONE_NAMESPACE::Tester friend

This commit is contained in:
Ronan Abhamon 2017-09-28 17:39:12 +02:00
parent 6c3bc0c06e
commit 7e13352824
2 changed files with 17 additions and 7 deletions

View file

@ -79,9 +79,12 @@ void l_assert (const char *condition, const char *file, int line);
#define L_UNLIKELY(EXPRESSION) EXPRESSION
#endif
// Allows access to private internal data.
// Gives a control to C Wrapper.
#define L_DECLARE_PRIVATE(CLASS) \
class ClonableObject;
class ClonableObjectPrivate;
class Object;
class ObjectPrivate;
#define L_INTERNAL_DECLARE_PRIVATE(CLASS) \
inline CLASS ## Private *getPrivate() { \
return reinterpret_cast<CLASS ## Private *>(mPrivate); \
} \
@ -91,10 +94,15 @@ void l_assert (const char *condition, const char *file, int line);
friend class CLASS ## Private; \
friend class Wrapper;
class ClonableObject;
class ClonableObjectPrivate;
class Object;
class ObjectPrivate;
// Allows access to private internal data.
// Gives a control to C Wrapper.
#ifndef LINPHONE_TESTER
#define L_DECLARE_PRIVATE(CLASS) L_INTERNAL_DECLARE_PRIVATE(CLASS)
#else
#define L_DECLARE_PRIVATE(CLASS) \
L_INTERNAL_DECLARE_PRIVATE(CLASS) \
friend class Tester;
#endif
template<typename T>
inline ClonableObject *getPublicHelper (T *object, ClonableObjectPrivate *context) {

View file

@ -218,6 +218,8 @@ bc_apply_compile_flags(SOURCE_FILES_C STRICT_OPTIONS_CPP STRICT_OPTIONS_C)
bc_apply_compile_flags(SOURCE_FILES_CXX STRICT_OPTIONS_CPP STRICT_OPTIONS_CXX)
bc_apply_compile_flags(SOURCE_FILES_OBJC STRICT_OPTIONS_CPP STRICT_OPTIONS_OBJC)
add_definitions("-DLINPHONE_TESTER")
if(MSVC)
get_source_file_property(MESSAGE_TESTER_C_COMPILE_FLAGS message_tester.c COMPILE_FLAGS)
set(MESSAGE_TESTER_C_COMPILE_FLAGS "${MESSAGE_TESTER_C_COMPILE_FLAGS} /wd4996") # Disable "was declared deprecated" warnings