コード例 #1
0
ファイル: handler.cpp プロジェクト: serghei/kde3-kdebase
void ConnectionHandler::sendExitCode()
{
    if(!m_needExitCode)
        return;
    QCString buf;
    buf.setNum(m_exitCode);
    buf.prepend("OK ");
    buf.append("\n");

    send(m_Fd, buf.data(), buf.length(), 0);
}
コード例 #2
0
    Q_LONG
  CDDBPLookup::writeLine( const QString & line )
  {
    if ( !isConnected() )
    {
      kdDebug(60010) << "socket status: " << socket_->state() << endl;
      return -1;
    }

    kdDebug(60010) << "WRITE: [" << line << "]" << endl;
    QCString buf = line.utf8();
    buf.append( "\n" );

    return socket_->writeBlock( buf.data(), buf.length() );
  }
コード例 #3
0
QCString KDEsuClient::escape(const QCString &str)
{
    QCString copy = str;
    int n = 0;
    while((n = copy.find("\\", n)) != -1)
    {
        copy.insert(n, '\\');
        n += 2;
    }
    n = 0;
    while((n = copy.find("\"", n)) != -1)
    {
        copy.insert(n, '\\');
        n += 2;
    }
    copy.prepend("\"");
    copy.append("\"");
    return copy;
}
コード例 #4
0
ファイル: dmctl.cpp プロジェクト: serghei/kde3-kdebase
void DM::shutdown(KApplication::ShutdownType shutdownType, KApplication::ShutdownMode shutdownMode, /* NOT Default */
                  const QString &bootOption)
{
    if(shutdownType == KApplication::ShutdownTypeNone)
        return;

    bool cap_ask;
    if(DMType == NewKDM)
    {
        QCString re;
        cap_ask = exec("caps\n", re) && re.find("\tshutdown ask") >= 0;
    }
    else
    {
        if(!bootOption.isEmpty())
            return;
        cap_ask = false;
    }
    if(!cap_ask && shutdownMode == KApplication::ShutdownModeInteractive)
        shutdownMode = KApplication::ShutdownModeForceNow;

    QCString cmd;
    if(DMType == GDM)
    {
        cmd.append(shutdownMode == KApplication::ShutdownModeForceNow ? "SET_LOGOUT_ACTION " : "SET_SAFE_LOGOUT_ACTION ");
        cmd.append(shutdownType == KApplication::ShutdownTypeReboot ? "REBOOT\n" : "HALT\n");
    }
    else
    {
        cmd.append("shutdown\t");
        cmd.append(shutdownType == KApplication::ShutdownTypeReboot ? "reboot\t" : "halt\t");
        if(!bootOption.isEmpty())
            cmd.append("=").append(bootOption.local8Bit()).append("\t");
        cmd.append(shutdownMode == KApplication::ShutdownModeInteractive ? "ask\n" : shutdownMode == KApplication::ShutdownModeForceNow
                                                                                         ? "forcenow\n"
                                                                                         : shutdownMode == KApplication::ShutdownModeTryNow
                                                                                               ? "trynow\n"
                                                                                               : "schedule\n");
    }
    exec(cmd.data());
}
コード例 #5
0
void generateDEFForMember(MemberDef *md,
    FTextStream &t,
    Definition *def,
    const char* Prefix)
{
  QCString memPrefix;

  // + declaration
  // - reimplements
  // - reimplementedBy
  // - exceptions
  // - const/volatile specifiers
  // - examples
  // + source definition
  // - source references
  // - source referenced by
  // - include code 

  if (md->memberType()==MemberDef::EnumValue) return;

  QCString scopeName;
  if (md->getClassDef()) 
    scopeName=md->getClassDef()->name();
  else if (md->getNamespaceDef()) 
    scopeName=md->getNamespaceDef()->name();

  t << "    " << Prefix << "-member = {" << endl;
  memPrefix = "      ";
  memPrefix.append( Prefix );
  memPrefix.append( "-mem-" );

  QCString memType;
  bool isFunc=FALSE;
  switch (md->memberType())
  {
    case MemberDef::Define:      memType="define";    break;
    case MemberDef::EnumValue:   ASSERT(0);           break;
    case MemberDef::Property:    memType="property";  break;
    case MemberDef::Event:       memType="event";     break;
    case MemberDef::Variable:    memType="variable";  break;
    case MemberDef::Typedef:     memType="typedef";   break;
    case MemberDef::Enumeration: memType="enum";      break;
    case MemberDef::Function:    memType="function";  isFunc=TRUE; break;
    case MemberDef::Signal:      memType="signal";    isFunc=TRUE; break;
    case MemberDef::Friend:      memType="friend";    isFunc=TRUE; break;
    case MemberDef::DCOP:        memType="dcop";      isFunc=TRUE; break;
    case MemberDef::Slot:        memType="slot";      isFunc=TRUE; break;
  }

  t << memPrefix << "kind = '" << memType << "';" << endl;
  t << memPrefix << "id   = '"
    << md->getOutputFileBase() << "_1" << md->anchor()
    << "';" << endl;

  t << memPrefix << "virt = ";
  switch (md->virtualness())
  {
    case Normal:  t << "normal;"       << endl; break;
    case Virtual: t << "virtual;"      << endl; break;
    case Pure:    t << "pure-virtual;" << endl; break;
    default: ASSERT(0);
  }

  t << memPrefix << "prot = ";
  switch(md->protection())
  {
    case Public:    t << "public;"    << endl; break;
    case Protected: t << "protected;" << endl; break;
    case Private:   t << "private;"   << endl; break;
    case Package:   t << "package;"   << endl; break;
  }

  if (md->memberType()!=MemberDef::Define &&
      md->memberType()!=MemberDef::Enumeration
     )
  {
    QCString typeStr = replaceAnonymousScopes(md->typeString());
    t << memPrefix << "type = <<_EnD_oF_dEf_TeXt_" << endl << typeStr << endl
      << "_EnD_oF_dEf_TeXt_;" << endl;
  }

  t << memPrefix << "name = '" << md->name() << "';" << endl;

  if (isFunc) //function
  {
    ArgumentList *declAl = new ArgumentList;
    LockingPtr<ArgumentList> defAl = md->argumentList();
    stringToArgumentList(md->argsString(),declAl);
    QCString fcnPrefix = "  " + memPrefix + "param-";

    if (declAl->count()>0)
    {
      ArgumentListIterator declAli(*declAl);
      ArgumentListIterator defAli(*defAl);
      Argument *a;
      for (declAli.toFirst();(a=declAli.current());++declAli)
      {
        Argument *defArg = defAli.current();
        t << memPrefix << "param = {" << endl;
        if (!a->attrib.isEmpty())
        {
          t << fcnPrefix << "attributes = ";
          writeDEFString(t,a->attrib);
          t << ';' << endl;
        }
        if (!a->type.isEmpty())
        {
          t << fcnPrefix << "type = <<_EnD_oF_dEf_TeXt_" << endl
            << a->type << endl << "_EnD_oF_dEf_TeXt_;" << endl;
        }
        if (!a->name.isEmpty())
        {
          t << fcnPrefix << "declname = ";
          writeDEFString(t,a->name);
          t << ';' << endl;
        }
        if (defArg && !defArg->name.isEmpty() && defArg->name!=a->name)
        {
          t << fcnPrefix << "defname = ";
          writeDEFString(t,defArg->name);
          t << ';' << endl;
        }
        if (!a->array.isEmpty())
        {
          t << fcnPrefix << "array = ";
          writeDEFString(t,a->array); 
          t << ';' << endl;
        }
        if (!a->defval.isEmpty())
        {
          t << fcnPrefix << "defval = <<_EnD_oF_dEf_TeXt_" << endl
            << a->defval << endl << "_EnD_oF_dEf_TeXt_;" << endl;
        }
        if (defArg) ++defAli;
        t << "      }; /*" << fcnPrefix << "-param */" << endl;
      }
    }
    delete declAl;
  }
  else if (  md->memberType()==MemberDef::Define
      && md->argsString()!=0)
  {
    ArgumentListIterator ali(*md->argumentList());
    Argument *a;
    QCString defPrefix = "  " + memPrefix + "def-";

    for (ali.toFirst();(a=ali.current());++ali)
    {
      t << memPrefix << "param  = {" << endl;
      t << defPrefix << "name = '" << a->type << "';" << endl;
      t << "      }; /*" << defPrefix << "-param */" << endl;
    }
  }

  if (!md->initializer().isEmpty())
  {
    t << memPrefix << "initializer = <<_EnD_oF_dEf_TeXt_" << endl
      << md->initializer() << endl << "_EnD_oF_dEf_TeXt_;" << endl;
  }
  // TODO: exceptions, const volatile
  if (md->memberType()==MemberDef::Enumeration) // enum
  {
    LockingPtr<MemberList> enumList = md->enumFieldList();
    if (enumList!=0)
    {
      MemberListIterator emli(*enumList);
      MemberDef *emd;
      for (emli.toFirst();(emd=emli.current());++emli)
      {
        t << memPrefix << "enum = { enum-name = " << emd->name() << ';';
        if (!emd->initializer().isEmpty())
        {
          t << " enum-value = ";
          writeDEFString(t,emd->initializer());
          t << ';';
        }
        t << " };" << endl;
      }
    }
  }

  t << memPrefix << "desc-file = '" << md->getDefFileName() << "';" << endl;
  t << memPrefix << "desc-line = '" << md->getDefLine()     << "';" << endl;
  t << memPrefix << "briefdesc =    <<_EnD_oF_dEf_TeXt_"    << endl
    << md->briefDescription() << endl << "_EnD_oF_dEf_TeXt_;" << endl;
  t << memPrefix << "documentation = <<_EnD_oF_dEf_TeXt_"   << endl
    << md->documentation() << endl << "_EnD_oF_dEf_TeXt_;" << endl;

  //printf("md->getReferencesMembers()=%p\n",md->getReferencesMembers());

  LockingPtr<MemberSDict> mdict = md->getReferencesMembers();
  if (!mdict.isNull())
  {
    MemberSDict::Iterator mdi(*mdict);
    MemberDef *rmd;
    QCString refPrefix = "  " + memPrefix + "ref-";

    for (mdi.toFirst();(rmd=mdi.current());++mdi)
    {
      if (rmd->getStartBodyLine()!=-1 && rmd->getBodyDef())
      {
        t << memPrefix << "referenceto = {" << endl;
        t << refPrefix << "id = '"
          << rmd->getBodyDef()->getOutputFileBase()
          << "_1"   // encoded `:' character (see util.cpp:convertNameToFile)
          << rmd->anchor() << "';" << endl;

        t << refPrefix << "line = '"
          << rmd->getStartBodyLine() << "';" << endl;

        QCString scope = rmd->getScopeString();
        QCString name = rmd->name();
        if (!scope.isEmpty() && scope!=def->name())
        {
          name.prepend(scope+"::");
        }

        t << refPrefix << "name = ";
        writeDEFString(t,name);
        t << ';' << endl << "    };" << endl;
      }
    } /* for (mdi.toFirst...) */
  }
  mdict = md->getReferencedByMembers();
  if (!mdict.isNull())
  {
    MemberSDict::Iterator mdi(*mdict);
    MemberDef *rmd;
    QCString refPrefix = "  " + memPrefix + "ref-";

    for (mdi.toFirst();(rmd=mdi.current());++mdi)
    {
      if (rmd->getStartBodyLine()!=-1 && rmd->getBodyDef())
      {
        t << memPrefix << "referenceby = {" << endl;
        t << refPrefix << "id = '"
          << rmd->getBodyDef()->getOutputFileBase()
          << "_1"   // encoded `:' character (see util.cpp:convertNameToFile)
          << rmd->anchor() << "';" << endl;

        t << refPrefix << "line = '"
          << rmd->getStartBodyLine() << "';" << endl;

        QCString scope = rmd->getScopeString();
        QCString name = rmd->name();
        if (!scope.isEmpty() && scope!=def->name())
        {
          name.prepend(scope+"::");
        }

        t << refPrefix << "name = ";
        writeDEFString(t,name);
        t << ';' << endl << "    };" << endl;
      }
    } /* for (mdi.toFirst...) */
  }

  t << "    }; /* " << Prefix << "-member */" << endl;
}
コード例 #6
0
ファイル: small.cpp プロジェクト: whoi-acomms/umodemd
void Small::saveInstance(){
  QCString store;
  QCString temp;
  store.append("MAX_CID=");
  store.append(w->spinBox2->text());
  store.append("\nMRRU=");
  store.append(w->spinBox3->text());
  store.append("\nLARGE_CID=");
  if(w->checkBox1->isChecked())
    store.append("YES");
  else
    store.append("NO");
  store.append("\nCONNECTION_TYPE=");
//  store.append(w->comboBox1->text(w->comboBox1->currentItem()));
//  temp = new QCString();
//  temp = w->comboBox1->currentItem();
  temp.setNum(w->comboBox1->currentItem());
  store.append(temp);
  store.append("\nFEEDBACK_FREQ=");
  temp.setNum(w->slider2->value());
  store.append(temp);

  store.append("\nROHC_ENABLE=");
  if(w->checkBox2->isChecked())
    store.append("YES\n");
  else
    store.append("NO\n");

//  KMessageBox::information(this, store);
  editMode(false);
  w->pushButton2_2->setOn(false);
  object->writeProc(store);  
}
コード例 #7
0
ファイル: vhdljjparser.cpp プロジェクト: Distrotech/doxygen
void VhdlParser::handleCommentBlock(const char* doc1,bool brief)
{
  int position=0;
  static bool isIn;
  QCString doc;
  doc.append(doc1);
 // fprintf(stderr,"\n %s",doc.data());
  if (doc.isEmpty()) return;

  if (checkMultiComment(doc,yyLineNr))
  {
    strComment.resize(0);
    return;
  }

  isIn=checkInlineCode(doc);
  bool isEndCode=doc.contains("\\endcode");
  // empty comment  --!
  if (isEndCode)
  {
    int end=inputString.find(doc.data(),iCodeLen);
    makeInlineDoc(end);
    strComment.resize(0);
    isIn=false;
  }
  if (isIn)
  {
    isIn=false;
    return;
  }

  VhdlDocGen::prepareComment(doc);

  bool needsEntry=FALSE;
  Protection protection=Public;
  int lineNr;
  if (iDocLine==-1)
    lineNr=yyLineNr;

  if (oldEntry==current)
  {
    //printf("\n find pending message  < %s > at line: %d \n ",doc.data(),iDocLine);
    str_doc.doc=doc;
    str_doc.iDocLine=iDocLine;
    str_doc.brief=brief;
    str_doc.pending=TRUE;
    return;
  }

  oldEntry=current;

  if (brief)
  {
    current->briefLine = yyLineNr;
  }
  else
  {
    current->docLine = yyLineNr;
  }
  //  printf("parseCommentBlock file<%s>\n [%s]\n at line [%d] \n ",yyFileName.data(),doc.data(),iDocLine);

  int j=doc.find("[plant]");
  if (j>=0)
  {
    doc=doc.remove(j,7);
    current->stat=true;
  }

  while (parseCommentBlock(
        g_thisParser,
        current,
        doc,        // text
        yyFileName, // file
        iDocLine,   // line of block start
        brief,
        0,
        FALSE,
        protection,
        position,
        needsEntry
        )
      )
  {
    //printf("parseCommentBlock position=%d [%s]\n",position,doc.data()+position);
    if (needsEntry) newEntry();
  }
  if (needsEntry)
  {
    if (varr)
    {
      varr=FALSE;
      current->name=varName;
      current->section=Entry::VARIABLEDOC_SEC;
      varName="";
    }
    newEntry();
  }
  iDocLine=-1;
  strComment.resize(0);
}
コード例 #8
0
void UmlOperation::set_cpp(const char * return_form_or_inherit,
			   const char * params, QCString body,
			   bool inlinep, const char * if_def,
			   const char * end_if) {
  if (*return_form_or_inherit == ':') {
    // inherit
    if (inlinep) {
      QCString s = remove_throw(CppSettings::operationDecl());
      int index = s.find("${)}");
      
      s.resize(index + 5);
      s.insert(index, params);
      s.append(" ");
      s.append(return_form_or_inherit);
      if (!body.isEmpty()) {
	s.append(" {\n  ");
	s.append(body);
	s.append("}\n");
      }
      else
	s.append(" {\n}\n");
      conditional(s, if_def, end_if);
      set_CppDecl(s);
      
      set_CppDef("");
    }
    else {
      QCString s = remove_throw(CppSettings::operationDecl());
      int index = s.find("${)}");
      
      s.resize(index + 5);
      s.insert(index, params);
      s.append(";");
      conditional(s, if_def, end_if);
      set_CppDecl(s);
      
      s = remove_throw(CppSettings::operationDef());
      index = s.find("${)}");
      s.resize(index + 5);
      s.insert(index, params);
      s.append(" ");
      s.append(return_form_or_inherit);
      if (!body.isEmpty()) {
	s.append(" {\n  ");
	s.append(body);
	s.append("}\n");
      }
      else
	s.append(" {\n}\n");
      conditional(s, if_def, end_if);
      set_CppDef(s);
    }
  }
  else {
    // return
    if (inlinep) {
      QCString s = remove_throw(CppSettings::operationDecl());
      int index = s.find("${type}");
      
      s.replace(index, 7, return_form_or_inherit);
      s.insert(s.find("${)}", index), params);
      s.resize(s.findRev(";") + 1);
      if (!body.isEmpty()) {
	s.append(" {\n  ");
	s.append(body);
	s.append("}\n");
      }
      else
	s.append(" {\n}\n");
      conditional(s, if_def, end_if);
      set_CppDecl(s);
      
      set_CppDef("");
    }
    else {
      QCString s = remove_throw(CppSettings::operationDecl());
      int index = s.find("${type}");
      
      s.replace(index, 7, return_form_or_inherit);
      s.insert(s.find("${)}", index), params);
      conditional(s, if_def, end_if);
      set_CppDecl(s);
      
      s = remove_throw(CppSettings::operationDef());
      index = s.find("${type}");
      s.replace(index, 7, return_form_or_inherit);
      s.insert(s.find("${)}", index), params);
      conditional(s, if_def, end_if);
      set_CppDef(s);
      
      set_CppBody(body);
    }
  }
}