Annotation of parser3/src/include/pa_exception.h, revision 1.38.2.5

1.10      paf         1: /** @file
1.11      paf         2:        Parser: exception decls.
                      3: 
1.38      paf         4:        Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com)
1.31      paf         5:        Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.1       paf         6: */
                      7: 
                      8: #ifndef PA_EXCEPTION_H
                      9: #define PA_EXCEPTION_H
1.36      paf        10: 
1.38.2.5! paf        11: static const char* IDENT_EXCEPTION_H="$Date: 2003/01/24 08:19:09 $";
1.1       paf        12: 
1.38.2.1  paf        13: //#include "pa_types.h"
                     14: #include "pa_pool.h"
1.14      parser     15: 
1.38.2.1  paf        16: // forwards
                     17: 
                     18: class String;
1.38.2.3  paf        19: typedef object_ptr<const String> ConstStringPtr;
1.14      parser     20: 
1.22      paf        21: // defines
                     22: 
1.1       paf        23: class Exception {
                     24: public:
                     25: 
1.38.2.5! paf        26:        static const ConstStringPtr undefined_source;
1.38.2.2  paf        27: 
1.19      paf        28:        Exception();
1.15      parser     29:        Exception(
1.33      paf        30:                const char *atype,
1.38.2.3  paf        31:                ConstStringPtr aproblem_source, 
1.15      parser     32:                const char *comment_fmt, ...);
1.38.2.1  paf        33:        Exception(const Exception& src):
                     34:                ftype(src.ftype),
                     35:                fproblem_source(src.fproblem_source),
                     36:                fcomment(src.fcomment) {
                     37:        }
                     38:        Exception& operator =(const Exception& src) {
                     39:                ftype=src.ftype;
                     40:                fproblem_source=src.fproblem_source;
                     41:                fcomment=src.fcomment;
                     42:                return *this;
                     43:        }
1.14      parser     44: 
                     45: #ifdef XML
1.28      paf        46:        Exception(
                     47:                const String *aproblem_source, 
                     48:                GdomeException& exc);
1.14      parser     49: #endif
1.1       paf        50: 
1.10      paf        51:        /// extracts exception type
1.35      paf        52:        const char *type(bool can_be_empty=false) const { 
                     53:                if(can_be_empty)
                     54:                        return ftype; 
                     55:                else
                     56:                        return ftype?ftype:"<no type>";
                     57:        }
1.10      paf        58:        /// extracts exception problem_source
1.38.2.3  paf        59:        ConstStringPtr problem_source() const;  /// extracts exception comment
1.35      paf        60:        const char *comment(bool can_be_empty=false) const { 
1.38.2.3  paf        61:                const char *result=fcomment.get()!=0 && *fcomment.get()?fcomment.get():0;
1.35      paf        62:                if(can_be_empty)
                     63:                        return result; 
                     64:                else
                     65:                        return result?result:"<no comment>";
                     66:        }
1.1       paf        67: 
                     68: private:
                     69: 
1.33      paf        70:        const char *ftype;
1.38.2.3  paf        71:        ConstStringPtr fproblem_source;
1.38.2.4  paf        72:        CharPtr fcomment;
1.15      parser     73: 
1.1       paf        74: };
1.38.2.5! paf        75: 
        !            76: const ConstStringPtr Exception::undefined_source(0);
1.1       paf        77: 
                     78: #endif

E-mail: