Annotation of parser3/src/main/pa_exception.C, revision 1.52
1.13 parser 1: /** @file
2: Parser: exception class.
3:
1.50 moko 4: Copyright (c) 2001-2012 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.52 ! moko 13: volatile const char * IDENT_PA_EXCEPTION_C="$Id: pa_exception.C,v 1.51 2013/07/16 15:06:40 moko Exp $" IDENT_PA_EXCEPTION_H;
1.44 paf 14:
15: // methods
16:
17: Exception::Exception(): ftype(0), fproblem_source(0), fcomment(0) {}
18: Exception::Exception(const Exception& src):
19: ftype(src.ftype),
20: fproblem_source(src.fproblem_source),
21: fcomment(src.fcomment) {
1.23 paf 22: }
1.44 paf 23: Exception& Exception::operator =(const Exception& src) {
24: ftype=src.ftype;
25: fproblem_source=src.fproblem_source;
26: fcomment=src.fcomment;
27: return *this;
28: }
29:
30: Exception::Exception(const char* atype,
1.49 misha 31: const String* aproblem_source,
32: 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.44 paf 37: fcomment=new(PointerFreeGC) char[MAX_STRING];
1.34 paf 38: va_list args;
39: va_start(args, comment_fmt);
1.51 moko 40: vsnprintf((char *)fcomment, 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:
46: const String* Exception::problem_source() const {
1.49 misha 47: return fproblem_source && !fproblem_source->is_empty()?fproblem_source:0;
1.44 paf 48: }
E-mail: