Annotation of parser3/src/types/pa_wcontext.C, revision 1.20

1.6       paf         1: /**    @file
                      2:        Parser: write context class.
                      3: 
1.14      paf         4:        Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)
1.15      paf         5:        Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.20    ! paf         6: */
1.6       paf         7: 
1.20    ! paf         8: static const char* IDENT_WCONTEXT_C="$Id: zzz $";
1.1       paf         9: 
                     10: #include "pa_wcontext.h"
                     11: #include "pa_exception.h"
1.3       paf        12: #include "pa_request.h"
1.1       paf        13: 
                     14: // appends a fstring to result
1.13      paf        15: void WContext::write(const String& astring, uchar lang) {
1.1       paf        16:        fstring.append(astring, lang);
                     17: }
                     18: 
1.4       paf        19: void WContext::write(Value& avalue) {
                     20:        if(fvalue) { // already have value?
1.16      paf        21:                // must not construct twice
1.18      paf        22:                throw Exception("parser.runtime",
                     23:                        fvalue->get_class()?&fvalue->get_class()->name():0,
1.19      paf        24:                        "%s may not be overwritten with '%s' %s, use constructor",
1.18      paf        25:                        fvalue->type(), 
                     26:                                avalue.get_class()->name_cstr(), avalue.type());
                     27:        } else 
                     28:                fvalue=&avalue;
                     29: }
                     30: 
                     31: void WContext::write(Value& avalue, const String* origin) {
                     32:        if(fvalue) { // already have value?
                     33:                // must not construct twice
                     34:                if(origin)
1.17      paf        35:                        throw Exception("parser.runtime",
1.18      paf        36:                                origin,
1.19      paf        37:                                "contains illegal assignment attempt of %s to %s %s, use constructor",
1.18      paf        38:                                avalue.type(), 
                     39:                                        fvalue->get_class()->name_cstr(), fvalue->type());
                     40:                else            
1.17      paf        41:                        throw Exception("parser.runtime",
1.18      paf        42:                                fvalue->get_class()?&fvalue->get_class()->name():0,
1.19      paf        43:                                "%s may not be overwritten with %s %s, use constructor",
1.18      paf        44:                                fvalue->type(), 
                     45:                                        avalue.get_class()->name_cstr(), avalue.type());
1.5       paf        46:        } else 
1.4       paf        47:                fvalue=&avalue;
1.18      paf        48: }

E-mail: