00001 // 00002 // VendorCache.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_VENDORCACHE_H__D5534D6B_0819_4C8F_B62B_9DD5CB3468AD__INCLUDED_) 00023 #define AFX_VENDORCACHE_H__D5534D6B_0819_4C8F_B62B_9DD5CB3468AD__INCLUDED_ 00024 00025 #pragma once 00026 00027 class CVendor; 00028 class CXMLElement; 00029 00030 00031 class CVendorCache 00032 { 00033 // Construction 00034 public: 00035 CVendorCache(); 00036 virtual ~CVendorCache(); 00037 00038 // Attributes 00039 public: 00040 CVendor* m_pNull; 00041 CVendor* m_pShareaza; 00042 CVendor* m_pED2K; 00043 protected: 00044 CMapStringToPtr m_pMap; 00045 00046 // Operations 00047 public: 00048 POSITION GetIterator() const; 00049 CVendor* GetNext(POSITION& pos) const; 00050 int GetCount() const; 00051 CVendor* Lookup(LPCSTR pszCode, BOOL bCreate = TRUE); 00052 CVendor* Lookup(LPCWSTR pszCode, BOOL bCreate = TRUE); 00053 CVendor* LookupByName(LPCTSTR pszName) const; 00054 void Clear(); 00055 BOOL Load(); 00056 protected: 00057 BOOL LoadFrom(CXMLElement* pXML); 00058 00059 }; 00060 00061 00062 class CVendor 00063 { 00064 // Construction 00065 public: 00066 CVendor(LPCTSTR pszCode = NULL); 00067 virtual ~CVendor(); 00068 00069 // Attributes 00070 public: 00071 CString m_sCode; 00072 CString m_sName; 00073 CString m_sLink; 00074 BOOL m_bAuto; 00075 public: 00076 BOOL m_bChatFlag; 00077 BOOL m_bHTMLBrowse; 00078 00079 // Operations 00080 protected: 00081 BOOL LoadFrom(CXMLElement* pXML); 00082 00083 friend class CVendorCache; 00084 00085 }; 00086 00087 extern CVendorCache VendorCache; 00088 00089 00090 #endif // !defined(AFX_VENDORCACHE_H__D5534D6B_0819_4C8F_B62B_9DD5CB3468AD__INCLUDED_)