#include <camnet.h>
Inheritance diagram for DownloadQueue:
Public Types | |
enum | QueueType { FIFO = 0, LIFO } |
Public Member Functions | |
DownloadQueue () | |
~DownloadQueue () | |
destructor | |
BOOL | Queue (AsynchDownload *pDownload) |
Adds a new download pointer to the queue. | |
void | SetType (QueueType enNewType) |
QueueType | GetType () |
BOOL | IsEmpty () |
BOOL | Remove (AsynchDownload *pDownload) |
remove a download from the queue. The object is also deleted | |
void | Flush () |
Flushes the queue and deletes the objects at the same time. | |
AsynchDownload * | FindDownload (const String_256 &strFileName) |
searches the queue for an object downloading to a known local file | |
AsynchDownload * | FindDownload (INT32 hDownload) |
searches the queue for an object wirh a known handle | |
AsynchDownload * | GetNextDownload () |
access the next object in the queue (which is removed from the queue at the same time) | |
Protected Attributes | |
CTypedPtrList< CPtrList, AsynchDownload * > | m_List |
QueueType | m_enType |
Private Member Functions | |
CC_DECLARE_MEMDUMP (DownloadQueue) |
Definition at line 370 of file camnet.h.
|
Definition at line 376 of file camnet.h.
|
|
Definition at line 378 of file camnet.h.
|
|
destructor
Definition at line 1061 of file camnet.cpp.
|
|
|
|
searches the queue for an object wirh a known handle
Definition at line 1200 of file camnet.cpp. 01201 { 01202 AsynchDownload* pDownload = NULL; 01203 if (IsEmpty()) 01204 return pDownload; 01205 AsynchDownload* pIterator = NULL; 01206 POSITION pos = m_List.GetHeadPosition(); 01207 while (pos && !pDownload) 01208 { 01209 pIterator = m_List.GetNext(pos); 01210 if (pIterator->GetHandle() == hDownload) 01211 pDownload = pIterator; 01212 } 01213 return pDownload; 01214 }
|
|
searches the queue for an object downloading to a known local file
Definition at line 1171 of file camnet.cpp. 01172 { 01173 if (IsEmpty()) 01174 return NULL; 01175 String_256 strLocalFileName(strFileName); 01176 AsynchDownload* pIterator = NULL; 01177 POSITION pos = m_List.GetHeadPosition(); 01178 while (pos) 01179 { 01180 pIterator = m_List.GetNext(pos); 01181 if (!strLocalFileName.CompareTo(pIterator->GetLocalFileName(), FALSE)) 01182 return pIterator; 01183 } 01184 return NULL; 01185 }
|
|
Flushes the queue and deletes the objects at the same time.
Definition at line 1145 of file camnet.cpp. 01146 { 01147 if (IsEmpty()) 01148 return; 01149 POSITION pos = m_List.GetHeadPosition(); 01150 while (pos) 01151 { 01152 AsynchDownload* pDownload = m_List.GetNext(pos); 01153 if (pDownload) 01154 pDownload->Release(); 01155 } 01156 m_List.RemoveAll(); 01157 }
|
|
access the next object in the queue (which is removed from the queue at the same time)
Definition at line 1231 of file camnet.cpp. 01232 { 01233 AsynchDownload* pDownload = NULL; 01234 if (m_List.IsEmpty()) 01235 return pDownload; 01236 POSITION pos = m_List.GetHeadPosition(); 01237 pDownload = m_List.GetAt(pos); 01238 m_List.RemoveAt(pos); // remove the download from the queue 01239 return pDownload; 01240 }
|
|
Definition at line 385 of file camnet.h. 00385 { return m_enType;}
|
|
Definition at line 387 of file camnet.h. 00387 { return m_List.IsEmpty();}
|
|
Adds a new download pointer to the queue.
Definition at line 1080 of file camnet.cpp. 01081 { 01082 if (!pDownload) 01083 { 01084 ERROR3("Unexpected NULL pointer"); 01085 return FALSE; 01086 } 01087 if (m_enType != LIFO && m_enType != FIFO) 01088 { 01089 ERROR3("Invalid queue type"); 01090 return FALSE; 01091 } 01092 try 01093 { 01094 if (m_enType == FIFO) 01095 m_List.AddTail(pDownload); 01096 else 01097 m_List.AddHead(pDownload); 01098 } 01099 catch (CMemoryException* pxMem) 01100 { 01101 pxMem->Delete(); 01102 ERROR2(FALSE, "Could not queue download - memory problems"); 01103 } 01104 return TRUE; 01105 }
|
|
remove a download from the queue. The object is also deleted
Definition at line 1119 of file camnet.cpp. 01120 { 01121 if (!pDownload) 01122 { 01123 ERROR3("Unexpected NULL pointer"); 01124 return FALSE; 01125 } 01126 POSITION pos = m_List.Find(pDownload); 01127 if (!pos) 01128 return FALSE; // the object is not is this queue 01129 m_List.RemoveAt(pos); 01130 pDownload->Release(); 01131 return TRUE; 01132 }
|
|
Definition at line 383 of file camnet.h. 00383 { m_enType = enNewType;}
|
|
|
|
|