summaryrefslogtreecommitdiff
path: root/include/typelib
diff options
context:
space:
mode:
authorHerbert Dürr <hdu@apache.org>2013-03-12 12:52:08 +0000
committerCaolán McNamara <caolanm@redhat.com>2013-05-23 13:57:19 +0100
commitfd5a9f20ef7b68439820a385f4527ba94a5a0d03 (patch)
treee0b1c2fe326aa27e0f8f454e2365bae31097dac9 /include/typelib
parent286bfde8c3b855db8487dbc1337993056026a5a9 (diff)
use debuggable and type-safe inline methods to replace macros...
in typedescription.h (cherry picked from commit a0809605f7612de439f0fc1f007177c6c463d0df) Conflicts: cppu/inc/typelib/typedescription.h Change-Id: I4ef735b896dc0833733e0141ce4c3fefcb820ded reshuffle declarations in typedescription.h to make forward-decls redundant (cherry picked from commit 0a6ba29e675385ce0aa49bb6ecd8d45b7aa0997b) Conflicts: cppu/inc/typelib/typedescription.h Change-Id: I91486656606464c7e76fa349a02d45a96c0cfb4d
Diffstat (limited to 'include/typelib')
-rw-r--r--include/typelib/typedescription.h96
1 files changed, 50 insertions, 46 deletions
diff --git a/include/typelib/typedescription.h b/include/typelib/typedescription.h
index 89d718f58433..3195870bfc6c 100644
--- a/include/typelib/typedescription.h
+++ b/include/typelib/typedescription.h
@@ -856,52 +856,6 @@ CPPU_DLLPUBLIC void SAL_CALL typelib_typedescription_revokeCallback(
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
-/// @cond INTERNAL
-
-/** Returns true, if the type description reference may lose the type description. Otherwise
- pType is a valid pointer and cannot be discarded through the lifetime of this reference.
- Remark: If the pWeakObj of the type is set too, you can avoid the call of
- ...getDescription(...) and use the description directly. pWeakObj == 0 means, that the
- description is not initialized.
-*/
-#define TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( eTypeClass ) \
- ((eTypeClass) == typelib_TypeClass_INTERFACE_METHOD || \
- (eTypeClass) == typelib_TypeClass_INTERFACE_ATTRIBUTE)
-
-/** Gets a description from the reference. The description may not be locked by this call.
- You must use the TYPELIB_DANGER_RELEASE macro to release the description fetched with
- this macro.
-*/
-#define TYPELIB_DANGER_GET( ppDescription, pTypeRef ) \
-{ \
- typelib_TypeDescriptionReference * pMacroTypeRef = (pTypeRef); \
- typelib_TypeDescription ** ppMacroTypeDescr = (ppDescription); \
- if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pMacroTypeRef->eTypeClass )) \
- { \
- typelib_typedescriptionreference_getDescription( ppMacroTypeDescr, pMacroTypeRef ); \
- } \
- else if (!pMacroTypeRef->pType || !pMacroTypeRef->pType->pWeakRef) \
- { \
- typelib_typedescriptionreference_getDescription( ppMacroTypeDescr, pMacroTypeRef ); \
- if (*ppMacroTypeDescr) \
- typelib_typedescription_release( *ppMacroTypeDescr ); \
- } \
- else \
- { \
- *ppMacroTypeDescr = pMacroTypeRef->pType; \
- } \
-}
-
-/** Releases the description previouse fetched by TYPELIB_DANGER_GET.
-*/
-#define TYPELIB_DANGER_RELEASE( pDescription ) \
-{ \
- if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( (pDescription)->eTypeClass )) \
- typelib_typedescription_release( pDescription ); \
-}
-
-/// @endcond
-
/** Creates a type description reference. This is a weak reference not holding the description.
If the description is already registered, the previous one is returned.
@@ -1139,6 +1093,56 @@ CPPU_DLLPUBLIC sal_Bool SAL_CALL typelib_typedescription_complete(
typelib_TypeDescription ** ppTypeDescr )
SAL_THROW_EXTERN_C();
+/// @cond INTERNAL
+
+/** Returns true, if the type description reference may lose the type description. Otherwise
+ pType is a valid pointer and cannot be discarded through the lifetime of this reference.
+ Remark: If the pWeakObj of the type is set too, you can avoid the call of
+ ...getDescription(...) and use the description directly. pWeakObj == 0 means, that the
+ description is not initialized.
+ @internal
+*/
+inline bool TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( _typelib_TypeClass eTypeClass )
+{
+ return (eTypeClass == typelib_TypeClass_INTERFACE_METHOD) ||
+ (eTypeClass == typelib_TypeClass_INTERFACE_ATTRIBUTE);
+}
+
+/** Gets a description from the reference. The description may not be locked by this call.
+ You must use the TYPELIB_DANGER_RELEASE macro to release the description fetched with
+ this macro.
+ @internal
+*/
+inline void TYPELIB_DANGER_GET( typelib_TypeDescription** ppMacroTypeDescr,
+ typelib_TypeDescriptionReference* pMacroTypeRef )
+{
+ if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pMacroTypeRef->eTypeClass ))
+ {
+ typelib_typedescriptionreference_getDescription( ppMacroTypeDescr, pMacroTypeRef );
+ }
+ else if (!pMacroTypeRef->pType || !pMacroTypeRef->pType->pWeakRef)
+ {
+ typelib_typedescriptionreference_getDescription( ppMacroTypeDescr, pMacroTypeRef );
+ if (*ppMacroTypeDescr)
+ typelib_typedescription_release( *ppMacroTypeDescr );
+ }
+ else
+ {
+ *ppMacroTypeDescr = pMacroTypeRef->pType;
+ }
+}
+
+/** Releases the description previouse fetched by TYPELIB_DANGER_GET.
+ @internal
+*/
+inline void TYPELIB_DANGER_RELEASE( typelib_TypeDescription* pDescription )
+{
+ if (TYPELIB_TYPEDESCRIPTIONREFERENCE_ISREALLYWEAK( pDescription->eTypeClass ))
+ typelib_typedescription_release( pDescription );
+}
+
+/// @endcond
+
#ifdef __cplusplus
}
#endif