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


C++ string::data方法代码示例

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


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

示例1: qstr

inline QString qstr(const std::string& _in) { return QString::fromUtf8(_in.data(), _in.size()); }
开发者ID:Ekaseo,项目名称:rpcs3,代码行数:1,代码来源:cg_disasm_window.cpp

示例2: send

	long Socket::send(const std::string &buf) const
	{
		return send_all(this->socket_handle, buf.data(), buf.length() );
	}
开发者ID:RaySrc,项目名称:httpserver,代码行数:4,代码来源:Socket.cpp

示例3:

void HashFunctions::sha512(const std::string &data, unsigned char out_hash[64])
{
	sha512(data.data(), data.length(), out_hash);
}
开发者ID:Cassie90,项目名称:ClanLib,代码行数:4,代码来源:hash_functions.cpp

示例4: bind

int SqliteStatement::bind (int position, const std::string& value)
{
    return sqlite3_bind_text (statement, position, value.data (), value.size (), SQLITE_TRANSIENT);
}
开发者ID:Aiolossong,项目名称:rippled,代码行数:4,代码来源:SqliteDatabase.cpp

示例5: sendString

unsigned NetClient::sendString(const std::string &s) throw(const SocketException &)
{
  return sendData(s.data(), s.length());
}
开发者ID:AndrewHires,项目名称:Solo,代码行数:4,代码来源:NetClient.cpp

示例6: add_member

 /**
  * Add a member to the relation.
  *
  * @param type The type (node, way, or relation).
  * @param ref The ID of the member.
  * @param role The role of the member.
  * @param full_member Optional pointer to the member object. If it
  *                    is available a copy will be added to the
  *                    relation.
  * @throws std:length_error If role is longer than osmium::max_osm_string_length
  */
 void add_member(osmium::item_type type, object_id_type ref, const std::string& role, const osmium::OSMObject* full_member = nullptr) {
     add_member(type, ref, role.data(), role.size(), full_member);
 }
开发者ID:AFDudley,项目名称:osm2pgsql,代码行数:14,代码来源:osm_object_builder.hpp

示例7: FileWriteStr

static int FileWriteStr(const std::string &str, FILE *fp)
{
    return fwrite(str.data(), 1, str.size(), fp);
}
开发者ID:vertcoin,项目名称:vertcoin,代码行数:4,代码来源:util.cpp

示例8: Get


//.........这里部分代码省略.........
        strHTML.assign(buffer.get(), buffer.length());
        return true;
      }
    }
  }

  std::string strHTML1(strHTML);

  if (scrURL.m_post)
  {
    std::string strOptions = url.GetOptions();
    strOptions = strOptions.substr(1);
    url.SetOptions("");

    if (!http.Post(url.Get(), strOptions, strHTML1))
      return false;
  }
  else
    if (!http.Get(url.Get(), strHTML1))
      return false;

  strHTML = strHTML1;

  std::string mimeType(http.GetMimeType());
  CMime::EFileType ftype = CMime::GetFileTypeFromMime(mimeType);
  if (ftype == CMime::FileTypeUnknown)
    ftype = CMime::GetFileTypeFromContent(strHTML);

  if (ftype == CMime::FileTypeZip || ftype == CMime::FileTypeGZip)
  {
    XFILE::CZipFile file;
    std::string strBuffer;
    int iSize = file.UnpackFromMemory(strBuffer,strHTML,scrURL.m_isgz); // FIXME: use FileTypeGZip instead of scrURL.m_isgz?
    if (iSize > 0)
    {
      strHTML = strBuffer;
      CLog::Log(LOGDEBUG, "%s: Archive \"%s\" was unpacked in memory", __FUNCTION__, scrURL.m_url.c_str());
    }
    else
      CLog::Log(LOGWARNING, "%s: \"%s\" looks like archive, but cannot be unpacked", __FUNCTION__, scrURL.m_url.c_str());
  }

  std::string reportedCharset(http.GetServerReportedCharset());
  if (ftype == CMime::FileTypeHtml)
  {
    std::string realHtmlCharset, converted;
    if (!CCharsetDetection::ConvertHtmlToUtf8(strHTML, converted, reportedCharset, realHtmlCharset))
      CLog::Log(LOGWARNING, "%s: Can't find precise charset for HTML \"%s\", using \"%s\" as fallback", __FUNCTION__, scrURL.m_url.c_str(), realHtmlCharset.c_str());
    else
      CLog::Log(LOGDEBUG, "%s: Using \"%s\" charset for HTML \"%s\"", __FUNCTION__, realHtmlCharset.c_str(), scrURL.m_url.c_str());

    strHTML = converted;
  }
  else if (ftype == CMime::FileTypeXml)
  {
    CXBMCTinyXML xmlDoc;
    xmlDoc.Parse(strHTML, reportedCharset);
    
    std::string realXmlCharset(xmlDoc.GetUsedCharset());
    if (!realXmlCharset.empty())
    {
      CLog::Log(LOGDEBUG, "%s: Using \"%s\" charset for XML \"%s\"", __FUNCTION__, realXmlCharset.c_str(), scrURL.m_url.c_str());
      std::string converted;
      g_charsetConverter.ToUtf8(realXmlCharset, strHTML, converted);
      strHTML = converted;
    }
  }
  else if (ftype == CMime::FileTypePlainText || StringUtils::CompareNoCase(mimeType.substr(0, 5), "text/") == 0)
  {
    std::string realTextCharset, converted;
    CCharsetDetection::ConvertPlainTextToUtf8(strHTML, converted, reportedCharset, realTextCharset);
    strHTML = converted;
    if (reportedCharset != realTextCharset)
      CLog::Log(LOGWARNING, "%s: Using \"%s\" charset for plain text \"%s\" instead of server reported \"%s\" charset", __FUNCTION__, realTextCharset.c_str(), scrURL.m_url.c_str(), reportedCharset.c_str());
    else
      CLog::Log(LOGDEBUG, "%s: Using \"%s\" charset for plain text \"%s\"", __FUNCTION__, realTextCharset.c_str(), scrURL.m_url.c_str());
  }
  else if (!reportedCharset.empty())
  {
    CLog::Log(LOGDEBUG, "%s: Using \"%s\" charset for \"%s\"", __FUNCTION__, reportedCharset.c_str(), scrURL.m_url.c_str());
    if (reportedCharset != "UTF-8")
    {
      std::string converted;
      g_charsetConverter.ToUtf8(reportedCharset, strHTML, converted);
      strHTML = converted;
    }
  }
  else
    CLog::Log(LOGDEBUG, "%s: Using content of \"%s\" as binary or text with \"UTF-8\" charset", __FUNCTION__, scrURL.m_url.c_str());

  if (!scrURL.m_cache.empty())
  {
    std::string strCachePath = URIUtils::AddFileToFolder(g_advancedSettings.m_cachePath,
                              "scrapers", cacheContext, scrURL.m_cache);
    XFILE::CFile file;
    if (!file.OpenForWrite(strCachePath, true) || file.Write(strHTML.data(), strHTML.size()) != static_cast<ssize_t>(strHTML.size()))
      return false;
  }
  return true;
}
开发者ID:Elzevir,项目名称:xbmc,代码行数:101,代码来源:ScraperUrl.cpp

示例9: RealOutput

void CGI::RealOutput(const std::string &what)
{
    RealOutput(what.data(), what.length());
}
开发者ID:leegoex,项目名称:flinter,代码行数:4,代码来源:cgi.cpp

示例10:

 void operator & (const std::string &s)
 {
   size_t size = s.size();
   *this & (size);
   stream.write(s.data(), size);
 }
开发者ID:MohdVara,项目名称:mesos,代码行数:6,代码来源:tuples.hpp

示例11: OutputBody

void CGI::OutputBody(const std::string &body)
{
    OutputBody(body.data(), body.length());
}
开发者ID:leegoex,项目名称:flinter,代码行数:4,代码来源:cgi.cpp

示例12: WriteString

 void WriteString(ignite::impl::binary::BinaryWriterImpl& writer, const std::string & str)
 {
     writer.WriteString(str.data(), static_cast<int32_t>(str.size()));
 }
开发者ID:chandresh-pancholi,项目名称:ignite,代码行数:4,代码来源:utility.cpp

示例13: atoi

Integer::Integer(std::string str) {
	i = atoi(str.data());
}
开发者ID:joaotargino,项目名称:moolajoo-tcg,代码行数:3,代码来源:Integer.cpp

示例14:

INT64 StringUtility::StringToInt64( std::string str )
{
	INT64 i;
	i = _atoi64(str.data());
	return i;
}
开发者ID:mofa005,项目名称:WebWeixin,代码行数:6,代码来源:StringUtility.cpp

示例15: load

void StreamBuffer::load(const std::string &str){
	clear();
	put(str.data(), str.size());
}
开发者ID:lhjay1,项目名称:poseidon,代码行数:4,代码来源:stream_buffer.cpp


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