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

QueryHashTable.h

Go to the documentation of this file.
00001 //
00002 // QueryHashTable.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_QUERYHASHTABLE_H__4D0F77C8_D0BB_4AA5_97EA_3859BA3590B5__INCLUDED_)
00023 #define AFX_QUERYHASHTABLE_H__4D0F77C8_D0BB_4AA5_97EA_3859BA3590B5__INCLUDED_
00024 
00025 #pragma once
00026 
00027 class CPacket;
00028 class CBuffer;
00029 class CQuerySearch;
00030 class CXMLElement;
00031 class CNeighbour;
00032 class CQueryHashGroup;
00033 
00034 
00035 class CQueryHashTable
00036 {
00037 // Construction
00038 public:
00039         CQueryHashTable();
00040         virtual ~CQueryHashTable();
00041 
00042 // Attributes
00043 public:
00044         BOOL            m_bLive;
00045         DWORD           m_nCookie;
00046 public:
00047         BYTE*           m_pHash;
00048         DWORD           m_nHash;
00049         DWORD           m_nBits;
00050         DWORD           m_nInfinity;
00051         DWORD           m_nCount;
00052         CBuffer*        m_pBuffer;
00053 public:
00054         CQueryHashGroup*        m_pGroup;
00055 
00056 // Operations
00057 public:
00058         void    Create();
00059         void    Clear();
00060         BOOL    Merge(CQueryHashTable* pSource);
00061         BOOL    Merge(CQueryHashGroup* pSource);
00062         BOOL    PatchTo(CQueryHashTable* pTarget, CNeighbour* pNeighbour);
00063         BOOL    OnPacket(CPacket* pPacket);
00064         int             AddPhrase(LPCTSTR pszPhrase);
00065         int             AddString(LPCTSTR pszString);
00066         BOOL    CheckPhrase(LPCTSTR pszSearch);
00067         BOOL    CheckString(LPCTSTR pszString);
00068         BOOL    Check(CQuerySearch* pSearch);
00069         int             GetPercent();
00070 protected:
00071         BOOL    OnReset(CPacket* pPacket);
00072         BOOL    OnPatch(CPacket* pPacket);
00073         int             Add(LPCTSTR pszString, int nStart, int nLength);
00074         BOOL    PatchToOldShareaza(CQueryHashTable* pTarget, CNeighbour* pNeighbour);
00075 protected:
00076         static inline DWORD     HashWord(LPCTSTR pszString, int nStart, int nLength, int nBits);
00077         static inline DWORD     HashNumber(DWORD nNumber, int nBits);
00078 
00079 };
00080 
00081 #endif // !defined(AFX_QUERYHASHTABLE_H__4D0F77C8_D0BB_4AA5_97EA_3859BA3590B5__INCLUDED_)

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