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

1.1       parser      1: /** @file
1.5       parser      2:        Parser: @b xdoc parser class decl.
1.1       parser      3: 
1.18      paf         4:        Copyright (c) 2001, 2002 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.23    ! paf        11: static const char* IDENT_VXDOC_H="$Date: pa_vxdoc.h,v 1.22 2002/08/01 11:26:57 paf Exp $";
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.1       parser     24: extern Methoded *Xdoc_class;
                     25: 
                     26: void VXdoc_cleanup(void *);
                     27: 
1.5       parser     28: /// value of type 'xdoc'. implemented with XalanDocument & co
1.1       parser     29: class VXdoc : public VXnode {
1.13      paf        30:        friend void VXdoc_destructor(void *);
1.1       parser     31: public: // Value
1.4       parser     32: 
1.17      paf        33:        const char *type() const { return VXDOC_TYPE; }
1.21      paf        34:        VStateless_class *get_class() { return Xdoc_class; }
1.6       parser     35: 
1.4       parser     36:        /// VXdoc: true
                     37:        bool as_bool() const { return true; }
                     38: 
                     39:        /// VXdoc: true
                     40:        Value *as_expr_result(bool return_string_as_is=false) { return NEW VBool(pool(), as_bool()); }
1.1       parser     41: 
1.6       parser     42:        /// VXnode: $CLASS,$method, fields
                     43:        Value *get_element(const String& name);
                     44: 
1.1       parser     45: protected: // VAliased
                     46: 
                     47:        /// disable .CLASS element. @see VAliased::get_element
                     48:        bool hide_class() { return true; }
                     49: 
                     50: public: // VDNode
                     51: 
1.14      paf        52:        /// @test conv validity
1.15      paf        53:        virtual GdomeNode *get_node(const String *source) { 
                     54:                return (GdomeNode *)get_document(source);
1.1       parser     55:        }
                     56: 
                     57: public: // usage
                     58: 
1.15      paf        59:        VXdoc(Pool& apool, GdomeDocument *adocument) : 
1.21      paf        60:                VXnode(apool, 0), 
1.15      paf        61:                fdocument(adocument/*not adding ref, owning a doc*/) {
1.14      paf        62: //             ftransformer(0) 
                     63: 
1.13      paf        64:                register_cleanup(VXdoc_destructor, this);
1.14      paf        65: //             ftransformer=new XalanTransformer2;
1.16      paf        66:                memset(&output_options, 0, sizeof(output_options));
1.1       parser     67:        }
1.14      paf        68: protected:
1.13      paf        69:        ~VXdoc() {
1.14      paf        70:                GdomeException exc;
                     71:                if(fdocument)                   
                     72:                        gdome_doc_unref(fdocument, &exc);
1.8       parser     73: 
1.14      paf        74: //             delete ftransformer;
1.1       parser     75:        }
                     76: public:
                     77: 
1.14      paf        78:        //XalanTransformer2& transformer() {return *ftransformer; }
                     79:        void set_document(GdomeDocument *adocument) { 
                     80:                GdomeException exc;
                     81:                if(fdocument)                   
                     82:                        gdome_doc_unref(fdocument, &exc);
1.8       parser     83: 
1.14      paf        84:                gdome_doc_ref(fdocument=adocument, &exc);
1.8       parser     85:        }
1.15      paf        86:        GdomeDocument *get_document(const String *source) { 
1.1       parser     87:                if(!fdocument)
1.20      paf        88:                        throw Exception(0,
1.1       parser     89:                                source,
                     90:                                "can not be applied to uninitialized instance");
1.14      paf        91:                return fdocument; 
1.1       parser     92:        }
1.13      paf        93: 
                     94: public:
                     95:        struct Output_options {
1.16      paf        96:                const String *method;            /* the output method */
                     97:                const String *encoding;          /* encoding string */
                     98:                const String *mediaType;         /* media-type string */
                     99:                const String *doctypeSystem;     /* doctype-system string */
                    100:                const String *doctypePublic;     /* doctype-public string */
                    101:                bool indent;                 /* should output being indented */
                    102:                const String *version;           /* version string */
                    103:                bool standalone;             /* standalone = "yes" | "no" */
                    104:                bool omitXmlDeclaration;     /* omit-xml-declaration = "yes" | "no" */
1.13      paf       105:        } output_options;
1.1       parser    106: private:
                    107: 
1.14      paf       108:        GdomeDocument *fdocument;
1.1       parser    109: };
                    110: 
                    111: #endif

E-mail: