Qt 4.8
Public Types | Public Functions | Properties | List of all members
QAxConnection Class Reference
Inheritance diagram for QAxConnection:

Public Types

typedef QList< CONNECTDATA > Connections
 
typedef QList< CONNECTDATA >::Iterator Iterator
 

Public Functions

unsigned long __stdcall AddRef ()
 
STDMETHOD() Advise (IUnknown *pUnk, DWORD *pdwCookie)
 
STDMETHOD() Clone (IEnumConnections **ppEnum)
 
STDMETHOD() EnumConnections (IEnumConnections **ppEnum)
 
STDMETHOD() GetConnectionInterface (IID *pIID)
 
STDMETHOD() GetConnectionPointContainer (IConnectionPointContainer **ppCPC)
 
STDMETHOD() Next (ULONG cConnections, CONNECTDATA *cd, ULONG *pcFetched)
 
 QAxConnection (QAxServerBase *parent, const QUuid &uuid)
 
 QAxConnection (const QAxConnection &old)
 
STDMETHOD() QueryInterface (REFIID iid, void **iface)
 
unsigned long __stdcall Release ()
 
STDMETHOD() Reset ()
 
STDMETHOD() Skip (ULONG cConnections)
 
STDMETHOD() Unadvise (DWORD dwCookie)
 
 ~QAxConnection ()
 

Properties

Connections connections
 
int current
 
QUuid iid
 
unsigned long ref
 
CRITICAL_SECTION refCountSection
 
QAxServerBasethat
 

Detailed Description

Definition at line 620 of file qaxserverbase.cpp.

Typedefs

◆ Connections

typedef QList<CONNECTDATA> QAxConnection::Connections

Definition at line 624 of file qaxserverbase.cpp.

◆ Iterator

typedef QList<CONNECTDATA>::Iterator QAxConnection::Iterator

Definition at line 625 of file qaxserverbase.cpp.

Constructors and Destructors

◆ QAxConnection() [1/2]

QAxConnection::QAxConnection ( QAxServerBase parent,
const QUuid uuid 
)
inline

Definition at line 627 of file qaxserverbase.cpp.

628  : that(parent), iid(uuid), current(0), ref(1)
629  {
630  InitializeCriticalSection(&refCountSection);
631  }
QAxServerBase * that
unsigned long ref
CRITICAL_SECTION refCountSection

◆ QAxConnection() [2/2]

QAxConnection::QAxConnection ( const QAxConnection old)
inline

Definition at line 632 of file qaxserverbase.cpp.

633  : current(old.current)
634  {
635  InitializeCriticalSection(&refCountSection);
636  ref = 0;
637  connections = old.connections;
638  that = old.that;
639  iid = old.iid;
641  while (it != connections.end()) {
642  CONNECTDATA connection = *it;
643  ++it;
644  connection.pUnk->AddRef();
645  }
646  }
Connections connections
#define it(className, varName)
QAxServerBase * that
iterator begin()
Returns an STL-style iterator pointing to the first item in the list.
Definition: qlist.h:267
unsigned long ref
CRITICAL_SECTION refCountSection
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:270
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ ~QAxConnection()

QAxConnection::~QAxConnection ( )
inline

Definition at line 647 of file qaxserverbase.cpp.

648  {
649  DeleteCriticalSection(&refCountSection);
650  }
CRITICAL_SECTION refCountSection

Functions

◆ AddRef()

unsigned long __stdcall QAxConnection::AddRef ( )
inline

Definition at line 652 of file qaxserverbase.cpp.

653  {
654  EnterCriticalSection(&refCountSection);
655  unsigned long r = ++ref;
656  LeaveCriticalSection(&refCountSection);
657  return r;
658  }
unsigned long ref
CRITICAL_SECTION refCountSection

◆ Advise()

STDMETHOD() QAxConnection::Advise ( IUnknown *  pUnk,
DWORD *  pdwCookie 
)
inline

Definition at line 697 of file qaxserverbase.cpp.

698  {
699  if (!pUnk || !pdwCookie)
700  return E_POINTER;
701 
702  {
703  IDispatch *checkImpl = 0;
704  pUnk->QueryInterface(iid, (void**)&checkImpl);
705  if (!checkImpl)
706  return CONNECT_E_CANNOTCONNECT;
707  checkImpl->Release();
708  }
709 
710  CONNECTDATA cd;
711  cd.dwCookie = connections.count()+1;
712  cd.pUnk = pUnk;
713  cd.pUnk->AddRef();
714  connections.append(cd);
715  *pdwCookie = cd.dwCookie;
716  return S_OK;
717  }
Connections connections
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507

◆ Clone()

STDMETHOD() QAxConnection::Clone ( IEnumConnections **  ppEnum)
inline

Definition at line 778 of file qaxserverbase.cpp.

779  {
780  if (!ppEnum)
781  return E_POINTER;
782  *ppEnum = new QAxConnection(*this);
783  (*ppEnum)->AddRef();
784 
785  return S_OK;
786  }
QAxConnection(QAxServerBase *parent, const QUuid &uuid)

◆ EnumConnections()

STDMETHOD() QAxConnection::EnumConnections ( IEnumConnections **  ppEnum)
inline

Definition at line 731 of file qaxserverbase.cpp.

732  {
733  if (!ppEnum)
734  return E_POINTER;
735  *ppEnum = this;
736  AddRef();
737 
738  return S_OK;
739  }
unsigned long __stdcall AddRef()

◆ GetConnectionInterface()

STDMETHOD() QAxConnection::GetConnectionInterface ( IID *  pIID)
inline

Definition at line 688 of file qaxserverbase.cpp.

689  {
690  *pIID = iid;
691  return S_OK;
692  }

◆ GetConnectionPointContainer()

STDMETHOD() QAxConnection::GetConnectionPointContainer ( IConnectionPointContainer **  ppCPC)
inline

Definition at line 693 of file qaxserverbase.cpp.

694  {
695  return that->QueryInterface(IID_IConnectionPointContainer, (void**)ppCPC);
696  }
HRESULT WINAPI QueryInterface(REFIID iid, void **iface)
QAxServerBase * that

◆ Next()

STDMETHOD() QAxConnection::Next ( ULONG  cConnections,
CONNECTDATA *  cd,
ULONG *  pcFetched 
)
inline

Definition at line 740 of file qaxserverbase.cpp.

741  {
742  if (!cd)
743  return E_POINTER;
744 
745  if (!pcFetched && cConnections > 1)
746  return E_POINTER;
747 
748  const int count = connections.count();
749 
750  unsigned long i;
751  for (i = 0; i < cConnections; i++) {
752  if (current == count)
753  break;
754  cd[i] = connections.at(current);
755  cd[i].pUnk->AddRef();
756  ++current;
757  }
758  if (pcFetched)
759  *pcFetched = i;
760  return i == cConnections ? S_OK : S_FALSE;
761  }
Connections connections
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468

◆ QueryInterface()

STDMETHOD() QAxConnection::QueryInterface ( REFIID  iid,
void **  iface 
)
inline

Definition at line 671 of file qaxserverbase.cpp.

672  {
673  if (!iface)
674  return E_POINTER;
675  *iface = 0;
676  if (iid == IID_IUnknown)
677  *iface = (IConnectionPoint*)this;
678  else if (iid == IID_IConnectionPoint)
679  *iface = this;
680  else if (iid == IID_IEnumConnections)
681  *iface = this;
682  else
683  return E_NOINTERFACE;
684 
685  AddRef();
686  return S_OK;
687  }
unsigned long __stdcall AddRef()

◆ Release()

unsigned long __stdcall QAxConnection::Release ( )
inline

Definition at line 659 of file qaxserverbase.cpp.

660  {
661  EnterCriticalSection(&refCountSection);
662  unsigned long r = --ref;
663  LeaveCriticalSection(&refCountSection);
664 
665  if (!r) {
666  delete this;
667  return 0;
668  }
669  return r;
670  }
unsigned long ref
CRITICAL_SECTION refCountSection

◆ Reset()

STDMETHOD() QAxConnection::Reset ( )
inline

Definition at line 773 of file qaxserverbase.cpp.

774  {
775  current = 0;
776  return S_OK;
777  }

◆ Skip()

STDMETHOD() QAxConnection::Skip ( ULONG  cConnections)
inline

Definition at line 762 of file qaxserverbase.cpp.

763  {
764  const int count = connections.count();
765  while (cConnections) {
766  if (current == count)
767  return S_FALSE;
768  ++current;
769  --cConnections;
770  }
771  return S_OK;
772  }
Connections connections
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891

◆ Unadvise()

STDMETHOD() QAxConnection::Unadvise ( DWORD  dwCookie)
inline

Definition at line 718 of file qaxserverbase.cpp.

719  {
720  const int count = connections.count();
721  for (int i = 0; i < count; ++i) {
722  if (connections.at(i).dwCookie == dwCookie) {
724  if (current >= i && current != 0)
725  --current;
726  return S_OK;
727  }
728  }
729  return CONNECT_E_NOCONNECTION;
730  }
Connections connections
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
void removeAt(int i)
Removes the item at index position i.
Definition: qlist.h:480

Properties

◆ connections

Connections QAxConnection::connections
private

Definition at line 791 of file qaxserverbase.cpp.

Referenced by QAxConnection().

◆ current

int QAxConnection::current
private

Definition at line 792 of file qaxserverbase.cpp.

◆ iid

QUuid QAxConnection::iid
private

Definition at line 790 of file qaxserverbase.cpp.

Referenced by QAxConnection().

◆ ref

unsigned long QAxConnection::ref
private

Definition at line 795 of file qaxserverbase.cpp.

◆ refCountSection

CRITICAL_SECTION QAxConnection::refCountSection
private

Definition at line 794 of file qaxserverbase.cpp.

◆ that

QAxServerBase* QAxConnection::that
private

Definition at line 789 of file qaxserverbase.cpp.

Referenced by QAxConnection().


The documentation for this class was generated from the following file: