00001 /*************************************************************************** 00002 xmlcodecbase.h - Definition of XmlCodecBase class 00003 ------------------- 00004 begin : June 21 2002 00005 copyright : (C) 2003 by Vojtìch Toman 00006 email : vtoman@lit.cz 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 00029 #ifndef XMLCODECBASE_H 00030 #define XMLCODECBASE_H 00031 00032 00033 #include "defs.h" 00034 #include "options.h" 00035 #include "iodevice.h" 00036 #include "textcodec.h" 00037 #include "saxreceptor.h" 00038 00039 00040 00042 enum XmlCoderType 00043 { 00045 UnknownCoder, 00046 00048 PullCoder, 00049 00051 PushCoder 00052 }; 00053 00054 00055 00056 00062 class XmlCodecBase : public UserOfTextCodec 00063 { 00064 public: 00066 XmlCodecBase(void) : UserOfTextCodec() { coderType = UnknownCoder; } 00067 00073 virtual ~XmlCodecBase(void) {} 00074 00081 virtual bool encode(IODevice *inDevice, IODevice *outDevice) = 0; 00082 00087 virtual void initializePushCoder(IODevice *outDevice) = 0; 00088 00098 virtual bool encodePush(const char *data, int length, bool isFinal = false) = 0; 00099 00107 virtual bool decode(IODevice *inDevice, SAXReceptor *receptor, void *userData = 0) = 0; 00108 00109 protected: 00111 XmlCoderType coderType; 00112 }; 00113 00114 00115 #endif //XMLCODECBASE_H