Annotation of parser3/src/types/pa_vxdoc.h, revision 1.31.2.9.2.4

1.1       parser      1: /** @file
1.5       parser      2:        Parser: @b xdoc parser class decl.
1.1       parser      3: 
1.31.2.1  paf         4:        Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com)
1.19      paf         5:        Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.1       parser      6: */
                      7: 
                      8: #ifndef PA_VXDOC_H
                      9: #define PA_VXDOC_H
                     10: 
1.31.2.9.2.4! paf        11: static const char* IDENT_VXDOC_H="$Date: 2003/03/20 08:11:16 $";
1.22      paf        12: 
1.1       parser     13: #include "classes.h"
                     14: #include "pa_common.h"
                     15: #include "pa_vstateless_object.h"
                     16: #include "pa_vxnode.h"
                     17: 
1.17      paf        18: // defines
                     19: 
                     20: #define VXDOC_TYPE "xdoc"
                     21: 
                     22: // externals
                     23: 
1.31.2.9.2.4! paf        24: extern Methoded* xdoc_class;
1.1       parser     25: 
                     26: void VXdoc_cleanup(void *);
                     27: 
1.25      paf        28: /// value of type 'xdoc'. implemented with libxml & co
1.31.2.3  paf        29: class VXdoc: public VXnode {
1.1       parser     30: public: // Value
1.4       parser     31: 
1.31.2.5  paf        32:        override const char* type() const { return VXDOC_TYPE; }
                     33:        override Value* as(const char* atype, bool looking_up);
1.24      paf        34: 
1.31.2.9.2.4! paf        35:        override VStateless_class* get_class() { return xdoc_class; }
1.6       parser     36: 
1.4       parser     37:        /// VXdoc: true
1.31.2.5  paf        38:        override bool as_bool() const { return true; }
1.4       parser     39: 
                     40:        /// VXdoc: true
1.31.2.9.2.4! paf        41:        override Value* as_expr_result(bool return_string_as_is=false) { return Value*(new VBool(as_bool())); }
1.1       parser     42: 
1.6       parser     43:        /// VXnode: $CLASS,$method, fields
1.31.2.9.2.4! paf        44:        override Value* get_element(const String& aname, Value& aself, bool /*looking_up*/);
1.6       parser     45: 
1.25      paf        46: public: // VXNode
1.1       parser     47: 
1.31.2.9.2.1  paf        48:        virtual GdomeNode* get_node(const String* source) { 
1.31.2.5  paf        49:                return (GdomeNode*)get_document(source);
1.1       parser     50:        }
                     51: 
                     52: public: // usage
                     53: 
1.31.2.9.2.1  paf        54:        VXdoc( Request_charsets* acharsets, GdomeDocument *adocument) : 
1.31.2.9.2.3  paf        55:                VXnode(acharsets, 0), 
1.15      paf        56:                fdocument(adocument/*not adding ref, owning a doc*/) {
1.16      paf        57:                memset(&output_options, 0, sizeof(output_options));
1.1       parser     58:        }
1.31.2.5  paf        59: 
                     60:        override ~VXdoc() {
1.14      paf        61:                GdomeException exc;
                     62:                if(fdocument)                   
                     63:                        gdome_doc_unref(fdocument, &exc);
1.1       parser     64:        }
                     65: 
1.31.2.5  paf        66: public: // VXdoc
                     67: 
1.31.2.9.2.1  paf        68:        void set_document( Request_charsets* acharsets, GdomeDocument *adocument) { 
1.31.2.5  paf        69:                fpool=apool;
1.31.2.9  paf        70:                fcharsets=acharsets;
1.31.2.5  paf        71: 
1.14      paf        72:                GdomeException exc;
                     73:                if(fdocument)                   
                     74:                        gdome_doc_unref(fdocument, &exc);
1.8       parser     75: 
1.14      paf        76:                gdome_doc_ref(fdocument=adocument, &exc);
1.8       parser     77:        }
1.31.2.9.2.1  paf        78:        GdomeDocument* get_document(const String* source) { 
1.1       parser     79:                if(!fdocument)
1.31.2.9.2.2  paf        80:                        throw Exception(0,
1.1       parser     81:                                source,
                     82:                                "can not be applied to uninitialized instance");
1.14      paf        83:                return fdocument; 
1.1       parser     84:        }
1.13      paf        85: 
                     86: public:
1.31.2.5  paf        87: 
1.13      paf        88:        struct Output_options {
1.31.2.9.2.1  paf        89:                const String& method;            /* the output method */
                     90:                const String& encoding;          /* encoding string */
                     91:                const String& mediaType;         /* media-type string */
                     92:                const String& doctypeSystem;     /* doctype-system string */
                     93:                const String& doctypePublic;     /* doctype-public string */
1.16      paf        94:                bool indent;                 /* should output being indented */
1.31.2.9.2.1  paf        95:                const String& version;           /* version string */
1.16      paf        96:                bool standalone;             /* standalone = "yes" | "no" */
                     97:                bool omitXmlDeclaration;     /* omit-xml-declaration = "yes" | "no" */
1.13      paf        98:        } output_options;
1.31.2.5  paf        99: 
1.1       parser    100: private:
                    101: 
1.31.2.5  paf       102:        GdomeDocument* fdocument;
1.1       parser    103: };
1.31.2.6  paf       104: DECLARE_OBJECT_PTR(VXdoc);
1.1       parser    105: 
                    106: #endif

E-mail: