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

📄 dom_exception.cpp

📁 这是一款2d游戏引擎
💻 CPP
字号:
/*  $Id: dom_exception.cpp,v 1.3 2003/07/20 22:30:53 grumbel Exp $
**
**  ClanLib Game SDK
**  Copyright (C) 2003  The ClanLib Team
**  For a total list of contributers see the file CREDITS.
**
**  This library is free software; you can redistribute it and/or
**  modify it under the terms of the GNU Lesser General Public
**  License as published by the Free Software Foundation; either
**  version 2.1 of the License, or (at your option) any later version.
**
**  This library is distributed in the hope that it will be useful,
**  but WITHOUT ANY WARRANTY; without even the implied warranty of
**  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
**  Lesser General Public License for more details.
**
**  You should have received a copy of the GNU Lesser General Public
**  License along with this library; if not, write to the Free Software
**  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
*/

#include "Core/precomp.h"
#include "API/Core/XML/dom_exception.h"
#include "API/Core/System/clanstring.h"

/////////////////////////////////////////////////////////////////////////////
// CL_DomException construction:

static std::string code_to_message(unsigned short code)
{
	switch (code)
	{
	case CL_DomException::DOMSTRING_SIZE_ERR:
		return "DOMSTRING_SIZE_ERR: Specified range of text does not fit into a DOMString";
		
	case CL_DomException::HIERARCHY_REQUEST_ERR:
		return "HIERARCHY_REQUEST_ERR: Attemped to insert node where it doesn't belong";
		
	case CL_DomException::INDEX_SIZE_ERR:
		return "INDEX_SIZE_ERR: Index or size is negative, or greater than the allowed value";
		
	case CL_DomException::INUSE_ATTRIBUTE_ERR:
		return "INUSE_ATTRIBUTE_ERR: An attempt was made to add an attribute that is already in use elsewhere";
		
	case CL_DomException::INVALID_CHARACTER_ERR:
		return "INVALID_CHARACTER_ERR: An invalid or illegal character was specified, such as in a name";
		
	case CL_DomException::NOT_FOUND_ERR:
		return "NOT_FOUND_ERR: An attempt was made to reference a node in a context where it does not exist";
		
	case CL_DomException::NOT_SUPPORTED_ERR:
		return "NOT_SUPPORTED_ERR: The implementation does not support the type of object requested";
		
	case CL_DomException::NO_DATA_ALLOWED_ERR:
		return "NO_DATA_ALLOWED_ERR: Data was specified for a node which does not support data";
		
	case CL_DomException::NO_MODIFICATION_ALLOWED_ERR:
		return "NO_MODIFICATION_ALLOWED_ERR: An attempt was made to modify an object where modifications are not allowed";
		
	case CL_DomException::WRONG_DOCUMENT_ERR:
		return "WRONG_DOCUMENT_ERR: A node was used in a different document than the one that created it";
	}

	return CL_String::format("Unknown DOM exception code %1", code);
}

CL_DomException::CL_DomException(unsigned short code) : CL_Error(code_to_message(code)), code(code)
{
}

CL_DomException::CL_DomException(const std::string &message, unsigned short code) : CL_Error(message), code(code)
{
}

/////////////////////////////////////////////////////////////////////////////
// CL_DomException attributes:

/////////////////////////////////////////////////////////////////////////////
// CL_DomException implementation:

⌨️ 快捷键说明

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