⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 text_file_handler.cpp

📁 以wxWidget撰寫的簡繁體中文轉換程式 已在Linux上編譯過
💻 CPP
字号:
/*  * Copyright (C) 2006, Dung-Bang Tsai * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * * ( If you wnat to use this library for commercial use,  *	  feel free to contact me, just cost some money, I could sell *		you the code without GPL license, so you could use this code *		for your product without public your source code.  				) * * Authors: *	Tsai, Dung-Bang <dbtsai@gmail.com> *			*			2006/03/10		at NCKU physics */#include "text_file_handler.h" #include <fstream>void text_file_handler::Read(size_t n_byte){		wxFFile fp(filename);		raw_n_bytes = fp.Length();  		if(n_byte >= raw_n_bytes || n_byte == 0)	{ 		raw_buffer_n_bytes = raw_n_bytes;	}	else	{ 		raw_buffer_n_bytes = n_byte;	}	raw_data = new unsigned char[raw_buffer_n_bytes + 10];		raw_buffer_n_bytes = fp.Read(raw_data, raw_buffer_n_bytes);		fp.Close();		code_page.SetSrcChar(this->raw_data);	code_page.SetSrcBytes(this->raw_buffer_n_bytes);    	code_page.SetTestBytes(this->raw_buffer_n_bytes);  // Fix me when config file down	code_page.SetOutputString(*string);}void text_file_handler::Detect_code_page(){		int code_t;	if(code > 0) return;			code_t = code_page.UnicodeBOM_test();	if(code_t > 0){ code = code_t; BOM = true; return ;}  // Test BOM first.		code_t = code_page.Unicode_signature_test();		// Test if Unicode	if(code_t > 0){ code = code_t; return ;}		if(code_page.IsBinaryData()==true )  // If binary,error.	{code_t = -1; return;}		if( code_page.IsASCII() ){ code = ASCII_CODE; return ;}  // Test if ASCII	code = Big5_UAO_CODE;}void text_file_handler::ConvertFromSrcToString(){	code_page.ConvertFromSrctoResultString(code);	newline = string->GetNewLineType();	if(raw_data!=NULL){delete raw_data; raw_data = NULL;}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -