⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hostsfile.h

📁 Boosts Browsing Speeds Up To 3,000 Times Faster.zip
💻 H
字号:
// HostsFile.cpp: interface for the CHostsFile class.
//
//////////////////////////////////////////////////////////////////////
/**************************************************************
**        __                                          __
**     __/_/__________________________________________\_\__
**  __|_                                                  |__
** (___O)     William SerGio & Co., Inc.                 (O___)
**(_____O)	  www.software-rus.com         			    (O_____)
**(_____O)	  Author: Bill SerGio, Infomercial King(tm) (O_____)
** (__O)		                    					 (O__)
**    |___________________________________________________|
**
****************************************************************/

#if !defined(AFX_HOSTSFILE_H__INCLUDED_)
#define AFX_HOSTSFILE_H__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <deque>
#include <set>

class CSuperChargerDlg;

class CHostsFile
{
public:

	//Read hosts file
	BOOL LoadFile(const char* file, BOOL bAppend=FALSE);

	//Insert an item
	void Insert(const std::string& rData);

	//Clear the data
	void Clear();

	//Get the total count
	int GetCount()const;

	//Get the data at
	const std::string& GetDataAt(int iIndex)const;

	//Get a string
	const std::string& GetData()const;

	//Are we an empty file?
	BOOL IsEmpty()const;

	//Get the file name
	const std::string& GetFileName()const;

	//Ctor and dtor
	CHostsFile();
	virtual ~CHostsFile();

private:
	/*
	//Host struct
	//Domain is used to see if our entry is unique
	typedef struct _HostData
	{
		std::string		sLine;
		std::string		sDomain;
	} HostData;

	//Our vector of host data
	typedef std::vector<HostData> HostVector;
	*/

	//Our vector of host data
	//typedef std::vector<std::string> HostVector;

	//Our deque
	//A deque is like a vector, it is a sequence that supports 
	//random access to elements, constant time insertion and 
	//removal of elements at the end of the sequence, and 
	//linear time insertion and removal of elements in the middle.
	typedef std::deque<std::string> HostVector;

	//Our set to avoid duplicates
	typedef std::set<std::string> HostSet;

	typedef std::set<std::string>::iterator m_hostsIterator;

private:

	//No assignment operator
	CHostsFile& operator=(const CHostsFile& rFile);

	//Our strings compare
	static bool CompareHosts(const std::string& rAddress1,
							 const std::string& rAddress2);

	//Sort the data
	void SortData();

	//Our hosts
	HostVector m_aHosts;

	//Our file name
	std::string m_sFile;

	//Do we ignore case
	BOOL m_bIgnoreCase;

	//Do we sort
	BOOL m_bSort;

};

#endif // !defined(AFX_HOSTSFILE_H__INCLUDED_)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -