这篇教程C++ to_utf8函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中to_utf8函数的典型用法代码示例。如果您正苦于以下问题:C++ to_utf8函数的具体用法?C++ to_utf8怎么用?C++ to_utf8使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了to_utf8函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: LYXERRvoid GuiClipboard::put(string const & lyx, docstring const & html, docstring const & text){ LYXERR(Debug::ACTION, "GuiClipboard::put(`" << lyx << "' `" << to_utf8(html) << "' `" << to_utf8(text) << "')"); // We don't convert the encoding of lyx since the encoding of the // clipboard contents is specified in the data itself QMimeData * data = new QMimeData; if (!lyx.empty()) { QByteArray const qlyx(lyx.c_str(), lyx.size()); data->setData(lyxMimeType(), qlyx); // If the OS has not the concept of clipboard ownership, // we recognize internal data through its checksum. if (!hasInternal()) { boost::crc_32_type crc32; crc32.process_bytes(lyx.c_str(), lyx.size()); checksum = crc32.checksum(); } } // Don't test for text.empty() since we want to be able to clear the // clipboard. QString const qtext = toqstr(text); data->setText(qtext); QString const qhtml = toqstr(html); data->setHtml(qhtml); qApp->clipboard()->setMimeData(data, QClipboard::Clipboard);}
开发者ID:maxvas,项目名称:SciLyx,代码行数:26,
示例2: docstringdocstring InsetListings::getCaption(OutputParams const & runparams) const{ if (paragraphs().empty()) return docstring(); InsetCaption const * ins = getCaptionInset(); if (ins == 0) return docstring(); TexRow texrow; odocstringstream ods; otexstream os(ods, texrow); ins->getOptArg(os, runparams); ins->getArgument(os, runparams); // the caption may contain /label{} but the listings // package prefer caption={}, label={} docstring cap = ods.str(); if (!contains(to_utf8(cap), "//label{")) return cap; // convert from // blah1/label{blah2} blah3 // to // blah1 blah3},label={blah2 // to form options // caption={blah1 blah3},label={blah2} // // NOTE that } is not allowed in blah2. regex const reg("(.*)////label//{(.*?)//}(.*)"); string const new_cap("//1//3},label={//2"); return from_utf8(regex_replace(to_utf8(cap), reg, new_cap));}
开发者ID:JoaquimBellmunt,项目名称:lyx,代码行数:31,
示例3: ChatClient ChatClient(void *epoll, void *raddr, int raddrlen) : epoll(epoll) { /* Construct a std::string representation of our remote address. The actual 32 bit address in a sockaddr_in structure is located at +4, and the big endian port number is at +2. Since we don't want our compiler complaining about pointer math we case it to an unsigned char * */ unsigned char *r = (unsigned char *)raddr; void *ht_addrstr = inet_ntoa(*(unsigned *)(r+4)); /* Next up, we need the port number, but since it is in big endian order, we can extract the bytes directly. */ int port = (r[2] << 8) + r[3]; /* Convert that to a string with the HeavyThing string library... of course we could use snprintf, etc but we are mixing it up on purpose here. */ void *ht_portstr = string$from_unsigned(port, 10); /* Now we can construct our char * of the above */ char scratch[32]; int i = string$to_utf8(ht_addrstr, scratch); scratch[i] = ':'; int j = string$to_utf8(ht_portstr, &scratch[i+1]); scratch[i+j+1] = 0; remote_address = std::string(scratch, i+j+1); }
开发者ID:sfinktah,项目名称:HeavyThing,代码行数:32,
示例4: to_utf8FileFilterList::FileFilterList(docstring const & qt_style_filter){ // FIXME UNICODE string const filter = to_utf8(qt_style_filter) + (qt_style_filter.empty() ? string() : ";;") + to_utf8(_("All Files "))#if defined(_WIN32) + ("(*.*)");#else + ("(*)");#endif // Split data such as "TeX documents (*.tex);;LyX Documents (*.lyx)" // into individual filters. static lyx::regex const separator_re(";;"); string::const_iterator it = filter.begin(); string::const_iterator const end = filter.end(); while (true) { match_results<string::const_iterator> what; if (!lyx::regex_search(it, end, what, separator_re)) { parse_filter(string(it, end)); break; } // Everything from the start of the input to // the start of the match. parse_filter(string(what[-1].first, what[-1].second)); // Increment the iterator to the end of the match. it += distance(it, what[0].second); }}
开发者ID:hashinisenaratne,项目名称:HSTML,代码行数:34,
示例5: getCmdNamevoid InsetRef::validate(LaTeXFeatures & features) const{ string const cmd = getCmdName(); if (cmd == "vref" || cmd == "vpageref") features.require("varioref"); else if (cmd == "formatted") { docstring const data = getEscapedLabel(features.runparams()); docstring label; docstring prefix; string const fcmd = to_utf8(getFormattedCmd(data, label, prefix)); if (buffer().params().use_refstyle) { features.require("refstyle"); if (prefix == "cha") features.addPreambleSnippet("//let//charef=//chapref"); else if (!prefix.empty()) { string lcmd = "//AtBeginDocument{//providecommand" + fcmd + "[1]{//ref{" + to_utf8(prefix) + ":#1}}}"; features.addPreambleSnippet(lcmd); } } else { features.require("prettyref"); // prettyref uses "cha" for chapters, so we provide a kind of // translation. if (prefix == "chap") features.addPreambleSnippet("//let//[email C++ to_vc4_dev函数代码示例 C++ to_usb_interface函数代码示例
|