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

1.10      paf         1: /** @file
1.11      paf         2:        Parser: exception decls.
                      3: 
1.38.2.13  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.14! paf        11: static const char* IDENT_EXCEPTION_H="$Date: 2003/01/31 12:34:30 $";
1.38.2.10  paf        12: 
                     13: // includes
                     14: 
                     15: #include "pa_pool.h"
1.1       paf        16: 
1.38.2.9  paf        17: // forwards
                     18: 
1.38.2.12  paf        19: class String; DECLARE_OBJECT_PTR(String);
1.14      parser     20: 
1.22      paf        21: // defines
                     22: 
1.1       paf        23: class Exception {
                     24: public:
                     25: 
1.38.2.13  paf        26:        static const char* undefined_type;
1.38.2.12  paf        27:        static const StringPtr undefined_source;
1.38.2.2  paf        28: 
1.19      paf        29:        Exception();
1.15      parser     30:        Exception(
1.38.2.13  paf        31:                const char* atype,
1.38.2.12  paf        32:                StringPtr aproblem_source, 
1.38.2.13  paf        33:                const char* comment_fmt, ...);
1.38.2.14! paf        34:        Exception(const Exception& src);
        !            35:        Exception& operator =(const Exception& src);
1.14      parser     36: 
                     37: #ifdef XML
1.28      paf        38:        Exception(
1.38.2.12  paf        39:                StringPtr aproblem_source, 
1.28      paf        40:                GdomeException& exc);
1.14      parser     41: #endif
1.1       paf        42: 
1.10      paf        43:        /// extracts exception type
1.38.2.13  paf        44:        const char* type(bool can_be_empty=false) const { 
1.35      paf        45:                if(can_be_empty)
                     46:                        return ftype; 
                     47:                else
                     48:                        return ftype?ftype:"<no type>";
                     49:        }
1.10      paf        50:        /// extracts exception problem_source
1.38.2.12  paf        51:        StringPtr problem_source() const;       /// extracts exception comment
1.38.2.13  paf        52:        const char* comment(bool can_be_empty=false) const { 
                     53:                const char* result=fcomment.get()!=0 && *fcomment.get()?fcomment.get():0;
1.35      paf        54:                if(can_be_empty)
                     55:                        return result; 
                     56:                else
                     57:                        return result?result:"<no comment>";
                     58:        }
1.1       paf        59: 
                     60: private:
                     61: 
1.38.2.13  paf        62:        const char* ftype;
1.38.2.12  paf        63:        StringPtr fproblem_source;
1.38.2.4  paf        64:        CharPtr fcomment;
1.15      parser     65: 
1.1       paf        66: };
                     67: 
                     68: #endif

E-mail: