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

1.1       parser      1: /** @file
1.5       parser      2:        Parser: @b xdoc parser class decl.
1.1       parser      3: 
                      4:        Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com)
1.12      paf         5:        Author: Alexander Petrosyan <paf@design.ru> (http://paf.design.ru)
1.1       parser      6: 
1.16    ! paf         7:        $Id: pa_vxdoc.h,v 1.15 2001/12/28 14:06:52 paf Exp $
1.1       parser      8: */
                      9: 
                     10: #ifndef PA_VXDOC_H
                     11: #define PA_VXDOC_H
                     12: 
                     13: #include "classes.h"
                     14: #include "pa_common.h"
                     15: #include "pa_vstateless_object.h"
                     16: #include "pa_vxnode.h"
                     17: 
1.14      paf        18: //#include "libxml/xmlmemory.h"
                     19: //#include "libxml/parser.h"
                     20: //#include "libxslt/xslt.h"
                     21: //#include "libxslt/libxslt.h"
                     22: //#include "libxslt/extensions.h"
                     23: //#include "libexslt/exslt.h"
1.16    ! paf        24: //#include "libxslt/xsltInternals.h"
1.1       parser     25: 
                     26: extern Methoded *Xdoc_class;
                     27: 
                     28: void VXdoc_cleanup(void *);
                     29: 
1.5       parser     30: /// value of type 'xdoc'. implemented with XalanDocument & co
1.1       parser     31: class VXdoc : public VXnode {
1.13      paf        32:        friend void VXdoc_destructor(void *);
1.1       parser     33: public: // Value
1.4       parser     34: 
1.6       parser     35:        const char *type() const { return "xdoc"; }
                     36: 
1.4       parser     37:        /// VXdoc: true
                     38:        bool as_bool() const { return true; }
                     39: 
                     40:        /// VXdoc: true
                     41:        Value *as_expr_result(bool return_string_as_is=false) { return NEW VBool(pool(), as_bool()); }
1.1       parser     42: 
1.6       parser     43:        /// VXnode: $CLASS,$method, fields
                     44:        Value *get_element(const String& name);
                     45: 
1.1       parser     46: protected: // VAliased
                     47: 
                     48:        /// disable .CLASS element. @see VAliased::get_element
                     49:        bool hide_class() { return true; }
                     50: 
                     51: public: // VDNode
                     52: 
1.14      paf        53:        /// @test conv validity
1.15      paf        54:        virtual GdomeNode *get_node(const String *source) { 
                     55:                return (GdomeNode *)get_document(source);
1.1       parser     56:        }
                     57: 
                     58: public: // usage
                     59: 
1.15      paf        60:        VXdoc(Pool& apool, GdomeDocument *adocument) : 
                     61:                VXnode(apool, 0, *Xdoc_class), 
                     62:                fdocument(adocument/*not adding ref, owning a doc*/) {
1.14      paf        63: //             ftransformer(0) 
                     64: 
1.13      paf        65:                register_cleanup(VXdoc_destructor, this);
1.14      paf        66: //             ftransformer=new XalanTransformer2;
1.16    ! paf        67:                memset(&output_options, 0, sizeof(output_options));
1.1       parser     68:        }
1.14      paf        69: protected:
1.13      paf        70:        ~VXdoc() {
1.14      paf        71:                GdomeException exc;
                     72:                if(fdocument)                   
                     73:                        gdome_doc_unref(fdocument, &exc);
1.8       parser     74: 
1.14      paf        75: //             delete ftransformer;
1.1       parser     76:        }
                     77: public:
                     78: 
1.14      paf        79:        //XalanTransformer2& transformer() {return *ftransformer; }
                     80:        void set_document(GdomeDocument *adocument) { 
                     81:                GdomeException exc;
                     82:                if(fdocument)                   
                     83:                        gdome_doc_unref(fdocument, &exc);
1.8       parser     84: 
1.14      paf        85:                gdome_doc_ref(fdocument=adocument, &exc);
1.8       parser     86:        }
1.15      paf        87:        GdomeDocument *get_document(const String *source) { 
1.1       parser     88:                if(!fdocument)
1.9       parser     89:                        throw Exception(0, 0,
1.1       parser     90:                                source,
                     91:                                "can not be applied to uninitialized instance");
1.14      paf        92:                return fdocument; 
1.1       parser     93:        }
1.13      paf        94: 
                     95: public:
                     96:        struct Output_options {
1.16    ! paf        97:                const String *method;            /* the output method */
        !            98:                const String *encoding;          /* encoding string */
        !            99:                const String *mediaType;         /* media-type string */
        !           100:                const String *doctypeSystem;     /* doctype-system string */
        !           101:                const String *doctypePublic;     /* doctype-public string */
        !           102:                bool indent;                 /* should output being indented */
        !           103:                const String *version;           /* version string */
        !           104:                bool standalone;             /* standalone = "yes" | "no" */
        !           105:                bool omitXmlDeclaration;     /* omit-xml-declaration = "yes" | "no" */
1.13      paf       106:        } output_options;
1.1       parser    107: private:
                    108: 
1.14      paf       109:        GdomeDocument *fdocument;
1.1       parser    110: };
                    111: 
                    112: #endif

E-mail: