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

dom_exception.cpp

Go to the documentation of this file.
00001 /*
00002 **  ClanLib SDK
00003 **  Copyright (c) 1997-2005 The ClanLib Team
00004 **
00005 **  This software is provided 'as-is', without any express or implied
00006 **  warranty.  In no event will the authors be held liable for any damages
00007 **  arising from the use of this software.
00008 **
00009 **  Permission is granted to anyone to use this software for any purpose,
00010 **  including commercial applications, and to alter it and redistribute it
00011 **  freely, subject to the following restrictions:
00012 **
00013 **  1. The origin of this software must not be misrepresented; you must not
00014 **     claim that you wrote the original software. If you use this software
00015 **     in a product, an acknowledgment in the product documentation would be
00016 **     appreciated but is not required.
00017 **  2. Altered source versions must be plainly marked as such, and must not be
00018 **     misrepresented as being the original software.
00019 **  3. This notice may not be removed or altered from any source distribution.
00020 **
00021 **  Note: Some of the libraries ClanLib link to may have additional
00022 **  requirements or restrictions.
00023 **
00024 **  File Author(s):
00025 **
00026 **    Magnus Norddahl
00027 */
00028 
00029 #include "precomp.h"
00030 #include "dom_exception.h"
00031 #include "string_format.h"
00032 
00034 // CL_DomException construction:
00035 
00036 static std::string code_to_message(unsigned short code)
00037 {
00038         switch (code)
00039         {
00040         case CL_DomException::DOMSTRING_SIZE_ERR:
00041                 return "DOMSTRING_SIZE_ERR: Specified range of text does not fit into a DOMString";
00042                 
00043         case CL_DomException::HIERARCHY_REQUEST_ERR:
00044                 return "HIERARCHY_REQUEST_ERR: Attemped to insert node where it doesn't belong";
00045                 
00046         case CL_DomException::INDEX_SIZE_ERR:
00047                 return "INDEX_SIZE_ERR: Index or size is negative, or greater than the allowed value";
00048                 
00049         case CL_DomException::INUSE_ATTRIBUTE_ERR:
00050                 return "INUSE_ATTRIBUTE_ERR: An attempt was made to add an attribute that is already in use elsewhere";
00051                 
00052         case CL_DomException::INVALID_CHARACTER_ERR:
00053                 return "INVALID_CHARACTER_ERR: An invalid or illegal character was specified, such as in a name";
00054                 
00055         case CL_DomException::NOT_FOUND_ERR:
00056                 return "NOT_FOUND_ERR: An attempt was made to reference a node in a context where it does not exist";
00057                 
00058         case CL_DomException::NOT_SUPPORTED_ERR:
00059                 return "NOT_SUPPORTED_ERR: The implementation does not support the type of object requested";
00060                 
00061         case CL_DomException::NO_DATA_ALLOWED_ERR:
00062                 return "NO_DATA_ALLOWED_ERR: Data was specified for a node which does not support data";
00063                 
00064         case CL_DomException::NO_MODIFICATION_ALLOWED_ERR:
00065                 return "NO_MODIFICATION_ALLOWED_ERR: An attempt was made to modify an object where modifications are not allowed";
00066                 
00067         case CL_DomException::WRONG_DOCUMENT_ERR:
00068                 return "WRONG_DOCUMENT_ERR: A node was used in a different document than the one that created it";
00069         }
00070 
00071         CL_StringFormat format("Unknown DOM exception code %1");
00072         format.set_arg(1, code);
00073         return format.get_result();
00074 }
00075 
00076 CL_DomException::CL_DomException(unsigned short code) : CL_Exception(code_to_message(code)), code(code)
00077 {
00078 }
00079 
00080 CL_DomException::CL_DomException(const std::string &message, unsigned short code) : CL_Exception(message), code(code)
00081 {
00082 }
00083 
00085 // CL_DomException attributes:
00086 
00088 // CL_DomException implementation:

Generated on Sat Feb 19 22:51:15 2005 for npcore by  doxygen 1.4.1