Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

DownloadGroups.h

Go to the documentation of this file.
00001 //
00002 // DownloadGroups.h
00003 //
00004 // Copyright (c) Shareaza Development Team, 2002-2005.
00005 // This file is part of SHAREAZA (www.shareaza.com)
00006 //
00007 // Shareaza is free software; you can redistribute it
00008 // and/or modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2 of
00010 // the License, or (at your option) any later version.
00011 //
00012 // Shareaza is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with Shareaza; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 //
00021 
00022 #if !defined(AFX_DOWNLOADGROUPS_H__3B37C337_3DD2_4335_BEF1_EA98F348286E__INCLUDED_)
00023 #define AFX_DOWNLOADGROUPS_H__3B37C337_3DD2_4335_BEF1_EA98F348286E__INCLUDED_
00024 
00025 #pragma once
00026 
00027 class CDownload;
00028 class CDownloadGroup;
00029 
00030 
00031 class CDownloadGroups
00032 {
00033 // Construction
00034 public:
00035         CDownloadGroups();
00036         virtual ~CDownloadGroups();
00037 
00038 // Attributes
00039 public:
00040         CCriticalSection        m_pSection;
00041 protected:
00042         CPtrList                        m_pList;
00043         CDownloadGroup*         m_pSuper;
00044         int                                     m_nBaseCookie;
00045         int                                     m_nSaveCookie;
00046         int                                     m_nGroupCookie;
00047 
00048 // Operations
00049 public:
00050         CDownloadGroup*         GetSuperGroup();
00051         CDownloadGroup*         Add(LPCTSTR pszName = NULL);
00052         void                            Remove(CDownloadGroup* pGroup);
00053         void                            Link(CDownload* pDownload);
00054         void                            Unlink(CDownload* pDownload, BOOL bAndSuper = TRUE);
00055         void                            CreateDefault();
00056         CString                         GetCompletedPath(CDownload* pDownload);
00057 public:
00058         void                            Clear();
00059         BOOL                            Load();
00060         BOOL                            Save(BOOL bForce = TRUE);
00061 protected:
00062         void                            Serialize(CArchive& ar);
00063 
00064 // Inlines
00065 public:
00066         inline POSITION GetIterator() const
00067         {
00068                 return m_pList.GetHeadPosition();
00069         }
00070 
00071         inline CDownloadGroup* GetNext(POSITION& pos) const
00072         {
00073                 return (CDownloadGroup*)m_pList.GetNext( pos );
00074         }
00075 
00076         inline int GetCount() const
00077         {
00078                 return m_pList.GetCount();
00079         }
00080 
00081         inline BOOL Check(CDownloadGroup* pGroup) const
00082         {
00083                 return m_pList.Find( pGroup ) != NULL;
00084         }
00085 
00086         inline int GetGroupCookie() const
00087         {
00088                 return m_nGroupCookie;
00089         }
00090 
00091         inline void IncBaseCookie()
00092         {
00093                 m_nBaseCookie ++;
00094         }
00095 
00096         friend class CDownloadGroup;
00097 };
00098 
00099 extern CDownloadGroups DownloadGroups;
00100 
00101 #endif // !defined(AFX_DOWNLOADGROUPS_H__3B37C337_3DD2_4335_BEF1_EA98F348286E__INCLUDED_)

Generated on Thu Dec 15 10:39:40 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2