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


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

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


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

示例1: acquireFileVersion

void FileDef::acquireFileVersion()
{
  QCString vercmd = Config_getString("FILE_VERSION_FILTER");
  if (!vercmd.isEmpty() && filepath!="generated") 
  {
    msg("Version of %s : ",filepath.data());
    QCString cmd = vercmd+" \""+filepath+"\"";
    Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",cmd.data());
    FILE *f=portable_popen(cmd,"r");
    if (!f)
    {
      err("error: could not execute %s\n",vercmd.data());
      return;
    }
    const int bufSize=1024;
    char buf[bufSize];
    int numRead = fread(buf,1,bufSize,f);
    portable_pclose(f);
    if (numRead > 0) 
    {
      fileVersion = QCString(buf,numRead).stripWhiteSpace();
      msg("%s\n",fileVersion.data());
    }
    else 
    {
      msg("no version available\n");
    }
  }
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例2: parseKeyData

KeyList
BaseG::parseKeyList(const QCString &output, bool secretKeys)
{
    KeyList keys;
    Key *key = 0;
    int offset;

    // search start of key data
    if(!strncmp(output.data(), "pub:", 4)
            || !strncmp(output.data(), "sec:", 4))
        offset = 0;
    else
    {
        if(secretKeys)
            offset = output.find("\nsec:");
        else
            offset = output.find("\npub:");
        if(offset == -1)
            return keys;
        else
            offset++;
    }

    do
    {
        key = parseKeyData(output, offset);
        if(key != 0)
            keys.append(key);
    }
    while(key != 0);

    //kdDebug(5100) << "finished parsing keys" << endl;

    return keys;
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:35,代码来源:kpgpbaseG.cpp

示例3: run

void NDnsWorker::run()
{
	hostent *h = 0;

#ifdef HAVE_GETHOSTBYNAME_R
	hostent buf;
	char char_buf[1024];
	int err;
	gethostbyname_r(host.data(), &buf, char_buf, sizeof(char_buf), &h, &err);
#else
	// lock for gethostbyname
	QMutexLocker locker(workerMutex);

	// check for cancel
	workerCancelled->lock();
	bool cancel = cancelled;
	workerCancelled->unlock();

	if(!cancel)
		h = gethostbyname(host.data());
#endif

	if(!h) {
		success = false;
		QApplication::postEvent(par, new NDnsWorkerEvent(this));
		return;
	}

	in_addr a = *((struct in_addr *)h->h_addr_list[0]);
	addr.setAddress(ntohl(a.s_addr));
	success = true;

	QApplication::postEvent(par, new NDnsWorkerEvent(this));
}
开发者ID:serghei,项目名称:kde3-kdenetwork,代码行数:34,代码来源:ndns.cpp

示例4: main

int main(int argc, char *argv[])
{
    KApplication::kdeinitExec("konsole");

    KApplication k(argc, argv, "klaunchertest");

    kapp->dcopClient()->registerAs(kapp->name());

#if 0
   QString error;
   QCString dcopService;
   int pid;
   int result = KApplication::startServiceByDesktopName(
		QString::fromLatin1("konsole"), QString::null, &error, &dcopService, &pid );

   printf("Result = %d, error = \"%s\", dcopService = \"%s\", pid = %d\n",
      result, error.ascii(), dcopService.data(), pid);

   result = KApplication::startServiceByDesktopName(
		QString::fromLatin1("konqueror"), QString::null,  &error, &dcopService, &pid );

   printf("Result = %d, error = \"%s\", dcopService = \"%s\", pid = %d\n",
      result, error.ascii(), dcopService.data(), pid);
#endif
}
开发者ID:,项目名称:,代码行数:25,代码来源:

示例5: queryObjects

void queryObjects(const QCString &app, const QCString &filter)
{
    int filterLen = filter.length();
    bool ok = false;
    bool isDefault = false;
    KStringList objs = dcop->remoteObjects(app, &ok);

    for(const auto &objId : objs)
    {
        if(objId == "default")
        {
            isDefault = true;
            continue;
        }

        if(startsWith(objId, filter, filterLen))
        {
            if(isDefault)
                printf("%s (default)\n", objId.data());
            else
                printf("%s\n", objId.data());
        }
        isDefault = false;
    }
    if(!ok)
    {
        if(!dcop->isApplicationRegistered(app))
            qWarning("No such application: '%s'", app.data());
        else
            qWarning("Application '%s' not accessible", app.data());
        exit(1);
    }
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:33,代码来源:dcop.cpp

示例6: updateJournal

void OContactAccessBackend_XML::updateJournal( const OContact& cnt,
					       journal_action action )
{
	QFile f( m_journalName );
	bool created = !f.exists();
	if ( !f.open(IO_WriteOnly|IO_Append) )
		return;

	QString buf;
	QCString str;

	// if the file was created, we have to set the Tag "<CONTACTS>" to
	// get a XML-File which is readable by our parser.
	// This is just a cheat, but better than rewrite the parser.
	if ( created ){
		buf = "<Contacts>";
		QCString cstr = buf.utf8();
		f.writeBlock( cstr.data(), cstr.length() );
	}

	buf = "<Contact ";
	cnt.save( buf );
	buf += " action=\"" + QString::number( (int)action ) + "\" ";
	buf += "/>\n";
	QCString cstr = buf.utf8();
	f.writeBlock( cstr.data(), cstr.length() );
}
开发者ID:opieproject,项目名称:opie,代码行数:27,代码来源:ocontactaccessbackend_xml.cpp

示例7: dcopNetworkId

QCString dcopNetworkId()
{
    QCString result;
    result.resize(1025);
    QFile file(DCOPClient::dcopServerFile());
    if (!file.open(IO_ReadOnly))
        return "";
    int i = file.readLine(result.data(), 1024);
    if (i <= 0)
        return "";
    result.data()[i-1] = '\0'; // strip newline
    return result;
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例8: save

bool ODateBookAccessBackend_XML::save() {
    if (!m_changed) return true;

    int total_written;
    QString strFileNew = m_name + ".new";

    QFile f( strFileNew );
    if (!f.open( IO_WriteOnly | IO_Raw ) ) return false;

    QString buf( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" );
    buf += "<!DOCTYPE DATEBOOK><DATEBOOK>\n";
    buf += "<events>\n";
    QCString str = buf.utf8();
    total_written = f.writeBlock( str.data(), str.length() );
    if ( total_written != int(str.length() ) ) {
        f.close();
        QFile::remove( strFileNew );
        return false;
    }

    if (!forAll( m_raw, f ) ) {
        f.close();
        QFile::remove( strFileNew );
        return false;
    }
    if (!forAll( m_rep, f ) ) {
        f.close();
        QFile::remove( strFileNew );
        return false;
    }

    buf = "</events>\n</DATEBOOK>\n";
    str = buf.utf8();
    total_written = f.writeBlock( str.data(), str.length() );
    if ( total_written != int(str.length() ) ) {
        f.close();
        QFile::remove( strFileNew );
        return false;
    }
    f.close();

    if ( ::rename( strFileNew, m_name ) < 0 ) {
        QFile::remove( strFileNew );
        return false;
    }

    m_changed = false;
    return true;
}
开发者ID:opieproject,项目名称:opie,代码行数:49,代码来源:odatebookaccessbackend_xml.cpp

示例9: localSessions

bool DM::localSessions(SessList &list)
{
    if(DMType == OldKDM)
        return false;

    QCString re;

    if(DMType == GDM)
    {
        if(!exec("CONSOLE_SERVERS\n", re))
            return false;
        QStringList sess = QStringList::split(QChar(';'), re.data() + 3);
        for(QStringList::ConstIterator it = sess.begin(); it != sess.end(); ++it)
        {
            QStringList ts = QStringList::split(QChar(','), *it, true);
            SessEnt se;
            se.display = ts[0];
            se.user = ts[1];
            se.vt = ts[2].toInt();
            se.session = "<unknown>";
            se.self = ts[0] == ::getenv("DISPLAY"); /* Bleh */
            se.tty = false;
            list.append(se);
        }
    }
    else
    {
        if(!exec("list\talllocal\n", re))
            return false;
        QStringList sess = QStringList::split(QChar('\t'), re.data() + 3);
        for(QStringList::ConstIterator it = sess.begin(); it != sess.end(); ++it)
        {
            QStringList ts = QStringList::split(QChar(','), *it, true);
            SessEnt se;
            se.display = ts[0];
            if(ts[1][0] == '@')
                se.from = ts[1].mid(1), se.vt = 0;
            else
                se.vt = ts[1].mid(2).toInt();
            se.user = ts[2];
            se.session = ts[3];
            se.self = (ts[4].find('*') >= 0);
            se.tty = (ts[4].find('t') >= 0);
            list.append(se);
        }
    }
    return true;
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:48,代码来源:dmctl.cpp

示例10: format_warn

static void format_warn(const char *file,int line,const char *text)
{
  QCString fileSubst = file==0 ? "<unknown>" : file;
  QCString lineSubst; lineSubst.setNum(line);
  QCString textSubst = text;
  QCString versionSubst;
  if (file) // get version from file name
  {
    bool ambig;
    FileDef *fd=findFileDef(Doxygen::inputNameDict,file,ambig);
    if (fd)
    {
      versionSubst = fd->getVersion();
    }
  }
  // substitute markers by actual values
  QCString msgText = 
      substitute(
        substitute(
          substitute(
            substitute( 
              outputFormat,
              "$file",fileSubst
            ),
            "$text",textSubst
          ),
          "$line",lineSubst
        ),
        "$version",versionSubst
      )+'\n';

  // print resulting message
  fwrite(msgText.data(),1,msgText.length(),warnFile);
}
开发者ID:AmesianX,项目名称:doxygen,代码行数:34,代码来源:message.cpp

示例11: qDBusObjectPathKeyMapToIterator

static void qDBusObjectPathKeyMapToIterator(DBusMessageIter* it,
                                            const QDBusData& var)
{
    DBusMessageIter sub;
    QCString sig;

    QDBusDataMap<QDBusObjectPath> map = var.toObjectPathKeyMap();

    sig += DBUS_DICT_ENTRY_BEGIN_CHAR;
    sig += qDBusTypeForQDBusType(map.keyType());

    if (map.hasContainerValueType())
        sig += map.containerValueType().buildDBusSignature();
    else
        sig += qDBusTypeForQDBusType(map.valueType());
    sig += DBUS_DICT_ENTRY_END_CHAR;

    dbus_message_iter_open_container(it, DBUS_TYPE_ARRAY, sig.data(), &sub);

    QDBusDataMap<QDBusObjectPath>::ConstIterator mit = map.begin();
    for (; mit != map.end(); ++mit)
    {
        DBusMessageIter itemIterator;
        dbus_message_iter_open_container(&sub, DBUS_TYPE_DICT_ENTRY,
                                         0, &itemIterator);

        qAppendToMessage(&itemIterator, mit.key());
        qDBusDataToIterator(&itemIterator, mit.data());

        dbus_message_iter_close_container(&sub, &itemIterator);
    }

    dbus_message_iter_close_container(it, &sub);
}
开发者ID:opieproject,项目名称:opie,代码行数:34,代码来源:qdbusmarshall.cpp

示例12: while

void
send(QSocketDevice& socket, const QString& type, const QStringList& args,
     bool debug)
{
    TclObject list;
    list.lappend(type);
    for (unsigned int i = 0; i < args.size(); ++i)
	list.lappend(args[i]);

    if (debug) logDebug("send: " + list.toString());

    QString message = list.toString();
    if (message.contains('\n'))
	message = "\002" + message + "\003";
    else
	message += "\n";

    QCString data = message.utf8();
    int len = data.length();
    int pos = 0;
    while (pos < len) {
	int count = socket.writeBlock(data.data() + pos, len - pos);
	socket.flush();

	if (count == -1) {
	    logError("writeBlock error: %d", errno);
	    exit(4);
	}

	pos += count;
    }
}
开发者ID:cwarden,项目名称:quasar,代码行数:32,代码来源:quasar_clientd.cpp

示例13: respond

void ConnectionHandler::respond(int ok, QCString s)
{
    QCString buf;

    switch(ok)
    {
        case Res_OK:
            buf = "OK";
            break;
        case Res_NO:
        default:
            buf = "NO";
            break;
    }

    if(!s.isEmpty())
    {
        buf += ' ';
        buf += s;
    }

    buf += '\n';

    send(m_Fd, buf.data(), buf.length(), 0);
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:25,代码来源:handler.cpp

示例14: dcopForward

QCString SshProcess::dcopForward()
{
    QCString result;

    setDcopTransport("tcp");

    QCString srv = StubProcess::dcopServer();
    if(srv.isEmpty())
        return result;

    int i = srv.find('/');
    if(i == -1)
        return result;
    if(srv.left(i) != "tcp")
        return result;
    int j = srv.find(':', ++i);
    if(j == -1)
        return result;
    QCString host = srv.mid(i, j - i);
    bool ok;
    int port = srv.mid(++j).toInt(&ok);
    if(!ok)
        return result;

    m_dcopPort = 10000 + (int)((40000.0 * rand()) / (1.0 + RAND_MAX));
    result.sprintf("%d:%s:%d", m_dcopPort, host.data(), port);
    return result;
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例15: sendInternal

bool DCOPRef::sendInternal(const QCString &fun, const QCString &args, const QByteArray &data)
{
    if(isNull())
    {
        qWarning("DCOPRef: send '%s' on null reference error", STR(fun));
        return false;
    }
    Q_UNUSED(data);
    QCString sig = fun;
    if(fun.find('(') == -1)
    {
        sig += args;
        if(args.find("<unknown") != -1)
            qWarning(
                "DCOPRef: unknown type error "
                "<\"%s\",\"%s\">::send(\"%s\",%s",
                STR(m_app), STR(m_obj), STR(fun), args.data() + 1);
    }
    DCOPClient *dc = dcopClient();
    if(!dc || !dc->isAttached())
    {
        qWarning("DCOPRef::send(): no DCOP client or client not attached error");
        return false;
    }
    return dc->send(m_app, m_obj, sig, data);
}
开发者ID:serghei,项目名称:kde3-kdelibs,代码行数:26,代码来源:dcopref.cpp


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