您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ utf8函数代码示例

51自学网 2021-06-03 09:23:58
  C++
这篇教程C++ utf8函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中utf8函数的典型用法代码示例。如果您正苦于以下问题:C++ utf8函数的具体用法?C++ utf8怎么用?C++ utf8使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

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

示例1: rconsole2utf8

std::string rconsole2utf8(const std::string& encoded){   boost::regex utf8("/x02/xFF/xFE(.*?)(/x03/xFF/xFE|//')");   std::string output;   std::string::const_iterator pos = encoded.begin();   boost::smatch m;   while (pos != encoded.end() && boost::regex_search(pos, encoded.end(), m, utf8))   {      if (pos < m[0].first)         output.append(string_utils::systemToUtf8(std::string(pos, m[0].first)));      output.append(m[1].first, m[1].second);      pos = m[0].second;   }   if (pos != encoded.end())      output.append(string_utils::systemToUtf8(std::string(pos, encoded.end())));   return output;}
开发者ID:Swissbanker,项目名称:rstudio,代码行数:19,


示例2: getStringIdentifier

// Helper function to create an NPN String Identifier from a v8 string.NPIdentifier getStringIdentifier(v8::Handle<v8::String> str){    const int kStackBufferSize = 100;    int bufferLength = str->Utf8Length() + 1;    if (bufferLength <= kStackBufferSize) {        // Use local stack buffer to avoid heap allocations for small strings. Here we should only use the stack space for        // stackBuffer when it's used, not when we use the heap.        //        // WriteUtf8 is guaranteed to generate a null-terminated string because bufferLength is constructed to be one greater        // than the string length.        char stackBuffer[kStackBufferSize];        str->WriteUtf8(stackBuffer, bufferLength);        return _NPN_GetStringIdentifier(stackBuffer);    }    v8::String::Utf8Value utf8(str);    return _NPN_GetStringIdentifier(*utf8);}
开发者ID:Igalia,项目名称:blink,代码行数:20,


示例3: QTreeWidgetItem

void CheatEditorWindow::reloadList() {  list->clear();  list->setSortingEnabled(false);  if(SNES::cartridge.loaded()) {    for(unsigned n = 0; n < SNES::cheat.count(); n++) {      QTreeWidgetItem *item = new QTreeWidgetItem(list);      item->setData(0, Qt::UserRole, QVariant(n));      char slot[16];      sprintf(slot, "%3u", n + 1);      item->setText(0, utf8() << slot);      updateItem(item);    }  }  list->setSortingEnabled(true);  list->header()->setSortIndicatorShown(false);  syncUi();}
开发者ID:ben401,项目名称:OpenEmu,代码行数:19,


示例4: close

void session::open(string_t const& file_name, int flags){	// close previous session	close();	if ( !flags )	{		flags = SQLITE_OPEN_CREATE | SQLITE_OPEN_READWRITE;	}	int const r = sqlite3_open_v2(utf8(file_name).c_str(), &impl_, flags, 0);	if ( r != SQLITE_OK )	{		string_t const msg( last_error_msg(impl_) );		int const err = ::sqlite3_errcode(impl_);		close(); // session should be closed anyway		throw exception(err, msg);	}}
开发者ID:corefan,项目名称:my-crawler-engine,代码行数:19,


示例5: for_each

  for_each(VisualPhysicsActor* actor, actors) {    if (QFileInfo(actor->path()).exists()) {      use_ae_desc_list = true;      AliasHandle file_alias;      Boolean is_directory = false;      err = FSNewAliasFromPath(NULL, utf8(actor->path()).c_str(), 0,  &file_alias, &is_directory);      HLock((Handle) file_alias);      AECreateDesc(typeAlias, (Ptr) (*file_alias),                   GetHandleSize((Handle) file_alias), &file_list_element);      HUnlock((Handle) file_alias);      AEPutDesc(&file_list, 0, &file_list_element);    }  }
开发者ID:DX94,项目名称:BumpTop,代码行数:19,


示例6: show_HUD_

PerformanceStatsHUD::PerformanceStatsHUD(): show_HUD_(false) {  if (!HUD_resources_are_loaded_) {    QString resource_path = FileManager::getResourcePath();    Ogre::ResourceGroupManager::getSingleton().addResourceLocation(utf8(resource_path + "/OgreCore.zip"),                                                                   "Zip", "Bootstrap");    Ogre::ResourceGroupManager::getSingleton().initialiseResourceGroup("Bootstrap");    HUD_resources_are_loaded_ = true;  }  debug_overlay_ = Ogre::OverlayManager::getSingleton().getByName("Core/DebugOverlay");  avg_FPS_ = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/AverageFps");  curr_FPS_ = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/CurrFps");  best_FPS_ = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/BestFps");  worst_FPS_ = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/WorstFps");  memory_use_in_bytes = Ogre::OverlayManager::getSingleton().getOverlayElement("Core/NumTris");  assert(QObject::connect(BumpTopApp::singleton(), SIGNAL(onRender()),  // NOLINT                          this, SLOT(renderTick())));  // NOLINT}
开发者ID:DX94,项目名称:BumpTop,代码行数:20,


示例7: io

void freqtable::load(const QString& file){    QFile io(file);    if (!io.open(QIODevice::ReadOnly))        throw std::runtime_error(utf8("open frequence table failed: _1", file));    QTextStream stream(&io);    stream.setCodec("UTF-8");    while (!stream.atEnd())    {        const auto& line  = stream.readLine();        const auto& words = line.split("/t");        if (words.size() != 2)            throw std::runtime_error("unexpected frequency table data");        const auto& word = words[0];        const auto& freq = words[1].toLongLong();        table_[word] = freq;    }}
开发者ID:ensisoft,项目名称:pinyin-translator,代码行数:20,


示例8: if

//updates system state text at bottom-right of main window statusbarvoid Utility::updateSystemState() {  string text;  if(cartridge.loaded() == false) {    text = "No cartridge loaded";  } else if(application.power == false) {    text = "Power off";  } else if(application.pause == true || application.autopause == true) {    text = "Paused";  } else if(ppu.status.frames_updated == true) {    ppu.status.frames_updated = false;    text << (int)ppu.status.frames_executed;    text << " fps";  } else {    //nothing to update    return;  }  winMain->systemState->setText(utf8() << text);}
开发者ID:Godzil,项目名称:quickdev16,代码行数:21,


示例9: utf8

void PopupButton::draw(NVGcontext* ctx) {    if (!mEnabled && mPushed)        mPushed = false;    mPopup->setVisible(mPushed);    Button::draw(ctx);    auto icon = utf8(ENTYPO_ICON_CHEVRON_SMALL_RIGHT);    NVGcolor textColor = mTextColor.w() == 0 ? mTheme->mTextColor : mTextColor;    nvgFontSize(ctx, mTheme->mButtonFontSize * 1.5f);    nvgFontFace(ctx, "icons");    nvgFillColor(ctx, mEnabled ? textColor : mTheme->mDisabledTextColor);    nvgTextAlign(ctx, NVG_ALIGN_LEFT | NVG_ALIGN_MIDDLE);    float iw = nvgTextBounds(ctx, 0, 0, icon.data(), nullptr, nullptr);    Vector2f iconPos(        mPos.x() + mSize.x() - iw - 8, mPos.y() + mSize.y() * 0.5f -1);    nvgText(ctx, iconPos.x(), iconPos.y(), icon.data(), nullptr);}
开发者ID:RobertoMalatesta,项目名称:nanogui,代码行数:20,


示例10: PrefChanged

void PrefChanged(const char* aPref, void* aClosure){  if (strcmp(aPref, PREF_VOLUME_SCALE) == 0) {    nsAdoptingString value = Preferences::GetString(aPref);    StaticMutexAutoLock lock(sMutex);    if (value.IsEmpty()) {      sVolumeScale = 1.0;    } else {      NS_ConvertUTF16toUTF8 utf8(value);      sVolumeScale = std::max<double>(0, PR_strtod(utf8.get(), nullptr));    }  } else if (strcmp(aPref, PREF_CUBEB_LATENCY) == 0) {    // Arbitrary default stream latency of 100ms.  The higher this    // value, the longer stream volume changes will take to become    // audible.    sCubebLatencyPrefSet = Preferences::HasUserValue(aPref);    uint32_t value = Preferences::GetUint(aPref, CUBEB_NORMAL_LATENCY_MS);    StaticMutexAutoLock lock(sMutex);    sCubebLatency = std::min<uint32_t>(std::max<uint32_t>(value, 1), 1000);  }}
开发者ID:L2-D2,项目名称:gecko-dev,代码行数:21,


示例11: directory

//true means filename can be loaded directly//false means it cannot (eg this is a folder and we are attempting to load a ROM)bool DiskBrowser::currentFilename(string &filename) {  bool loadable = false;  QModelIndex item = view->currentIndex();  filename = model->filePath(item).toUtf8().constData();  if(browseMode != Folder) {    if(model->isDir(item) == true) {      QDir directory(utf8() << filename);      directory.setNameFilters(QStringList() << "*.sfc");      QStringList list = directory.entryList(QDir::Files | QDir::NoDotAndDotDot);      if(list.count() == 1) {        filename << "/" << list[0].toUtf8().constData();        loadable = true;      }    } else {      loadable = true;    }  }  return loadable;}
开发者ID:ben401,项目名称:OpenEmu,代码行数:23,


示例12: PrefChanged

static int PrefChanged(const char* aPref, void* aClosure){  if (strcmp(aPref, PREF_VOLUME_SCALE) == 0) {    nsAdoptingString value = Preferences::GetString(aPref);    MutexAutoLock lock(*gAudioPrefsLock);    if (value.IsEmpty()) {      gVolumeScale = 1.0;    } else {      NS_ConvertUTF16toUTF8 utf8(value);      gVolumeScale = std::max<double>(0, PR_strtod(utf8.get(), nullptr));    }  } else if (strcmp(aPref, PREF_CUBEB_LATENCY) == 0) {    // Arbitrary default stream latency of 100ms.  The higher this    // value, the longer stream volume changes will take to become    // audible.    uint32_t value = Preferences::GetUint(aPref, 100);    MutexAutoLock lock(*gAudioPrefsLock);    gCubebLatency = std::min<uint32_t>(std::max<uint32_t>(value, 20), 1000);  }  return 0;}
开发者ID:TelefonicaPushServer,项目名称:mozilla-central,代码行数:21,


示例13: utf8

void PopupButton::draw (NVGcontext * ctx){   if (!mEnabled && mPushed)      mPushed = false;   mPopup->setVisible (mPushed);   Button::draw (ctx);   if (mChevronIcon)   {      auto icon = utf8 (mChevronIcon);      NVGcolor textColor =         mTextColor.a == 0 ? mTheme->mTextColor : mTextColor;      nvgFontSize (ctx, (mFontSize < 0 ? mTheme->mButtonFontSize : mFontSize) * 1.5f);      nvgFontFace (ctx, "icons");      nvgFillColor (ctx, mEnabled ? textColor : mTheme->mDisabledTextColor);      nvgTextAlign (ctx, NVG_ALIGN_LEFT | NVG_ALIGN_MIDDLE);      float iw = nvgTextBounds (ctx, 0, 0, icon.data(), nullptr, nullptr);      vec2 iconPos (mPos.x + mSize.x - iw - 8,                        mPos.y + mSize.y * 0.5f - 1);      nvgText (ctx, iconPos.x, iconPos.y, icon.data(), nullptr);   }}
开发者ID:DanGroom,项目名称:NanoguiBlock,代码行数:21,


示例14: RunApp

static QString RunApp(const QString &execPath, const QString &execParam, const QString &execPipeIn="") {    QString outPipePath = Xapi::TmpFilePath("pipeOut");    QProcess app;    app.setStandardInputFile(execPipeIn);    app.setStandardOutputFile(outPipePath);    app.setStandardErrorFile(outPipePath);    app.start(execPath + " " + execParam);    app.waitForFinished();    if (QProcess::NormalExit != app.exitStatus())        qDebug()<<app.error()<<app.errorString()<<app.state();    QFile locale(outPipePath);    if (!locale.open(QIODevice::ReadOnly)) {        qDebug()<<"Open output pipe Fialed!"<<outPipePath;        return "";    }    QTextStream localets(&locale);    QString outUtf8PipePath = Xapi::TmpFilePath("utf8pipeOut");    QFile utf8(outUtf8PipePath);    if (!utf8.open(QIODevice::WriteOnly)) {        qDebug()<<"Open utf8 output pipe Fialed!"<<outUtf8PipePath;        return "";    }    QTextStream utf8ts(&utf8);    utf8ts.setCodec("utf8");    utf8ts<<localets.readAll();    locale.close();    utf8.close();    utf8.open(QIODevice::ReadOnly);    QString ret = QString(utf8.readAll());    utf8.close();    locale.remove();    utf8.remove();    return ret;}
开发者ID:Abuchidefan,项目名称:deepin-windows-installer,代码行数:40,


示例15: sprintf

void HexEditor::update() {    string output;    char temp[256];    unsigned offset = hexOffset;    for(unsigned y = 0; y < 16; y++) {        if(offset >= hexSize) break;        sprintf(temp, "%.6x", offset & 0xffffff);        output << "<font color='#606060'>" << temp << "</font>&nbsp;&nbsp;";        for(unsigned x = 0; x < 16; x++) {            if(offset >= hexSize) break;            sprintf(temp, "%.2x", reader(offset++));            output << "<font color='" << ((x & 1) ? "#000080" : "#0000ff") << "'>" << temp << "</font>";            if(x != 15) output << "&nbsp;";        }        if(y != 15) output << "<br>";    }    setHtml(utf8() << output);}
开发者ID:nicoya,项目名称:OpenEmu,代码行数:22,


示例16: main

int main() {	int retval;	test_batch_runner *runner = test_batch_runner_new();	constructor(runner);	accessors(runner);	node_check(runner);	iterator(runner);	iterator_delete(runner);	create_tree(runner);	hierarchy(runner);	parser(runner);	render_html(runner);	utf8(runner);	test_cplusplus(runner);	test_print_summary(runner);	retval =  test_ok(runner) ? 0 : 1;	free(runner);	return retval;}
开发者ID:LuisMDeveloper,项目名称:EventBlankApp,代码行数:22,


示例17: construct

 static void construct(PyObject* obj, boost::python::converter::rvalue_from_python_stage1_data* data) {     if(PyString_Check(obj)) {         const char* value = PyString_AsString(obj);         //MY_CHECK(value,translate("Received null string pointer from Python"));         void* storage = ((boost::python::converter::rvalue_from_python_storage<std::string>*)data)->storage.bytes;         new (storage) std::string(value);         data->convertible = storage;     }     else if(PyUnicode_Check(obj)) {         boost::python::handle<> utf8(boost::python::allow_null(PyUnicode_AsUTF8String(obj)));         //MY_CHECK(utf8,translate("Could not convert Python unicode object to UTF8 string"));         void* storage = ((boost::python::converter::rvalue_from_python_storage<std::string>*)data)->storage.bytes;         const char* utf8v = PyString_AsString(utf8.get());         //MY_CHECK(utf8v,translate("Received null string from utf8 string"));         new (storage) std::string(utf8v);         data->convertible = storage;     }     else {         throw std::logic_error("Unexpected type for string conversion");     } }
开发者ID:GaussCheng,项目名称:openrave,代码行数:22,


示例18: QTreeWidgetItem

//when device combobox item is changed, object list needs to be repopulatedvoid InputSettingsWindow::reloadList() {  list->clear();  list->setSortingEnabled(false);  listItem.reset();  int index = device->currentIndex();  if(index < deviceItem.size()) {    InputGroup &group = *deviceItem[index];    for(unsigned i = 0; i < group.size(); i++) {      QTreeWidgetItem *item = new QTreeWidgetItem(list);      item->setText(0, utf8() << (int)(1000000 + i));      item->setText(1, group[i]->name);      item->setText(2, (const char*)group[i]->id);      listItem.add(item);    }  }  list->setSortingEnabled(true);  list->sortByColumn(0, Qt::AscendingOrder);  //set default sorting on list change, overriding user setting  list->resizeColumnToContents(1);  //shrink name column  syncUi();}
开发者ID:Godzil,项目名称:quickdev16,代码行数:23,


示例19: TEST_F

TEST_F(DictGroupTest, TaiwanPhraseGroupTest) {  const DictGroupPtr dictGroup(new DictGroup(      list<DictPtr>{CreateDictForPhrases(), CreateTaiwanPhraseDict()}));  {    const auto& entry = dictGroup->Dict::MatchPrefix(utf8("鼠标"));    EXPECT_EQ(utf8("鼠
C++ utf8_decode函数代码示例
C++ utf16_to_utf8函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。