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

📄 xmlkit.cpp

📁 粗糙集应用软件
💻 CPP
字号:
//-------------------------------------------------------------------
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Revisions.....:
//===================================================================

#include <stdafx.h> // Precompiled headers.
#include <copyright.h>

#include <kernel/utilities/xmlkit.h>

#include <kernel/basic/macros.h>

//-------------------------------------------------------------------
// Methods for class XMLKit.
//===================================================================

//-------------------------------------------------------------------
// Method........: Escape
// Author........: Aleksander 豩rn
// Date..........:
// Description...: Escapes certain characters in a string.
// Comments......:
// Revisions.....:
//===================================================================

String
XMLKit::Escape(const String &unescaped, const String &escapees) {

	int i, length = unescaped.GetLength();

	String escaped;

	// The result will have at least this many characters.
	escaped.Reserve(length);

	for (i = 0; i < length; i++) {
		if (escapees.Contains(unescaped[i]))
			escaped += Escape(unescaped[i]);
		else
			escaped += unescaped[i];
	}

	return escaped;

}

//-------------------------------------------------------------------
// Method........: Escape
// Author........: Aleksander 豩rn
// Date..........:
// Description...: Escapes a character.
// Comments......:
// Revisions.....:
//===================================================================

String
XMLKit::Escape(char character) {

	switch (character) {
		case '&': return "&amp;";
		case '<': return "&lt;";
		case '>': return "&gt;";
		case '"': return "&quot;";
		default:  return "&#" + String::Format(static_cast(unsigned char, character)) + ";";
	}

}

⌨️ 快捷键说明

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