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


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

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


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

示例1: visitPre

void RTFDocVisitor::visitPre(DocSection *s)
{
  if (m_hide) return;
  DBG_RTF("{\\comment RTFDocVisitor::visitPre(DocSection)}\n");
  if (!m_lastIsPara) m_t << "\\par" << endl;
  m_t << "{\\bkmkstart " << rtfFormatBmkStr(s->file()+"_"+s->anchor()) << "}" << endl;
  m_t << "{\\bkmkend " << rtfFormatBmkStr(s->file()+"_"+s->anchor()) << "}" << endl;
  m_t << "{{" // start section
      << rtf_Style_Reset;
  QCString heading;
  int level = QMIN(s->level()+1,4);
  heading.sprintf("Heading%d",level);
  // set style
  m_t << rtf_Style[heading]->reference << endl;
  // make table of contents entry
  filter(s->title());
  m_t << endl << "\\par" << "}" << endl;
  m_t << "{\\tc\\tcl" << level << " \\v ";
  filter(s->title());
  m_t << "}" << endl;
  m_lastIsPara=TRUE;
}
开发者ID:AmesianX,项目名称:doxygen,代码行数:22,代码来源:rtfdocvisitor.cpp

示例2: main

int main(int argc, char ** argv)
{
  int port_index;
  
  if (argc == 2)
    port_index = 1;
  else if (argc == 3) {
    set_verbose();
    port_index = 2;
  }
  else
    return 0;
  
  if (UmlCom::connect(QCString(argv[port_index]).toUInt())) {
    try {
      UmlCom::trace("<b>IDL generator</b> release 2.15<br>");
      
      UmlCom::targetItem()->generate();
      
      QCString s;
      
      s.sprintf("<hr><font face=helvetica>Generation done : %d warnings, %d errors</font><br>",
		n_warnings(), n_errors());
      UmlCom::trace(s);
      
      UmlCom::message("");
    
      UmlCom::bye(n_errors());
    }
    catch (...) {
    }
  }
  
  UmlCom::close();
  return 0;
}
开发者ID:,项目名称:,代码行数:36,代码来源:

示例3: importIt

void UmlNode::importIt(FileIn & in, Token & token, UmlItem * where)
{
  where = where->container(aNode, token, in);
  
  if (where == 0)
    return;
    
  QCString s = token.valueOf("name");
  
  if (s.isEmpty()) {
    static unsigned n = 0;
    
    s.sprintf("anonymous_node_%u", ++n);
  }
    
  UmlNode * node = create((UmlDeploymentView *) where, s);
  
  if (node == 0)
    in.error("cannot create node '" + s +
	     "' in '" + where->name() + "'");
  
  node->addItem(token.xmiId(), in);
  
  if (token.xmiType() == "uml:Device")
    node->set_Stereotype("device");

  if (! token.closed()) {
    QCString k = token.what();
    const char * kstr = k;
    
    while (in.read(), !token.close(kstr))
      node->UmlItem::import(in, token);
  }

  node->unload(TRUE, FALSE);
}
开发者ID:,项目名称:,代码行数:36,代码来源:

示例4: setPriority

int KDEsuClient::setPriority(int prio)
{
    QCString cmd;
    cmd.sprintf("PRIO %d\n", prio);
    return command(cmd);
}
开发者ID:,项目名称:,代码行数:6,代码来源:

示例5: load

void KDesktopConfig::load( bool useDefaults )
{
  // get number of desktops
  NETRootInfo info( qt_xdisplay(), NET::NumberOfDesktops | NET::DesktopNames );
  int n = info.numberOfDesktops();

  int konq_screen_number = 0;
  if (qt_xdisplay())
     konq_screen_number = DefaultScreen(qt_xdisplay());

  QCString groupname;
  if (konq_screen_number == 0)
     groupname = "Desktops";
  else
     groupname.sprintf("Desktops-screen-%d", konq_screen_number);

  KConfig * kwinconfig = new KConfig("kwinrc");

  kwinconfig->setReadDefaults( useDefaults );

  kwinconfig->setGroup("Desktops");
  for(int i = 1; i <= maxDesktops; i++)
  {
    QString key_name(QString("Name_") + QString::number(i));
    QString name = QString::fromUtf8(info.desktopName(i));
    if (name.isEmpty()) // Get name from configuration if none is set in the WM.
    {
        name = kwinconfig->readEntry(key_name, i18n("Desktop %1").arg(i));
    }
    _nameInput[i-1]->setText(name);

    // Is this entry immutable or not in the range of configured desktops?
    _labelImmutable[i - 1] = kwinconfig->entryIsImmutable(key_name);
    _nameInput[i-1]->setEnabled(i <= n && !_labelImmutable[i - 1]);
  }

  _numInput->setEnabled(!kwinconfig->entryIsImmutable("Number"));

  delete kwinconfig;
  kwinconfig = 0;

  QString configfile;
  if (konq_screen_number == 0)
      configfile = "kdesktoprc";
  else
      configfile.sprintf("kdesktop-screen-%drc", konq_screen_number);

  KConfig *config = new KConfig(configfile, false, false);

  config->setReadDefaults( useDefaults );

  config->setGroup("Mouse Buttons");
  _wheelOption->setChecked(config->readBoolEntry("WheelSwitchesWorkspace",false));

  _wheelOptionImmutable = config->entryIsImmutable("WheelSwitchesWorkspace");

  if (_wheelOptionImmutable || n<2)
     _wheelOption->setEnabled( false );

  delete config;
  config = 0;

  _numInput->setValue(n);
  emit changed( useDefaults );
}
开发者ID:,项目名称:,代码行数:65,代码来源:

示例6: visit

void DocbookDocVisitor::visit(DocVerbatim *s)
{
  if (m_hide) return;
  SrcLangExt langExt = getLanguageFromFileName(m_langExt);
  switch(s->type())
  {
    case DocVerbatim::Code: // fall though
      m_t << "<literallayout><computeroutput>";
      Doxygen::parserManager->getParser(m_langExt)
        ->parseCode(m_ci,s->context(),s->text(),langExt,
            s->isExample(),s->exampleFile());
      m_t << "</computeroutput></literallayout>";
      break;
    case DocVerbatim::Verbatim:
      m_t << "<literallayout>";
      filter(s->text());
      m_t << "</literallayout>";
      break;
    case DocVerbatim::HtmlOnly:    
      break;
    case DocVerbatim::RtfOnly:     
      break;
    case DocVerbatim::ManOnly:     
      break;
    case DocVerbatim::LatexOnly:   
      break;
    case DocVerbatim::XmlOnly:     
      break;
    case DocVerbatim::DocbookOnly: 
      break;
      m_t << s->text();
      break;
    case DocVerbatim::Dot:
      {
        static int dotindex = 1;
        QCString baseName(4096);
        QCString name;
        QCString stext = s->text();
        m_t << "<para>" << endl;
        name.sprintf("%s%d", "dot_inline_dotgraph_", dotindex);
        baseName.sprintf("%s%d",
            (Config_getString(DOCBOOK_OUTPUT)+"/inline_dotgraph_").data(),
            dotindex++
            );
        QFile file(baseName+".dot");
        if (!file.open(IO_WriteOnly))
        {
          err("Could not open file %s.msc for writing\n",baseName.data());
        }
        file.writeBlock( stext, stext.length() );
        file.close();
        writeDotFile(baseName, s);
        m_t << "</para>" << endl;
      }
      break;
    case DocVerbatim::Msc:
      {
        static int mscindex = 1;
        QCString baseName(4096);
        QCString name;
        QCString stext = s->text();
        m_t << "<para>" << endl;
        name.sprintf("%s%d", "msc_inline_mscgraph_", mscindex);
        baseName.sprintf("%s%d",
            (Config_getString(DOCBOOK_OUTPUT)+"/inline_mscgraph_").data(),
            mscindex++
            );
        QFile file(baseName+".msc");
        if (!file.open(IO_WriteOnly))
        {
          err("Could not open file %s.msc for writing\n",baseName.data());
        }
        QCString text = "msc {";
        text+=stext;
        text+="}";
        file.writeBlock( text, text.length() );
        file.close();
        writeMscFile(baseName,s);
        m_t << "</para>" << endl;
      }
      break;
    case DocVerbatim::PlantUML:
      {
        static QCString docbookOutput = Config_getString(DOCBOOK_OUTPUT);
        QCString baseName = writePlantUMLSource(docbookOutput,s->exampleFile(),s->text());
        QCString shortName = baseName;
        int i;
        if ((i=shortName.findRev('/'))!=-1)
        {
          shortName=shortName.right(shortName.length()-i-1);
        }
        m_t << "<para>" << endl;
        writePlantUMLFile(baseName,s);
        m_t << "</para>" << endl;
      }
      break;
  }
}
开发者ID:Beachy13,项目名称:doxygen,代码行数:98,代码来源:docbookvisitor.cpp

示例7: aboutData

extern "C" KDE_EXPORT int kdemain(int argc, char **argv)
{
    {
        QCString multiHead = getenv("KDE_MULTIHEAD");
        if(multiHead.lower() == "true")
        {
            Display *dpy = XOpenDisplay(NULL);
            if(!dpy)
            {
                fprintf(stderr, "%s: FATAL ERROR: couldn't open display %s\n", argv[0], XDisplayName(NULL));
                exit(1);
            }

            int number_of_screens = ScreenCount(dpy);
            kicker_screen_number = DefaultScreen(dpy);
            int pos;
            QCString display_name = XDisplayString(dpy);
            XCloseDisplay(dpy);
            dpy = 0;

            if((pos = display_name.findRev('.')) != -1)
                display_name.remove(pos, 10);

            QCString env;
            if(number_of_screens != 1)
            {
                for(int i = 0; i < number_of_screens; i++)
                {
                    if(i != kicker_screen_number && fork() == 0)
                    {
                        kicker_screen_number = i;
                        // break here because we are the child process, we don't
                        // want to fork() anymore
                        break;
                    }
                }

                env.sprintf("DISPLAY=%s.%d", display_name.data(), kicker_screen_number);

                if(putenv(strdup(env.data())))
                {
                    fprintf(stderr, "%s: WARNING: unable to set DISPLAY environment variable\n", argv[0]);
                    perror("putenv()");
                }
            }
        }
    }

    KGlobal::locale()->setMainCatalogue("kicker");

    QCString appname;
    if(kicker_screen_number == 0)
        appname = "kicker";
    else
        appname.sprintf("kicker-screen-%d", kicker_screen_number);

    KAboutData aboutData(appname.data(), I18N_NOOP("KDE Panel"), version, description, KAboutData::License_BSD,
                         I18N_NOOP("(c) 1999-2004, The KDE Team"));

    aboutData.addAuthor("Aaron J. Seigo", I18N_NOOP("Current maintainer"), "[email protected]");
    aboutData.addAuthor("Matthias Elter", 0, "[email protected]");
    aboutData.addAuthor("Matthias Ettrich", 0, "[email protected]");
    aboutData.addAuthor("Wilco Greven", 0, "[email protected]");
    aboutData.addAuthor("Rik Hemsley", 0, "[email protected]");
    aboutData.addAuthor("Daniel M. Duley", 0, "[email protected]");
    aboutData.addAuthor("Preston Brown", 0, "[email protected]");
    aboutData.addAuthor("John Firebaugh", 0, "[email protected]");
    aboutData.addAuthor("Waldo Bastian", I18N_NOOP("Kiosk mode"), "[email protected]");

    aboutData.addCredit("Jessica Hall", /* I18N_NOOP("KConfigXT") */ 0, "[email protected]");
    aboutData.addCredit("Stefan Nikolaus", /* I18N_NOOP("Bug fixes") */ 0, "[email protected]");
    aboutData.addCredit("Benoît Minisini", /* I18N_NOOP("Bug fixes") */ 0, "[email protected]");
    KCmdLineArgs::init(argc, argv, &aboutData);

    if(!Kicker::start())
    {
        kdError() << "kicker is already running!" << endl;
        return 0;
    }

    if(signal(SIGTERM, sighandler) == SIG_IGN)
        signal(SIGTERM, SIG_IGN);
    if(signal(SIGINT, sighandler) == SIG_IGN)
        signal(SIGINT, SIG_IGN);
    if(signal(SIGHUP, sighandler) == SIG_IGN)
        signal(SIGHUP, SIG_IGN);

    // send it even before KApplication ctor, because ksmserver will launch another app as soon
    // as QApplication registers with it
    DCOPClient *cl = new DCOPClient;
    cl->attach();
    DCOPRef r("ksmserver", "ksmserver");
    r.setDCOPClient(cl);
    r.send("suspendStartup", QCString("kicker"));
    delete cl;
    Kicker *kicker = new Kicker;
    int rv = kicker->exec();
    delete kicker;
    return rv;
}
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:100,代码来源:main.cpp

示例8: doFetchNewHeaders


//.........这里部分代码省略.........
        target->setFirstNr(first);
        s = strchr(s, ' ');
    }
    if(s)
    {
        last = atoi(s);
    }
    else
    {
        QString tmp = i18n("No new articles could be retrieved.\nThe server sent a malformatted response:\n");
        tmp += getCurrentLine();
        job->setErrorString(tmp);
        closeConnection();
        return;
    }

    if(target->lastNr() == 0)   //first fetch
    {
        if(first > 0)
            oldlast = first - 1;
        else
            oldlast = first;
    }
    else
        oldlast = target->lastNr();

    toFetch = last - oldlast;
    //qDebug("knode: last %d  oldlast %d  toFetch %d\n",last,oldlast,toFetch);

    if(toFetch <= 0)
    {
        //qDebug("knode: No new Articles in group\n");
        target->setLastNr(last);     // don't get stuck when the article numbers wrap
        return;
    }

    if(toFetch > target->maxFetch())
    {
        toFetch = target->maxFetch();
        //qDebug("knode: Fetching only %d articles\n",toFetch);
    }

    progressValue = 100;
    predictedLines = toFetch;

    // get list of additional headers provided by the XOVER command
    // see RFC 2980 section 2.1.7
    QStrList headerformat;
    cmd = "LIST OVERVIEW.FMT";
    if(sendCommand(cmd, rep) && rep == 215)
    {
        QStrList tmp;
        if(getMsg(tmp))
        {
            for(QCString s = tmp.first(); s; s = tmp.next())
            {
                s = s.stripWhiteSpace();
                // remove the mandatory xover header
                if(s == "Subject:" || s == "From:" || s == "Date:" || s == "Message-ID:"
                        || s == "References:" || s == "Bytes:" || s == "Lines:")
                    continue;
                else
                    headerformat.append(s);
            }
        }
    }

    //qDebug("knode: KNNntpClient::doFetchNewHeaders() : xover %d-%d", last-toFetch+1, last);
    cmd.sprintf("xover %d-%d", last - toFetch + 1, last);
    if(!sendCommand(cmd, rep))
        return;

    // no articles in selected range...
    if(rep == 420)          // 420 No article(s) selected
    {
        target->setLastNr(last);
        return;
    }
    else if(rep != 224)     // 224 success
    {
        handleErrors();
        return;
    }

    QStrList headers;
    if(!getMsg(headers))
    {
        return;
    }

    progressValue = 1000;
    sendSignal(TSprogressUpdate);

    sendSignal(TSsortNew);

    mutex.lock();
    target->insortNewHeaders(&headers, &headerformat, this);
    target->setLastNr(last);
    mutex.unlock();
}
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:101,代码来源:knnntpclient.cpp

示例9: if

int
Base::run( const char *cmd, const char *passphrase, bool onlyReadFromPGP )
{
  /* the pipe ppass is used for to pass the password to
   * pgp. passing the password together with the normal input through
   * stdin doesn't seem to work as expected (at least for pgp5.0)
   */
  char str[1025] = "\0";
  int pin[2], pout[2], perr[2], ppass[2];
  int len, len2;
  FILE *pass;
  pid_t child_pid;
  int childExitStatus;
  struct pollfd pollin, pollout, pollerr;
  int pollstatus;

  if(passphrase)
  {
    pipe(ppass);

    pass = fdopen(ppass[1], "w");
    fwrite(passphrase, sizeof(char), strlen(passphrase), pass);
    fwrite("\n", sizeof(char), 1, pass);
    fclose(pass);
    close(ppass[1]);

    // tell pgp which fd to use for the passphrase
    QCString tmp;
    tmp.sprintf("%d",ppass[0]);
    ::setenv("PGPPASSFD",tmp.data(),1);

    //Uncomment these lines for testing only! Doing so will decrease security!
    //kdDebug(5100) << "pgp PGPPASSFD = " << tmp << endl;
    //kdDebug(5100) << "pgp pass = " << passphrase << endl;
  }
  else
    ::unsetenv("PGPPASSFD");

  //Uncomment these lines for testing only! Doing so will decrease security!
  kdDebug(5100) << "pgp cmd = " << cmd << endl;
  //kdDebug(5100) << "pgp input = " << QString(input)
  //          << "input length = " << input.length() << endl;

  error = "";
  output = "";

  pipe(pin);
  pipe(pout);
  pipe(perr);

  QApplication::flushX();
  if(!(child_pid = fork()))
  {
    /*We're the child.*/
    close(pin[1]);
    dup2(pin[0], 0);
    close(pin[0]);

    close(pout[0]);
    dup2(pout[1], 1);
    close(pout[1]);

    close(perr[0]);
    dup2(perr[1], 2);
    close(perr[1]);

    execl("/bin/sh", "sh", "-c", cmd,  (void *)0);
    _exit(127);
  }

  /*Only get here if we're the parent.*/
  close(pin[0]);
  close(pout[1]);
  close(perr[1]);

  // poll for "There is data to read."
  pollout.fd = pout[0];
  pollout.events = POLLIN;
  pollout.revents = 0; // init with 0, just in case
  pollerr.fd = perr[0];
  pollerr.events = POLLIN;
  pollerr.revents = 0; // init with 0, just in case

  // poll for "Writing now will not block."
  pollin.fd = pin[1];
  pollin.events = POLLOUT;
  pollin.revents = 0; // init with 0, just in case

  if (!onlyReadFromPGP) {
    if (!input.isEmpty()) {
      // write to pin[1] one line after the other to prevent dead lock
      for (unsigned int i=0; i<input.length(); i+=len2) {
        len2 = 0;

        // check if writing now to pin[1] will not block (5 ms timeout)
        //kdDebug(5100) << "Polling pin[1]..." << endl;
        pollstatus = poll(&pollin, 1, 5);
        if (pollstatus == 1) {
          //kdDebug(5100) << "Status for polling pin[1]: " << pollin.revents << endl;
          if (pollin.revents & POLLERR) {
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例10: main


//.........这里部分代码省略.........
        static const char *s_groupName = "Debug";
        static const char *s_entryName = "log-file";
        Kleo::CryptoConfigEntry *entry = config->entry("dirmngr", s_groupName, s_entryName);
        if(entry)
        {
            assert(entry->argType() == Kleo::CryptoConfigEntry::ArgType_Path);
            QString val = entry->stringValue();
            cout << "Log-file initially: " << val.local8Bit() << endl;

            // Test setting the option, sync'ing, then querying again
            entry->setStringValue(QString::fromUtf8("/tmp/test:%e5ä"));
            assert(entry->isDirty());
            config->sync(true);

            // Let's see how it prints it
            system("gpgconf --list-options dirmngr | grep log-file");

            // Clear cached values!
            config->clear();

            // Check new value
            Kleo::CryptoConfigEntry *entry = config->entry("dirmngr", s_groupName, s_entryName);
            assert(entry);
            assert(entry->argType() == Kleo::CryptoConfigEntry::ArgType_Path);
            cout << "Log-file now: " << entry->stringValue().local8Bit() << endl;
            assert(entry->stringValue() == QString::fromUtf8("/tmp/test:%e5ä"));     // (or even with %e5 decoded)

            // Reset old value
#if 0
            QString arg(val);
            if(!arg.isEmpty())
                arg.prepend('"');
            QCString sys;
            sys.sprintf("echo 'log-file:%s' | gpgconf --change-options dirmngr", arg.local8Bit().data());
            system(sys.data());
#endif
            entry->setStringValue(val);
            assert(entry->isDirty());
            config->sync(true);

            cout << "Log-file reset to initial " << val.local8Bit() << endl;
        }
        else
            cout << "Entry 'dirmngr/" << s_groupName << "/" << s_entryName << "' not found" << endl;
    }

    {
        // Static querying and setting of the LDAP URL list option
        static const char *s_groupName = "LDAP";
        static const char *s_entryName = "LDAP Server";
        Kleo::CryptoConfigEntry *entry = config->entry("dirmngr", s_groupName, s_entryName);
        if(entry)
        {
            assert(entry->argType() == Kleo::CryptoConfigEntry::ArgType_LDAPURL);
            assert(entry->isList());
            KURL::List val = entry->urlValueList();
            cout << "URL list initially: " << val.toStringList().join(", ").local8Bit() << endl;

            // Test setting the option, sync'ing, then querying again
            KURL::List lst;
            // We use non-empty paths to workaround a bug in KURL (kdelibs-3.2)
            lst << KURL("ldap://a:389/?b");
            // Test with query containing a litteral ':' (KURL supports this)
            // and a ' ' (KURL will escape it, see issue119)
            lst << KURL("ldap://foo:389/?a:b c");
            lst << KURL("ldap://server:389/?a%3db,c=DE");   // the query contains a litteral ','
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:67,代码来源:test_cryptoconfig.cpp

示例11: aboutData

extern "C" KDE_EXPORT int kdemain(int argc, char *argv[])
{
    bool restored = false;
    for(int arg = 1; arg < argc; arg++)
    {
        if(!qstrcmp(argv[arg], "-session"))
        {
            restored = true;
            break;
        }
    }

    if(!restored)
    {
        // we only do the multihead fork if we are not restored by the session
        // manager, since the session manager will register multiple kwins,
        // one for each screen...
        QCString multiHead = getenv("KDE_MULTIHEAD");
        if(multiHead.lower() == "true")
        {

            Display *dpy = XOpenDisplay(NULL);
            if(!dpy)
            {
                fprintf(stderr, "%s: FATAL ERROR while trying to open display %s\n", argv[0], XDisplayName(NULL));
                exit(1);
            }

            int number_of_screens = ScreenCount(dpy);
            KWinInternal::screen_number = DefaultScreen(dpy);
            int pos; // temporarily needed to reconstruct DISPLAY var if multi-head
            QCString display_name = XDisplayString(dpy);
            XCloseDisplay(dpy);
            dpy = 0;

            if((pos = display_name.findRev('.')) != -1)
                display_name.remove(pos, 10); // 10 is enough to be sure we removed ".s"

            QCString envir;
            if(number_of_screens != 1)
            {
                for(int i = 0; i < number_of_screens; i++)
                {
                    // if execution doesn't pass by here, then kwin
                    // acts exactly as previously
                    if(i != KWinInternal::screen_number && fork() == 0)
                    {
                        KWinInternal::screen_number = i;
                        // break here because we are the child process, we don't
                        // want to fork() anymore
                        break;
                    }
                }
                // in the next statement, display_name shouldn't contain a screen
                //   number. If it had it, it was removed at the "pos" check
                envir.sprintf("DISPLAY=%s.%d", display_name.data(), KWinInternal::screen_number);

                if(putenv(strdup(envir.data())))
                {
                    fprintf(stderr, "%s: WARNING: unable to set DISPLAY environment variable\n", argv[0]);
                    perror("putenv()");
                }
            }
        }
    }

    KGlobal::locale()->setMainCatalogue("kwin");

    KAboutData aboutData("kwin", I18N_NOOP("KWin"), version, description, KAboutData::License_GPL, I18N_NOOP("(c) 1999-2005, The KDE Developers"));
    aboutData.addAuthor("Matthias Ettrich", 0, "[email protected]");
    aboutData.addAuthor("Cristian Tibirna", 0, "[email protected]");
    aboutData.addAuthor("Daniel M. Duley", 0, "[email protected]");
    aboutData.addAuthor("Luboš Luňák", I18N_NOOP("Maintainer"), "[email protected]");

    KCmdLineArgs::init(argc, argv, &aboutData);
    KCmdLineArgs::addCmdLineOptions(args);

    if(signal(SIGTERM, KWinInternal::sighandler) == SIG_IGN)
        signal(SIGTERM, SIG_IGN);
    if(signal(SIGINT, KWinInternal::sighandler) == SIG_IGN)
        signal(SIGINT, SIG_IGN);
    if(signal(SIGHUP, KWinInternal::sighandler) == SIG_IGN)
        signal(SIGHUP, SIG_IGN);

    KApplication::disableAutoDcopRegistration();
    KWinInternal::Application a;
    KWinInternal::SessionManaged weAreIndeed;
    KWinInternal::SessionSaveDoneHelper helper;

    fcntl(ConnectionNumber(qt_xdisplay()), F_SETFD, 1);

    QCString appname;
    if(KWinInternal::screen_number == 0)
        appname = "kwin";
    else
        appname.sprintf("kwin-screen-%d", KWinInternal::screen_number);

    DCOPClient *client = a.dcopClient();
    client->registerAs(appname.data(), false);
    client->setDefaultObject("KWinInterface");
//.........这里部分代码省略.........
开发者ID:serghei,项目名称:kde3-kdebase,代码行数:101,代码来源:main.cpp

示例12: setScheduler

int KDEsuClient::setScheduler(int sched)
{
    QCString cmd;
    cmd.sprintf("SCHD %d\n", sched);
    return command(cmd);
}
开发者ID:,项目名称:,代码行数:6,代码来源:

示例13: doCheckNewGroups

void KNNntpClient::doCheckNewGroups()
{
    KNGroupListData *target = static_cast<KNGroupListData *>(job->data());

    sendSignal(TSdownloadNewGroups);
    errorPrefix = i18n("New groups could not be retrieved.\nThe following error occurred:\n");

    progressValue = 100;
    predictedLines = 30;     // rule of thumb ;-)

    QCString cmd;
    cmd.sprintf("NEWGROUPS %.2d%.2d%.2d 000000", target->fetchSince.year() % 100, target->fetchSince.month(), target->fetchSince.day());
    if(!sendCommandWCheck(cmd, 231))      // 231 list of new newsgroups follows
        return;

    char *s, *line;
    QString name;
    KNGroup::Status status;
    QSortedList<KNGroupInfo> tmpList;
    tmpList.setAutoDelete(true);

    while(getNextLine())
    {
        line = getCurrentLine();
        if(line[0] == '.')
        {
            if(line[1] == '.')
                line++;        // collapse double period into one
            else if(line[1] == 0)
                break;   // message complete
        }
        s = strchr(line, ' ');
        if(!s)
        {
#ifndef NDEBUG
            qDebug("knode: retrieved broken group-line - ignoring");
#endif
        }
        else
        {
            s[0] = 0;    // cut string
            name = QString::fromUtf8(line);

            while(s[1] != 0) s++;  // the last character determines the moderation status
            switch(s[0])
            {
                case 'n' :
                    status = KNGroup::readOnly;
                    break;
                case 'y' :
                    status = KNGroup::postingAllowed;
                    break;
                case 'm' :
                    status = KNGroup::moderated;
                    break;
                default  :
                    status = KNGroup::unknown;
            }

            tmpList.append(new KNGroupInfo(name, QString::null, true, false, status));
        }
        doneLines++;
    }

    if(!job->success() || job->canceled())
        return;     // stopped...

    if(target->getDescriptions)
    {
        errorPrefix = i18n("The group descriptions could not be retrieved.\nThe following error occurred:\n");
        progressValue = 100;
        doneLines = 0;
        predictedLines = tmpList.count() * 3;

        sendSignal(TSdownloadDesc);
        sendSignal(TSprogressUpdate);

        cmd = "LIST NEWSGROUPS ";
        QStrList desList;
        char *s;
        int rep;

        for(KNGroupInfo *group = tmpList.first(); group; group = tmpList.next())
        {
            if(!sendCommand(cmd + group->name.utf8(), rep))
                return;
            if(rep != 215)         // 215 informations follows
                break;
            desList.clear();
            if(!getMsg(desList))
                return;

            if(desList.count() > 0)         // group has a description
            {
                s = desList.first();
                while(*s != - '\0' && *s != '\t' && *s != ' ') s++;
                if(*s == '\0')
                {
#ifndef NDEBUG
                    qDebug("knode: retrieved broken group-description - ignoring");
//.........这里部分代码省略.........
开发者ID:serghei,项目名称:kde3-kdepim,代码行数:101,代码来源:knnntpclient.cpp

示例14: visit

void DocbookDocVisitor::visit(DocVerbatim *s)
{
  if (m_hide) return;
  SrcLangExt langExt = getLanguageFromFileName(m_langExt);
  switch(s->type())
  {
    case DocVerbatim::Code: // fall though
      m_t << "<literallayout><computeroutput>";
      Doxygen::parserManager->getParser(m_langExt)
        ->parseCode(m_ci,s->context(),s->text(),langExt,
            s->isExample(),s->exampleFile());
      m_t << "</computeroutput></literallayout>";
      break;
    case DocVerbatim::Verbatim:
      m_t << "<literallayout>";
      filter(s->text());
      m_t << "</literallayout>";
      break;
    case DocVerbatim::HtmlOnly:    
      break;
    case DocVerbatim::RtfOnly:     
      break;
    case DocVerbatim::ManOnly:     
      break;
    case DocVerbatim::LatexOnly:   
      break;
    case DocVerbatim::XmlOnly:     
      break;
    case DocVerbatim::DocbookOnly: 
      break;
      m_t << s->text();
      break;
    case DocVerbatim::Dot:
      {
        static int dotindex = 1;
        QCString baseName(4096);
        QCString name;
        QCString stext = s->text();
        m_t << "<para>" << endl;
        name.sprintf("%s%d", "dot_inline_dotgraph_", dotindex);
        baseName.sprintf("%s%d",
            (Config_getString("DOCBOOK_OUTPUT")+"/inline_dotgraph_").data(),
            dotindex++
            );
        QFile file(baseName+".dot");
        if (!file.open(IO_WriteOnly))
        {
          err("Could not open file %s.msc for writing\n",baseName.data());
        }
        file.writeBlock( stext, stext.length() );
        file.close();
        m_t << "    <figure>" << endl;
        m_t << "        <title>" << name << "</title>" << endl;
        m_t << "        <mediaobject>" << endl;
        m_t << "            <imageobject>" << endl;
        writeDotFile(baseName);
        m_t << "            </imageobject>" << endl;
        m_t << "       </mediaobject>" << endl;
        m_t << "    </figure>" << endl;
        m_t << "</para>" << endl;
      }
      break;
    case DocVerbatim::Msc:
      static int mscindex = 1;
      QCString baseName(4096);
      QCString name;
      QCString stext = s->text();
      m_t << "<para>" << endl;
      name.sprintf("%s%d", "msc_inline_mscgraph_", mscindex);
      baseName.sprintf("%s%d",
          (Config_getString("DOCBOOK_OUTPUT")+"/inline_mscgraph_").data(),
          mscindex++
          );
      QFile file(baseName+".msc");
      if (!file.open(IO_WriteOnly))
      {
        err("Could not open file %s.msc for writing\n",baseName.data());
      }
      QCString text = "msc {";
      text+=stext;
      text+="}";
      file.writeBlock( text, text.length() );
      file.close();
      m_t << "    <figure>" << endl;
      m_t << "        <title>" << name << "</title>" << endl;
      m_t << "        <mediaobject>" << endl;
      m_t << "            <imageobject>" << endl;
      writeMscFile(baseName);
      m_t << "            </imageobject>" << endl;
      m_t << "       </mediaobject>" << endl;
      m_t << "    </figure>" << endl;
      m_t << "</para>" << endl;
      break;
  }
}
开发者ID:CN-Sean,项目名称:doxygen,代码行数:95,代码来源:docbookvisitor.cpp


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