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

1.1       parser      1: /** @file
1.5       parser      2:        Parser: @b xdoc parser class decl.
1.1       parser      3: 
1.40      paf         4:        Copyright (c) 2001-2005 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.42    ! misha      11: static const char * const IDENT_VXDOC_H="$Date: 2005/12/16 10:15:12 $";
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"
1.39      paf        17: #include "pa_vhash.h"
1.1       parser     18: 
1.17      paf        19: // defines
                     20: 
                     21: #define VXDOC_TYPE "xdoc"
                     22: 
                     23: // externals
                     24: 
1.32      paf        25: extern Methoded* xdoc_class;
1.1       parser     26: 
1.25      paf        27: /// value of type 'xdoc'. implemented with libxml & co
1.32      paf        28: class VXdoc: public VXnode {
1.1       parser     29: public: // Value
1.4       parser     30: 
1.32      paf        31:        override const char* type() const { return VXDOC_TYPE; }
                     32:        override Value* as(const char* atype, bool looking_up);
1.24      paf        33: 
1.32      paf        34:        override VStateless_class* get_class() { return xdoc_class; }
1.6       parser     35: 
1.4       parser     36:        /// VXdoc: true
1.32      paf        37:        override bool as_bool() const { return true; }
1.4       parser     38: 
1.39      paf        39:        /// VXdoc: $CLASS,$method, fields
1.32      paf        40:        override Value* get_element(const String& aname, Value& aself, bool /*looking_up*/);
1.6       parser     41: 
1.25      paf        42: public: // VXNode
1.1       parser     43: 
1.41      paf        44:        override xmlNode& get_xmlnode() { 
                     45:                return *reinterpret_cast<xmlNode*>(&get_xmldoc());
1.1       parser     46:        }
                     47: 
1.41      paf        48:        override VXdoc& get_vxdoc() {
1.39      paf        49:                return *this;
                     50:        }
                     51: 
1.1       parser     52: public: // usage
                     53: 
1.41      paf        54:        VXdoc() : 
                     55:                VXnode(*this), 
                     56:                fcharsets(0),
                     57:                fdocument(0) {}
1.32      paf        58: 
1.41      paf        59:        VXdoc(Request_charsets& acharsets, xmlDoc& adocument) : VXnode(*this) {
                     60:                set_xmldoc(acharsets, adocument);
1.1       parser     61:        }
                     62: 
1.32      paf        63: public: // VXdoc
                     64: 
1.41      paf        65:        void set_xmldoc(Request_charsets& acharsets, xmlDoc& adocument) { 
                     66:                fcharsets=&acharsets;
                     67:                fdocument=&adocument;
                     68:                fdocument->_private=this;
1.8       parser     69:        }
1.41      paf        70:        xmlDoc& get_xmldoc() { 
1.37      paf        71:                if(!fdocument)
                     72:                        throw Exception("parser.runtime",
                     73:                                0,
                     74:                                "using unitialized xdoc object");
1.41      paf        75:                return *fdocument; 
                     76:        }
                     77: 
                     78:        Request_charsets& charsets() { 
                     79:                if(!fcharsets)
                     80:                        throw Exception("parser.runtime",
                     81:                                0,
                     82:                                "using unitialized xdoc object");
                     83:                return *fcharsets; 
1.1       parser     84:        }
1.13      paf        85: 
1.41      paf        86:        VXnode& wrap(xmlNode& anode);
                     87: 
1.13      paf        88: public:
1.39      paf        89: 
                     90:        VHash search_namespaces;
1.32      paf        91: 
1.13      paf        92:        struct Output_options {
1.32      paf        93:                const String* method;            /* the output method */
                     94:                const String* encoding;          /* encoding string */
                     95:                const String* mediaType;         /* media-type string */
1.38      paf        96:                int indent;                 /* should output being indented */
1.32      paf        97:                const String* version;           /* version string */
1.38      paf        98:                int standalone;             /* standalone = "yes" | "no" */
                     99:                int omitXmlDeclaration;     /* omit-xml-declaration = "yes" | "no" */
                    100: 
                    101:                Output_options() {
                    102:                        memset(this, 0, sizeof(*this));
                    103:                        indent=standalone=omitXmlDeclaration=-1;
                    104:                };
1.13      paf       105:        } output_options;
1.32      paf       106: 
                    107: private:
                    108: 
1.41      paf       109:        Request_charsets* fcharsets;
                    110:        xmlDoc* fdocument;
1.1       parser    111: };
                    112: 
                    113: #endif

E-mail: