AlterOffice
AlterOffice 3.4 SDK C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
dispatcher.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 
3 
4 #ifndef INCLUDED_UNO_DISPATCHER_HXX
5 #define INCLUDED_UNO_DISPATCHER_HXX
6 
7 #include "sal/config.h"
8 
9 #include <cstddef>
10 
11 #include "uno/dispatcher.h"
12 
14 
15 namespace com
16 {
17 namespace sun
18 {
19 namespace star
20 {
21 namespace uno
22 {
23 
31 class UnoInterfaceReference
32 {
33 public:
34  uno_Interface * m_pUnoI;
35 
36  bool is() const
37  { return m_pUnoI != NULL; }
38 
39  inline ~UnoInterfaceReference();
40  inline UnoInterfaceReference();
41  inline UnoInterfaceReference( uno_Interface * pUnoI, __sal_NoAcquire );
42  inline UnoInterfaceReference( uno_Interface * pUnoI );
43  inline UnoInterfaceReference( UnoInterfaceReference const & ref );
44 
45 #if defined LIBO_INTERNAL_ONLY
46  UnoInterfaceReference(UnoInterfaceReference && other) noexcept :
47  m_pUnoI(other.m_pUnoI)
48  { other.m_pUnoI = nullptr; }
49 #endif
50 
51  uno_Interface * get() const
52  { return m_pUnoI; }
53 
54  inline UnoInterfaceReference & set(
55  uno_Interface * pUnoI );
56  inline UnoInterfaceReference & set(
57  uno_Interface * pUnoI, __sal_NoAcquire );
58  inline void clear();
59 
60  UnoInterfaceReference & operator = (
61  UnoInterfaceReference const & ref )
62  { return set( ref.m_pUnoI ); }
63  UnoInterfaceReference & operator = (
64  uno_Interface * pUnoI )
65  { return set( pUnoI ); }
66 
67 #if defined LIBO_INTERNAL_ONLY
68  UnoInterfaceReference & operator =(UnoInterfaceReference && other) {
69  if (m_pUnoI != nullptr) {
70  (*m_pUnoI->release)(m_pUnoI);
71  }
72  m_pUnoI = other.m_pUnoI;
73  other.m_pUnoI = nullptr;
74  return *this;
75  }
76 #endif
77 
78  inline void dispatch(
79  struct _typelib_TypeDescription const * pMemberType,
80  void * pReturn, void * pArgs [], uno_Any ** ppException ) const;
81 };
82 
83 
84 inline UnoInterfaceReference::~UnoInterfaceReference()
85 {
86  if (m_pUnoI != NULL)
87  (*m_pUnoI->release)( m_pUnoI );
88 }
89 
90 
91 inline UnoInterfaceReference::UnoInterfaceReference()
92  : m_pUnoI( NULL )
93 {
94 }
95 
96 
97 inline UnoInterfaceReference::UnoInterfaceReference(
99  : m_pUnoI( pUnoI )
100 {
101 }
102 
103 
104 inline UnoInterfaceReference::UnoInterfaceReference( uno_Interface * pUnoI )
105  : m_pUnoI( pUnoI )
106 {
107  if (m_pUnoI != NULL)
108  (*m_pUnoI->acquire)( m_pUnoI );
109 }
110 
111 
112 inline UnoInterfaceReference::UnoInterfaceReference(
113  UnoInterfaceReference const & ref )
114  : m_pUnoI( ref.m_pUnoI )
115 {
116  if (m_pUnoI != NULL)
117  (*m_pUnoI->acquire)( m_pUnoI );
118 }
119 
120 
121 inline UnoInterfaceReference & UnoInterfaceReference::set(
122  uno_Interface * pUnoI )
123 {
124  if (pUnoI != NULL)
125  (*pUnoI->acquire)( pUnoI );
126  if (m_pUnoI != NULL)
127  (*m_pUnoI->release)( m_pUnoI );
128  m_pUnoI = pUnoI;
129  return *this;
130 }
131 
132 
133 inline UnoInterfaceReference & UnoInterfaceReference::set(
134  uno_Interface * pUnoI, __sal_NoAcquire )
135 {
136  if (m_pUnoI != NULL)
137  (*m_pUnoI->release)( m_pUnoI );
138  m_pUnoI = pUnoI;
139  return *this;
140 }
141 
142 
143 inline void UnoInterfaceReference::clear()
144 {
145  if (m_pUnoI != NULL)
146  {
147  (*m_pUnoI->release)( m_pUnoI );
148  m_pUnoI = NULL;
149  }
150 }
151 
152 
153 inline void UnoInterfaceReference::dispatch(
154  struct _typelib_TypeDescription const * pMemberType,
155  void * pReturn, void * pArgs [], uno_Any ** ppException ) const
156 {
157  (*m_pUnoI->pDispatcher)(
158  m_pUnoI, pMemberType, pReturn, pArgs, ppException );
159 }
160 
161 }
162 }
163 }
164 }
165 
167 
168 #endif
169 
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
struct SAL_DLLPUBLIC_RTTI _uno_Interface uno_Interface
The binary C uno interface description.
__sal_NoAcquire
Definition: types.h:332
struct SAL_DLLPUBLIC_RTTI _uno_Any uno_Any
This is the binary specification of a UNO any.
Full type description of a type.
Definition: typedescription.h:55