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

1.13      parser      1: /** @file
                      2:        Parser: exception class.
                      3: 
1.57    ! moko        4:        Copyright (c) 2001-2020 Art. Lebedev Studio (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: 
                      8: #include "pa_common.h"
                      9: #include "pa_exception.h"
1.44      paf        10: #include "pa_sapi.h"
1.31      paf        11: #include "pa_globals.h"
1.13      parser     12: 
1.57    ! moko       13: volatile const char * IDENT_PA_EXCEPTION_C="$Id: pa_exception.C,v 1.56 2020/11/16 14:52:19 moko Exp $" IDENT_PA_EXCEPTION_H;
1.44      paf        14: 
                     15: // methods
                     16: 
                     17: Exception::Exception(): ftype(0), fproblem_source(0), fcomment(0) {}
1.55      moko       18: 
1.44      paf        19: Exception::Exception(const Exception& src):
                     20:        ftype(src.ftype),
                     21:        fproblem_source(src.fproblem_source),
                     22:        fcomment(src.fcomment) {
1.23      paf        23: }
1.55      moko       24: 
1.44      paf        25: Exception& Exception::operator =(const Exception& src) {
                     26:        ftype=src.ftype;
                     27:        fproblem_source=src.fproblem_source;
                     28:        fcomment=src.fcomment;
                     29:        return *this;
                     30: }
                     31: 
1.55      moko       32: Exception::Exception(const char* atype, const String* aproblem_source, const char* comment_fmt, ...) {
1.30      paf        33:        ftype=atype;
1.52      moko       34:        fproblem_source=aproblem_source ? new String(*aproblem_source) : 0;
1.27      paf        35: 
1.13      parser     36:        if(comment_fmt) {
1.55      moko       37:                char comment[MAX_STRING];
1.34      paf        38:                va_list args;
                     39:                va_start(args, comment_fmt);
1.55      moko       40:                fcomment=pa_strdup(comment, vsnprintf(comment, MAX_STRING, comment_fmt, args));
1.34      paf        41:                va_end(args);
1.26      paf        42:        } else
                     43:                fcomment=0;
                     44: }
1.44      paf        45: 
1.55      moko       46: void Exception::add_comment(const char* acomment) {
1.56      moko       47:        if(acomment)
                     48:                fcomment=pa_strcat(fcomment, acomment);
1.55      moko       49: }
                     50: 
                     51: const String* Exception::problem_source() const {
                     52:        return fproblem_source && !fproblem_source->is_empty() ? fproblem_source : 0;
1.44      paf        53: }

E-mail: