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

📄 html.h

📁 这是一个完整的图书馆供销存管理系统
💻 H
字号:
/***************************************************************************                          html.h  -  description                             -------------------    begin                : Fri Jul 20 2001    copyright            : (C) 2001 by Mark    email                : alben@yeah.net ***************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU General Public License as published by  * *   the Free Software Foundation; either version 2 of the License, or     * *   (at your option) any later version.                                   * *                                                                         * ***************************************************************************/#ifndef HTML_H#define HTML_H#include <vector>#include <map>#include <tinycxx/exception.h>struct CReplaceElement{	enum { TEXT = 0, TAG = 1, };		int m_iType;	string m_strContent;		CReplaceElement(int iType, const string& strContent)			{ m_iType = iType; m_strContent = strContent; }};typedef vector<CReplaceElement> CReplaceElements;typedef map< string, string, less<string> > CReplaceMap;class CReplacePart{protected:	CReplaceElements m_stPart;public:		CReplacePart() {}	CReplacePart(const string& strHtml) { ParsePart(strHtml); }	void Replace(ostream& os, CReplaceMap& stReplaceMap);private:		void ParsePart(const string& strHtml);	bool FindTextElement(const string& strHtml, int& iPos);	bool FindTagElement(const string& strHtml, int& iPos);	static void GetReplaceTagName(string& strTagName, const string& strHtml, int& iPos);};/*struct CHtmlPart{	enum { TEXT = 0, REPLACE = 1, };	int m_iType;//	string m_strTextOrPartTagName;	//TEXT: text; REPLACE: part tag name	CReplacePart m_stReplacePart;	CHtmlPart(const string& strText)			{ m_iType = TEXT; m_strTextOrPartTagName = strText; }		CHtmlPart(const string& strPartTagName, const CReplacePart& stReplacePart)			{ m_iType =	REPLACE; m_strTextOrPartTagName = strPartTagName; m_stReplacePart = stReplacePart; }};*/typedef map< string, string, less<string> > CTextParts;typedef map< string, CReplacePart, less<string> > CReplaceParts;class CHtmlDocument{public:	enum	{		STRING	= 1,		INT			= 2,		LONG		= 3,		DOUBLE	= 4,	};public:	const static string top;protected:	CTextParts m_stTextParts;	CReplaceParts m_stReplaceParts;public:	CHtmlDocument() {}	CHtmlDocument(const char* sHtmlFilePath);	virtual ~CHtmlDocument();		void Open(const char* sHtmlFilePath);	void Write(ostream& os, const string& strTagName)			{ os << m_stTextParts[strTagName]; }	void Replace(ostream& os, const string& strTagName, CReplaceMap& stReplaceMap)			{ m_stReplaceParts[strTagName].Replace(os, stReplaceMap); }	void Replace(ostream& os, const char* strTagName, ...);	void ReplaceF(ostream& os, const char* strTagName, ...);	protected:	void ParseHtml(const string& strHtml);	private:	bool FindTextPart(const string& strTagName, const string& strHtml, int& iPos);	bool FindReplacePart(string& strTagName, const string& strHtml, int& iPos);	static void GetPartTagName(string& strTagName, const string& strHtml, int& iPos);	static void GetPartString(string& strReplacePart, const string& strTagName, const string& strHtml, int& iPos);};string& UrlEncode(const string& strSrc, string& strDest);string& UrlDecode(const string& strSrc, string& strDest);#endif

⌨️ 快捷键说明

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