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

MetaList.h

Go to the documentation of this file.
00001 //
00002 // MetaList.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_METALIST_H__63101F7C_1387_4218_9B61_753EF0F5EB20__INCLUDED_)
00023 #define AFX_METALIST_H__63101F7C_1387_4218_9B61_753EF0F5EB20__INCLUDED_
00024 
00025 #pragma once
00026 
00027 class CMetaList;
00028 class CMetaItem;
00029 class CSchema;
00030 class CSchemaMember;
00031 class CXMLElement;
00032 class CAlbumFolder;
00033 
00034 class CMetaList  
00035 {
00036 // Construction
00037 public:
00038         CMetaList();
00039         virtual ~CMetaList();
00040 
00041 // Attributes
00042 protected:
00043         CPtrList        m_pItems;
00044 
00045 // Operations
00046 public:
00047         void            Clear();
00048         CMetaItem*      Add(LPCTSTR pszKey, LPCTSTR pszValue);
00049         CMetaItem*      Find(LPCTSTR pszKey) const;
00050         void            Remove(LPCTSTR pszKey);
00051         void            Shuffle();
00052         void            Setup(CSchema* pSchema, BOOL bClear = TRUE);
00053         void            Combine(CXMLElement* pXML);
00054         void            Vote();
00055         void            CreateLinks();
00056         void            Clean(int nMaxLength = 128);
00057         void            ComputeWidth(CDC* pDC, int& nKeyWidth, int& nValueWidth);
00058         CMetaItem*      HitTest(const CPoint& point, BOOL bLinksOnly = FALSE);
00059         BOOL            OnSetCursor(CWnd* pWnd);
00060         
00061 // Inline Operations
00062 public:
00063         inline POSITION GetIterator() const
00064         {
00065                 return (POSITION)m_pItems.GetHeadPosition();
00066         }
00067 
00068         inline CMetaItem* GetNext(POSITION& pos) const
00069         {
00070                 return pos ? (CMetaItem*)m_pItems.GetNext( pos ) : NULL;
00071         }
00072 
00073         inline int GetCount() const
00074         {
00075                 return m_pItems.GetCount();
00076         }
00077 
00078         inline CMetaItem* GetFirst() const
00079         {
00080                 if ( m_pItems.GetCount() == 0 ) return NULL;
00081                 return (CMetaItem*)m_pItems.GetHead();
00082         }
00083 
00084 };
00085 
00086 
00087 class CMetaItem
00088 {
00089 // Construction
00090 public:
00091         CMetaItem(CSchemaMember* pMember = NULL);
00092 
00093 // Attributes
00094 public:
00095         CSchemaMember*  m_pMember;
00096         CString                 m_sKey;
00097         CString                 m_sValue;
00098         CMapStringToPtr m_pVote;
00099 public:
00100         CRect                   m_rect;
00101         BOOL                    m_bLink;
00102         CString                 m_sLink;
00103 public:
00104         BOOL                    m_bFullWidth;
00105         int                             m_nHeight;
00106         
00107 // Operations
00108 public:
00109         BOOL                    Combine(CXMLElement* pXML);
00110         void                    Vote();
00111         BOOL                    Limit(int nMaxLength);
00112         BOOL                    CreateLink();
00113         CAlbumFolder*   GetLinkTarget(BOOL bHTTP = TRUE) const;
00114 
00115         inline void SetRect(int x1, int y1, int x2, int y2)
00116         {
00117                 m_rect.left             = x1;
00118                 m_rect.top              = y1;
00119                 m_rect.right    = x2;
00120                 m_rect.bottom   = y2;
00121         }
00122 
00123 };
00124 
00125 
00126 #endif // !defined(AFX_METALIST_H__63101F7C_1387_4218_9B61_753EF0F5EB20__INCLUDED_)

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