|
|
#ifndef NKF_H #define NKF_H class Nkf { public: Nkf(); virtual ~Nkf(); enum NkfCode{JIS, SJIS, EUC}; void reset(); void setConversion(bool flag); void setInputCode(NkfCode code); void setBrokenInput(int mode = -1); void setDecodeMime(bool flag); void setDecodeBase64(bool flag); void setDecodeQuotedStream(bool flag); void setOutputBuffered(bool flag); void setOutputCode(NkfCode code); void setLatin1Support(bool falg); void setOutputSequenceToDesignateAscii(char c); void setOutputSequenceToDesignateJisKanji(char c); void setAssumeHankakuKana(bool flag); void setConvertZenkakuAlphabetToAscii(int mode = -1); void setFolding(int f); void setAddCR(bool flag); void setDeleteCR(bool flag); void setXcryptRot1347(bool flag); bool check(); NkfCode InputCode(void); NkfCode OutputCode(void); int begin(); int end(); protected: int convert(); int noconvert(); int h_conv(register int c2, register int c1); int push_hold_buf(int c2, int c1); void s_iconv(register int c2,register int c1); void e_oconv(register int c2,register int c1); void s_oconv(register int c2,register int c1); void j_oconv(register int c2,register int c1); int fold(register int c2,register int c1); int pre_convert(register int c1,register int c2); int mime_begin(); int mime_get_char(); int mime_unget_char(unsigned int c); int mime_integrity(unsigned char *p); virtual int get_char() = 0; virtual int unget_char(int c) = 0; virtual int put_char(int c) = 0; unsigned char * hold_buf; int hold_count; /* MIME preprocessor fifo */ unsigned char * mime_buf; unsigned int mime_top; unsigned int mime_last; /* decoded */ unsigned int mime_input; /* undecoded */ /* flags */ int unbuf_f:1; int estab_f:1; int nop_f:1; int rot_f:1; /* rot14/43 mode */ int input_f; /* non fixed input code */ int alpha_f; /* convert JIx0208 alphbet to ASCII */ int mime_f:1; /* convert MIME B base64 or Q */ int mimebuf_f; /* MIME buffered input */ int broken_f; /* convert ESC-less broken JIS */ int iso8859_f:1; /* ISO8859 through */ int iso8859_f_save:1; int x0201_f; /* Assume JISX0201 kana */ NkfCode input_code; /* X0208 -> ASCII converter */ int c1_return; /* fold parameter */ int line; /* chars in line */ int prev; int fold_f:1; int fold_len; /* options */ char kanji_intro, ascii_intro; /* converters */ void (Nkf::*iconv) (int c2, int c1); /* s_iconv or oconv */ void (Nkf::*oconv) (int c2, int c1); /* [ejs]_oconv */ /* Global states */ int output_mode, /* output kanji mode */ input_mode, /* input kanji mode */ shift_mode; /* TRUE shift out, or X0201 */ int mime_mode; /* MIME mode B base64, Q hex */ int add_cr:1; int del_cr:1; private: }; class StringNkf : public Nkf { public: char *convert(const char *string, int length = 0); protected: int get_char(); int unget_char(int c); int put_char(int c); private: const char *istring; int ilength; int ioffset; char *ostring; int olength; int ooffset; }; class FileNkf : public Nkf { public: int convert(FILE *in, FILE *out); protected: int get_char(); int unget_char(int c); int put_char(int c); private: FILE *ifile; FILE *ofile; }; #endif /* NKF_H */
Generated by: prospector@porky.devel.redhat.com on Mon Sep 11 01:50:52 2000, using kdoc 2.0a36. |