Back to index

scribus-ng  1.3.4.dfsg+svn20071115
saxfilter.h
Go to the documentation of this file.
00001 /*
00002  *  saxfilter.h
00003  *  
00004  *
00005  *  Created by Andreas Vox on 21.09.06.
00006  *  Copyright 2006 under GPL2. All rights reserved.
00007  *
00008  */
00009 
00010 
00011 
00012 #ifndef SAXFILTER_H
00013 #define SAXFILTER_H
00014 
00015 #include "saxhandler.h"
00016 
00020 class SaxFilter : public SaxHandler {
00021 public:
00022        SaxFilter(SaxHandler* delegate)        : m_delegate(delegate)  {}
00023        void setDelegate(SaxHandler* delegate) { m_delegate = delegate; }
00024        SaxHandler* delegate()                 { return m_delegate; }
00025        virtual void beginDoc();
00026        virtual void endDoc();
00027        virtual void begin(const Xml_string& tag, Xml_attr attr);
00028        virtual void end(const Xml_string& tag);
00029        virtual void chars(const Xml_string& text);
00030 private:
00031        SaxHandler* m_delegate;
00032 };
00033 
00034 
00044 class KeepOpen : public SaxFilter {
00045 public:
00046        KeepOpen(SaxHandler* delegate);
00047        virtual void begin(const Xml_string& tag, Xml_attr attr);
00048        virtual void end(const Xml_string& tag);
00049        Xml_string openTag();
00050 private:
00051        int    m_level;
00052        Xml_string m_tag;
00053 };
00054 
00055 
00060 class RenameElem : public SaxFilter {
00061 public:
00062        RenameElem(SaxHandler* delegate, const Xml_string& oldname, const Xml_string& newname);
00063        RenameElem(SaxHandler* delegate, const Xml_string& newname);
00064        virtual void begin(const Xml_string& tag, Xml_attr attr);
00065        virtual void end(const Xml_string& tag);
00066 private:
00067        int m_level;  
00068        Xml_string m_old;
00069        Xml_string m_new;
00070 };
00071 
00072 
00076 class AddAttributes : public SaxFilter {
00077 public:
00078        AddAttributes(SaxHandler* delegate, Xml_attr add);
00079        virtual void begin(const Xml_string& tag, Xml_attr attr);
00080 private:
00081        bool m_oneshot;
00082        Xml_attr m_attributes;
00083 };
00084 
00085 
00092 class SaxHandlerNull : public SaxHandler {
00093 public:
00094        SaxHandlerNull() {}
00095        virtual void beginDoc() {}
00096        virtual void endDoc() {}
00097        virtual void begin(const Xml_string& tag, Xml_attr attr) {}
00098        virtual void end(const Xml_string& tag) {}
00099        virtual void chars(const Xml_string& text) {}
00100 };
00101 
00102 
00103 #endif