File indexing completed on 2024-05-26 05:11:29
0001 /* This is RTF to HTML converter, implemented as a text filter, generally. 0002 Copyright (C) 2003 Valentin Lavrinenko, vlavrinenko@users.sourceforge.net 0003 0004 available at http://rtf2html.sf.net 0005 0006 Original available under the terms of the GNU LGPL2, and according 0007 to those terms, relicensed under the GNU GPL2 for inclusion in Tellico */ 0008 0009 /*************************************************************************** 0010 * * 0011 * This program is free software; you can redistribute it and/or * 0012 * modify it under the terms of the GNU General Public License as * 0013 * published by the Free Software Foundation; either version 2 of * 0014 * the License or (at your option) version 3 or any later version * 0015 * accepted by the membership of KDE e.V. (or its successor approved * 0016 * by the membership of KDE e.V.), which shall act as a proxy * 0017 * defined in Section 14 of version 3 of the license. * 0018 * * 0019 * This program is distributed in the hope that it will be useful, * 0020 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0022 * GNU General Public License for more details. * 0023 * * 0024 * You should have received a copy of the GNU General Public License * 0025 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 0026 * * 0027 ***************************************************************************/ 0028 0029 #ifndef RTF2HTML_DBGITER_H 0030 #define RTF2HTML_DBGITER_H 0031 0032 namespace rtf { 0033 0034 template <class T> 0035 class dbg_iter_mixin : public virtual T 0036 { 0037 public: 0038 int offset; 0039 dbg_iter_mixin(const T& t) : T(t) 0040 {} 0041 T& operator=(const T& t) 0042 { 0043 return T::operator=(t); 0044 } 0045 dbg_iter_mixin& operator++ () 0046 { 0047 ++offset; 0048 T::operator++(); 0049 return *this; 0050 } 0051 dbg_iter_mixin operator++ (int i) 0052 { 0053 ++offset; 0054 return T::operator++(i); 0055 } 0056 char operator *() const 0057 { 0058 T::value_type c=T::operator*(); 0059 // std::cerr<<offset<<":"<<c<<std::endl; 0060 return c; 0061 } 0062 }; 0063 0064 template <class T> 0065 class dbg_iter : public dbg_iter_mixin<T> 0066 { 0067 public: 0068 dbg_iter(const T& t) : dbg_iter_mixin<T>(t) 0069 {} 0070 }; 0071 0072 template<class T> 0073 class dbg_iter<std::istreambuf_iterator<T> > : 0074 public virtual std::istreambuf_iterator<T>, 0075 public dbg_iter_mixin<std::istreambuf_iterator<T> > 0076 { 0077 public: 0078 dbg_iter(std::basic_streambuf<T> *buf) : std::istreambuf_iterator<T>(buf) 0079 {} 0080 }; 0081 0082 } 0083 0084 #endif