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


C++ QByteArray::end方法代码示例

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


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

示例1: ResrouceRim

/*
void ResrouceRim(const char* filename, PDP8::CpuState& cpu) {
   std::vector<char> data = GetResource(filename);
    PDP8::LoadRim(data,cpu);
}
void ResrouceBin(const char* filename, PDP8::CpuState& cpu) {
   std::vector<char> data = GetResource(filename);
    PDP8::LoadBin(data,cpu);
}
*/
std::vector<char>  MainWindow::getResource(const char* filename) {

	QFile s(filename);
	if (s.open(QFile::ReadOnly)) {
		QByteArray bytes = s.readAll();
		std::vector<char> data(bytes.begin(), bytes.end());
		return data;
	}
	throw std::runtime_error("FUCK YOU");
}
开发者ID:WarlockD,项目名称:QtPDP8,代码行数:20,代码来源:mainwindow.cpp

示例2: string

string const to_local8bit(docstring const & s)
{
	// This conversion can fail, depending on input.
	if (s.empty())
		return string();
	QByteArray const local = toqstr(s).toLocal8Bit();
	if (local.isEmpty())
		throw to_local8bit_failure();
	return string(local.begin(), local.end());
}
开发者ID:djmitche,项目名称:lyx,代码行数:10,代码来源:docstring.cpp

示例3: onPasswordEdited

void VersionEditor::onPasswordEdited(QString pass){
	QByteArray tmp = pass.toUtf8();
	ui->password = Kdbx::XorredBuffer::fromRaw(SafeVector<uint8_t>(tmp.begin(), tmp.end()), safeGetRandomBytes(tmp.size(), this));

	if (ui->showPasswordButton->isChecked()){
		ui->passwordLabel->setText(pass);
	}else{
		ui->passwordLabel->setText(QString(pass.size(), QChar('*')));
	}
}
开发者ID:j-kubik,项目名称:qtpass2,代码行数:10,代码来源:versioneditor.cpp

示例4: getb

void bgPNG::getb(const QByteArray &b)
{
  qDebug("[bgPNG getb: %d, %08x]", num, (uint)th->currentThreadId());
  stat = 1;
  vector<uchar> v(b.size()); // filled by '\0' x n
  for(QByteArray::ConstIterator it = b.begin(); it != b.end(); it++)
    v.push_back(*it);
  for(vector<uchar>::iterator it = v.begin(); it != v.end(); it++)
    cout << setw(2) << setfill('0') << hex << right << (uint)*it << ", ";
  cout << endl;
}
开发者ID:HatsuneMiku,项目名称:bgPNG,代码行数:11,代码来源:bgPNG.cpp

示例5: run

void ReceiveThread::run()
{
    QByteArray dataArray;
    while(true)
    {
        serialPort->waitForReadyRead(-1);
        dataArray = serialPort->readAll();
        for(QByteArray::Iterator iter = dataArray.begin(); iter != dataArray.end(); iter++)
        {
            emit receivedDataByte(*iter);
        }
    }
}
开发者ID:ZHAO-Mingqi,项目名称:ComPortToolPlus,代码行数:13,代码来源:receivethread.cpp

示例6: addTorrent

void SeedManager::addTorrent(QString torrent) {
    QSettings s(settingsPath + torrent, QSettings::IniFormat);
    QByteArray data = s.value("data").toByteArray();
    libtorrent::entry e = libtorrent::bdecode(data.begin(), data.end());
    libtorrent::torrent_info *inf = new libtorrent::torrent_info(e);
    const libtorrent::torrent_handle h =
            session->add_torrent(inf, s.value("path").toString().toStdString(), e);

    h.set_upload_mode(true);
    h.auto_managed(false);
    if (h.is_paused())
        h.resume();

    torrentNames[h.name()] = torrent;
}
开发者ID:andrew-markin,项目名称:QLiveBittorrent,代码行数:15,代码来源:seedmanager.cpp

示例7: invokePath

bool TestNode::invokePath (const QString &path, const QStringList &, int, HttpClient *client) {
	if (path == "/get") {
		client->write ("Works.");
	} else if (path == "/post") {
		auto func = [](HttpClient *client) {
			QByteArray data = client->readAll ();
			std::reverse (data.begin (), data.end ());
			client->write (data);
		};
		
		client->setSlotInfo (SlotInfo (Callback::fromLambda (func)));
	}
	
	// 
	return true;
}
开发者ID:NuriaProject,项目名称:Network,代码行数:16,代码来源:tst_httptcptransport.cpp

示例8: decode_kio_internal

void decode_kio_internal(Decoder *dec, QByteArray::ConstIterator &iit,
                         QByteArray::ConstIterator &iend,
                         QByteArray &out)
{
    out.resize(outbufsize);
    QByteArray::Iterator oit = out.begin();
    QByteArray::ConstIterator oend = out.end();

    while(!dec->decode(iit, iend, oit, oend))
        if(oit == oend) return;

    while(!dec->finish(oit, oend))
        if(oit == oend) return;

    out.truncate(oit - out.begin());
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:16,代码来源:test_kmime_codec.cpp

示例9: while

static void inplace_crlf2lf(QByteArray &in)
{
    if (in.isEmpty()) {
        return;
    }
    QByteArray &out = in;  // inplace
    const char *s = in.begin();
    const char *const end = in.end();
    char *d = out.begin();
    char last = '\0';
    while (s < end) {
        if (*s == '\n' && last == '\r') {
            --d;
        }
        *d++ = last = *s++;
    }
    out.resize(d - out.begin());
}
开发者ID:quazgar,项目名称:kdepimlibs,代码行数:18,代码来源:sieve.cpp

示例10: encode_decode_kio

void encode_decode_kio(bool encode, const Codec *codec,
                       const QByteArray &infile_buffer, QFile &outfile)
{

    Encoder *enc = 0;
    Decoder *dec = 0;

    // Get an encoder. This one you have to delete!
    if(encode)
    {
        enc = codec->makeEncoder(withCRLF);
        assert(enc);
    }
    else
    {
        dec = codec->makeDecoder(withCRLF);
        assert(dec);
    }

    QByteArray::ConstIterator iit = infile_buffer.begin();
    QByteArray::ConstIterator iend = infile_buffer.end();

    QByteArray out;
    do
    {
        out = QByteArray();
        if(encode)
            encode_kio_internal(enc, iit, iend, out);
        else
            decode_kio_internal(dec, iit, iend, out);
        if(writing && out.size())
        {
            Q_LONG written = outfile.writeBlock(out);
            assert(written == (Q_LONG)out.size());
        }
    }
    while(out.size());

    if(encode)
        delete enc;
    else
        delete dec;
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:43,代码来源:test_kmime_codec.cpp

示例11: transcode

QString BaseTranscode::transcode(const QString  &  inalphOrig,  const QString  &  outalph, QByteArray input, bool caseSensitive){
	QString inalph=caseSensitive?inalphOrig:inalphOrig.toLower();

	const unsigned int inbase=inalph.size();
	const unsigned int outbase=outalph.size();
	QString ret;
	InfInt acc=0;
	InfInt base=1;
	for(QByteArray::iterator it=input.begin(),end=input.end();it!=end;++it){
		unsigned char num=*it;
		acc+=base*num;
		base*=inbase;
	}
	while (acc > 0) {
		unsigned int remainder = (acc % outbase).toInt();
		acc /= outbase;
		ret=QString(outalph.at(remainder)) % ret;
	}
	return ret;
}
开发者ID:mrdeveloperdude,项目名称:OctoMY,代码行数:20,代码来源:BaseTranscode.cpp

示例12: QByteArray

QByteArray KMail::Util::lf2crlf(const QByteArray &src)
{
    const char *s = src.data();
    if(!s)
        return QByteArray();

    QByteArray result(2 * src.size());    // maximal possible length
    QByteArray::Iterator d = result.begin();
    // we use cPrev to make sure we insert '\r' only there where it is missing
    char cPrev = '?';
    const char *end = src.end();
    while(s != end)
    {
        if(('\n' == *s) && ('\r' != cPrev))
            *d++ = '\r';
        cPrev = *s;
        *d++ = *s++;
    }
    result.truncate(d - result.begin());   // does not add trailing NUL, as expected
    return result;
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:21,代码来源:util.cpp

示例13: parse

void ParamsParser::parse(wexus::HTTPRequest *req, QVariantMap &out)
{
  assert(req);

  if (!req->query().isEmpty())
    decodeAndParse(req->query().begin(), req->query().end(), out);

  // parse the post data
  if (req->contentLength() > 0) {
    // read the content length into a string and then process that
    // TODO optimizes this in the future to iterate over the Device
    // santify check this resize operation???
    QByteArray ary = req->input()->read(req->contentLength());

    decodeAndParse(ary.begin(), ary.end(), out);
  }

  /*IODeviceIterator ii(req->input());
  IODeviceIterator endii;

  decodeAndParse(ii, endii);*/
}
开发者ID:ademko,项目名称:wexus2,代码行数:22,代码来源:ParamsParser.cpp

示例14: Announce

Discovery::Announce Discovery::Announce::fromBinary(const QByteArray &data) {
	Announce rc;

	if (data.startsWith(QByteArray("BSYNC\0", 6))) {
		libtorrent::entry e = libtorrent::bdecode(data.begin()+6, data.end());
		libtorrent::entry::dictionary_type dict = e.dict();

		MessageType m = (MessageType) dict.at("m").integer();
		std::string peerId = dict.at("peer").string();
		std::string shareHash = dict.at("share").string();
		PeerAddress localAddress, externalAddress;
		if (dict.count("la")) {
			localAddress = PeerAddress::fromBinary(dict.at("la").string());
		}
		if (dict.count("a")) {
			externalAddress = PeerAddress::fromBinary(dict.at("a").string());
		}


		rc = Announce(Secret::fromShareHash(shareHash), Peer(QByteArray(peerId.data(), peerId.length()), localAddress, externalAddress));
	}

	return rc;
}
开发者ID:lokjaiswal12,项目名称:workingDraft,代码行数:24,代码来源:Discovery.cpp

示例15: unescaped

QString unescaped(const QByteArray& str)
{
  QString ret;
  int cnt = 0;
  for(auto i = str.begin(); i < str.end(); ++i)
  {
    if(cnt++ != 0)
    {
    }
    if(*i == '\\')
    {
      char nxt = *++i;
      if(nxt == 'n')
        ret += '\n';
      else if(nxt == 't')
        ret += '\t';
      else if(nxt == 'f')
        ret += '\f';
      else if(nxt == 'v')
        ret += '\v';
      else if(nxt == 'r')
        ret += '\r';
      else if(nxt == '0')
        ret += '\0';
      else if(nxt == 'b')
        ret += '\b';
      else if(nxt == 'a')
        ret += '\a';
      else if(nxt == 'x' || nxt == 'X' || nxt == 'u' || nxt == 'U')
      {
        quint32 x = 0;
        for(++i; ; ++i)
        {
          x *= 16;
          if(i == str.end())
            break;
          else if(*i >= 'a' && *i <= 'f')
            x += (*i - 'a' + 10);
          else if(*i >= 'A' && *i <= 'F')
            x += (*i - 'A' + 10);
          else if(*i >= '0' && *i <= '9')
            x += (*i - '0');
          else
            break;
        }
        --i;
        x /= 16;
        ret += QString::fromUcs4(&x, 1);
      }
      else if(nxt == 'd' || nxt == 'D')
      {
        quint32 x = 0;
        for(++i; ; ++i)
        {
          x *= 10;
          if(i == str.end())
            break;
          else if(*i >= '0' && *i <= '9')
            x += (*i - '0');
          else
            break;
        }
        --i;
        x /= 10;
        ret += QString::fromUcs4(&x, 1);
      }
      else if(nxt == 'o' || nxt == 'O')
      {
        quint32 x = 0;
        for(++i; ; ++i)
        {
          x *= 8;
          if(i == str.end())
            break;
          else if(*i >= '0' && *i <= '7')
            x += (*i - '0');
          else
            break;
        }
        --i;
        x /= 8;
        ret += QString::fromUcs4(&x, 1);
      }
      else if(nxt == 'y' || nxt == 'Y')
      {
        quint32 x = 0;
        for(++i; ; ++i)
        {
          x *= 2;
          if(i == str.end())
            break;
          else if(*i >= '0' && *i <= '1')
            x += (*i - '0');
          else
            break;
        }
        --i;
        x /= 2;
        ret += QString::fromUcs4(&x, 1);
      }
//.........这里部分代码省略.........
开发者ID:KDE,项目名称:kdevelop-pg-qt,代码行数:101,代码来源:kdev-pg.cpp


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