/* This is RTF to HTML converter, implemented as a text filter, generally.
Copyright (C) 2003 Valentin Lavrinenko, vlavrinenko@users.sourceforge.net
available at http://rtf2html.sf.net
Original available under the terms of the GNU LGPL2, and according
to those terms, relicensed under the GNU GPL2 for inclusion in Tellico *//***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of version 2 of the GNU General Public License as *
* published by the Free Software Foundation; *
* *
***************************************************************************/#ifndef __RTF_KEYWORD_H__#define __RTF_KEYWORD_H__#include<string>#include<map>#include<ctype.h>#include<cstdlib>namespacertf{classrtf_keyword{public:enumkeyword_type{rkw_unknown,rkw_b,rkw_bin,rkw_blue,rkw_brdrnone,rkw_bullet,rkw_cb,rkw_cell,rkw_cellx,rkw_cf,rkw_clbrdrb,rkw_clbrdrl,rkw_clbrdrr,rkw_clbrdrt,rkw_clvertalb,rkw_clvertalc,rkw_clvertalt,rkw_clvmgf,rkw_clvmrg,rkw_colortbl,rkw_emdash,rkw_emspace,rkw_endash,rkw_enspace,rkw_fi,rkw_field,rkw_filetbl,rkw_f,rkw_fprq,rkw_fcharset,rkw_fnil,rkw_froman,rkw_fswiss,rkw_fmodern,rkw_fscript,rkw_fdecor,rkw_ftech,rkw_fbidi,rkw_fldrslt,rkw_fonttbl,rkw_footer,rkw_footerf,rkw_fs,rkw_green,rkw_header,rkw_headerf,rkw_highlight,rkw_i,rkw_info,rkw_intbl,rkw_ldblquote,rkw_li,rkw_line,rkw_lquote,rkw_margl,rkw_object,rkw_paperw,rkw_par,rkw_pard,rkw_pict,rkw_plain,rkw_qc,rkw_qj,rkw_ql,rkw_qmspace,rkw_qr,rkw_rdblquote,rkw_red,rkw_ri,rkw_row,rkw_rquote,rkw_sa,rkw_sb,rkw_sect,rkw_softline,rkw_stylesheet,rkw_sub,rkw_super,rkw_tab,rkw_title,rkw_trleft,rkw_trowd,rkw_trrh,rkw_ul,rkw_ulnone};private:classkeyword_map:publicstd::map<std::string,keyword_type>{private:typedefstd::map<std::string,keyword_type>base_class;public:keyword_map();};private:statickeyword_mapkeymap;std::strings_keyword;keyword_typee_keyword;intparam;charctrl_chr;boolis_ctrl_chr;public:// iter must point after the backslash starting the keyword. We don't check it.
// after construction, iter points at the char following the keyword
template<classInputIter>explicitrtf_keyword(InputIter&iter);boolis_control_char()const{returnis_ctrl_chr;}conststd::string&keyword_str()const{returns_keyword;}keyword_typekeyword()const{returne_keyword;}intparameter()const{returnparam;}charcontrol_char()const{returnctrl_chr;}};template<classInputIter>rtf_keyword::rtf_keyword(InputIter&iter){charcurchar=*iter;is_ctrl_chr=!isalpha(curchar);if(is_ctrl_chr){ctrl_chr=curchar;++iter;}else{dos_keyword+=curchar;while(isalpha(curchar=*++iter));std::stringparam_str;while(isdigit(curchar)||curchar=='-'){param_str+=curchar;curchar=*++iter;}if(param_str.empty())param=-1;elseparam=std::atoi(param_str.c_str());if(curchar=='')++iter;keyword_map::iteratorkw_pos=keymap.find(s_keyword);if(kw_pos==keymap.end())