Annotation of parser3/src/main/pa_exception.C, revision 1.43.2.15.2.9

1.13      parser      1: /** @file
                      2:        Parser: exception class.
                      3: 
1.43.2.10  paf         4:        Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com)
1.38      paf         5:        Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.41      paf         6: */
1.13      parser      7: 
1.43.2.15.2.9! (paf        8:: static const char* IDENT_EXCEPTION_C="$Date: 2003/03/26 07:45:23 $";
1.13      parser      9: 
1.43.2.3  paf        10: #include "pa_common.h"
1.13      parser     11: #include "pa_exception.h"
1.39      paf        12: #include "pa_sapi.h"
1.43.2.14  paf        13: #include "pa_globals.h"
1.43.2.8  paf        14: 
                     15: 
                     16: // methods
1.43.2.2  paf        17: 
1.43.2.15.2.2  (paf       18:: Exception::Exception(): ftype(0), fproblem_source(0), fcomment(0) {}
1.43.2.11  paf        19: Exception::Exception(const Exception& src):
                     20:        ftype(src.ftype),
                     21:        fproblem_source(src.fproblem_source),
                     22:        fcomment(src.fcomment) {
                     23: }
                     24: Exception& Exception::operator =(const Exception& src) {
                     25:        ftype=src.ftype;
                     26:        fproblem_source=src.fproblem_source;
                     27:        fcomment=src.fcomment;
                     28:        return *this;
                     29: }
                     30: 
1.43.2.10  paf        31: Exception::Exception(const char* atype, 
1.43.2.15.2.9! (paf       32::                    const String* aproblem_source, 
        !            33::                    const char* comment_fmt, ...) {
1.30      paf        34:        ftype=atype;
                     35:        fproblem_source=aproblem_source;
1.27      paf        36: 
1.13      parser     37:        if(comment_fmt) {
1.43.2.15.2.3  (paf       38::               fcomment=new(PointerFreeGC) char[MAX_STRING];
1.34      paf        39:                va_list args;
                     40:                va_start(args, comment_fmt);
1.43.2.14  paf        41:                vsnprintf(fcomment, MAX_STRING, comment_fmt, args);
1.43.2.15.2.8  (paf       42:: //            _asm int 3;
1.34      paf        43:                va_end(args);
1.26      paf        44:        } else
1.43.2.15.2.2  (paf       45::               fcomment=0;
1.26      paf        46: }
1.33      paf        47: 
                     48: #ifdef XML
1.28      paf        49: Exception::Exception(
1.43.2.15.2.1  (paf       50::       const String* aproblem_source, 
1.28      paf        51:        GdomeException& exc) :
1.40      paf        52:        ftype("xml"),
1.43.2.14  paf        53:        fproblem_source(aproblem_source) {
1.28      paf        54: 
1.43.2.15.2.1  (paf       55::       const char* xml_generic_errors=xmlGenericErrors();
1.43.2.15.2.7  (paf       56::       if(xml_generic_errors || exc) {
1.43.2.10  paf        57:                const char* s;
1.28      paf        58:                switch((GdomeExceptionCode)exc) {
                     59:                case GDOME_NOEXCEPTION_ERR: s="NOEXCEPTION_ERR"; break;
                     60:                case GDOME_INDEX_SIZE_ERR: s="INDEX_SIZE_ERR"; break;
                     61:                case GDOME_DOMSTRING_SIZE_ERR: s="DOMSTRING_SIZE_ERR"; break;
                     62:                case GDOME_HIERARCHY_REQUEST_ERR: s="HIERARCHY_REQUEST_ERR"; break;
                     63:                case GDOME_WRONG_DOCUMENT_ERR: s="WRONG_DOCUMENT_ERR"; break;
                     64:                case GDOME_INVALID_CHARACTER_ERR: s="INVALID_CHARACTER_ERR"; break;
                     65:                case GDOME_NO_DATA_ALLOWED_ERR: s="NO_DATA_ALLOWED_ERR"; break;
                     66:                case GDOME_NO_MODIFICATION_ALLOWED_ERR: s="NO_MODIFICATION_ALLOWED_ERR"; break;
                     67:                case GDOME_NOT_FOUND_ERR: s="NOT_FOUND_ERR"; break;
                     68:                case GDOME_NOT_SUPPORTED_ERR: s="NOT_SUPPORTED_ERR"; break;
                     69:                case GDOME_INUSE_ATTRIBUTE_ERR: s="INUSE_ATTRIBUTE_ERR"; break;
                     70:                case GDOME_INVALID_STATE_ERR: s="INVALID_STATE_ERR"; break;
                     71:                case GDOME_SYNTAX_ERR: s="SYNTAX_ERR"; break;
                     72:                case GDOME_INVALID_MODIFICATION_ERR: s="INVALID_MODIFICATION_ERR"; break;
                     73:                case GDOME_NAMESPACE_ERR: s="NAMESPACE_ERR"; break;
                     74:                case GDOME_INVALID_ACCESS_ERR: s="INVALID_ACCESS_ERR"; break;
                     75:                case GDOME_NULL_POINTER_ERR: s="NULL_POINTER_ERR"; break;
                     76:                default: s="<UNKNOWN CODE>"; break;
                     77:                }
                     78:                
1.43.2.15.2.6  (paf       79::               fcomment=new(PointerFreeGC) char[MAX_STRING];
1.43.2.10  paf        80:                const char* xml_error_message;
                     81:                const char* xml_error_prefix;
1.36      paf        82:                if(xml_generic_errors) {
                     83:                        xml_error_prefix="\n";
                     84:                        xml_error_message=xml_generic_errors;
                     85:                } else {
                     86:                        xml_error_prefix="";
                     87:                        xml_error_message="";
                     88:                }
1.32      paf        89:                if(exc)
                     90:                        snprintf(fcomment, MAX_STRING, 
1.35      paf        91:                                "DOMException %s (%d)."
                     92:                                "%s%s", 
1.32      paf        93:                                        s,  // decoded code of exception
                     94:                                        exc, // DOM exception code
1.35      paf        95:                                        xml_error_prefix, xml_error_message // xml generic messages accumulated
1.32      paf        96:                        );
                     97:                else // no DOM exception
                     98:                        snprintf(fcomment, MAX_STRING, 
                     99:                                "%s", 
                    100:                                        xml_error_message // xml generic messages accumulated
                    101:                        );
1.28      paf       102:        } else
1.43.2.15.2.5  (paf      103::               fcomment=0;
1.28      paf       104: }
1.18      parser    105: #endif
1.43.2.1  paf       106: 
1.43.2.15.2.2  (paf      107:: const String* Exception::problem_source() const { 
1.43.2.15.2.4  (paf      108::       return fproblem_source && fproblem_source->length()?fproblem_source:0; 
1.43.2.1  paf       109: }

E-mail: