当前位置: 首页>>代码示例>>C++>>正文


C++ Converter::Convert方法代码示例

本文整理汇总了C++中Converter::Convert方法的典型用法代码示例。如果您正苦于以下问题:C++ Converter::Convert方法的具体用法?C++ Converter::Convert怎么用?C++ Converter::Convert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Converter的用法示例。


在下文中一共展示了Converter::Convert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: SysStringByteLen

CMarkdown::HSTR CMarkdown::_HSTR::Convert(const Converter &converter)
{
	HSTR H = this;
	size_t s = SysStringByteLen(B);
	if (size_t d = converter.Convert(A, s, 0, 0))
	{
		H = (HSTR)SysAllocStringByteLen(0, d);
		converter.Convert(A, s, H->A, d);
		SysFreeString(B);
	}
	return H;
}
开发者ID:YueLinHo,项目名称:WinMerge,代码行数:12,代码来源:markdown.cpp

示例2: main

int main (int argc, char *argv[]) {
	try {
		static struct option long_options[] = {
			{ "source-encoding", required_argument, NULL, 's' },
			{ "id3v1-encoding", required_argument, NULL, '1' },
			{ "id3v2-encoding", required_argument, NULL, '2' },
			{ "preserve-unicode", no_argument, NULL, 'p' },
			{ "preview", no_argument, NULL, 'w' },
			{ "version", no_argument, NULL, 'v' },
			{ "help", no_argument, NULL, 'h' },
   			{ "quiet", no_argument, NULL, 'q' },
			{ NULL, 0, NULL, 0 }
		};
		int long_options_ret;
		std::string source_encoding;
		std::string id3v1_encoding = "none";
		std::string id3v2_encoding = "none";
		bool preserve_unicode = false;
		bool preview = false;
		bool usage_ok = true;
		bool verbose = true;
		
		if(argc == 1) {
			printf("%s", msg::usage);
			exit(1);
		}

		while (
			(long_options_ret = getopt_long (argc, argv, "s:1:2:pwdvhq", long_options, NULL)) != -1
		) {
			switch (long_options_ret) {
				case 's':
					source_encoding = optarg;
					tolower(source_encoding);
				break;
				case '1':
					id3v1_encoding = optarg;
					tolower(id3v1_encoding);
				break;
				case '2':
					id3v2_encoding = optarg;
					tolower(id3v2_encoding);
				break;
				case 'p':
					preserve_unicode = true;
				break;
				case 'w':
					preview = true;
				break;
				case 'v':
					printf("%s %s\n", PACKAGE, PACKAGE_VERSION);
					printf("%s", msg::copyright);
					exit (1);
				break;
				case 'h':
					printf("%s", msg::usage);
					exit(1);
				case 'q':
					verbose = false;
				break;
				default:
					usage_ok = false;
				break;
			}
		}

		if (usage_ok && source_encoding.empty ()) {
			printf("%s", msg::nosenc);
			usage_ok = false;
		}
		
		if(optind == argc) {
			printf("%s", msg::nofiles);
			usage_ok = false;
		}

		if (!usage_ok) {
			printf("%s", msg::seehelp);
			exit (1);
		}

		TagLib::ID3v2::FrameFactory::instance()->setDefaultTextEncoding (TagLib::String::UTF8);

		for (int i=optind;i<argc;i++) {
			TagLib::MPEG::File mp3file(argv[i]);

			if (!mp3file.isOpen ()) {
				throw msg::nofile(argv[i]);
			}
			
			TagLib::Tag *tag = mp3file.tag();
			
			if(tag->isEmpty()) {
				printf("%s", msg::emptyfile(argv[i]).c_str());
			}
			else {
				Converter converter (
					source_encoding,
					id3v1_encoding,
					id3v2_encoding,
//.........这里部分代码省略.........
开发者ID:alonbl,项目名称:mp3unicode,代码行数:101,代码来源:mp3unicode.cpp


注:本文中的Converter::Convert方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。