mesgtext.cc

来自「在Linux开发环境下实现JPEG_LS压缩标注」· CC 代码 · 共 68 行

CC
68
字号
#include <string.h>#include <strstream.h>#include "basetype.h"#include "mesgtext.h"struct EMSGDC_Table_Entry {	const char *index;	const char *description;};#include "mesgttbl.h"static voiddummy(void){	(void)&EMSGDC_Instance;		// shuts up unused warning}static const char *findDescription(const char *index){	Assert(index);	// Efficiency is not an issue here, so linear search is fine	EMSGDC_Table_Entry *ptr;	for (ptr=EMSGDC_Table; ptr && ptr->index && strcmp(ptr->index,index) != 0; ++ptr);	//Assert(ptr && ptr->index && ptr->description);	if (!ptr || !ptr->index || !ptr->description) {		return index;	}	else		return ptr->description;}char *EMSGDC_Class::error(const char *index){	ostrstream stream;	stream << findDescription("Error") << " - ";	if (index && strlen(index)) stream << findDescription(index) << ends;	return stream.str();}char *EMSGDC_Class::warning(const char *index){	ostrstream stream;	stream << findDescription("Warning") << " - ";	if (index && strlen(index)) stream << findDescription(index) << ends;	return stream.str();}char *EMSGDC_Class::abort(const char *index){	ostrstream stream;	stream << findDescription("Abort") << " - ";	if (index && strlen(index)) stream << findDescription(index) << ends;	return stream.str();}const char *EMSGDC_Class::message(const char *index){	return index && strlen(index) ? findDescription(index) : "";}

⌨️ 快捷键说明

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