KStringList KDEsuClient::getKeys(const QCString &group) { QCString cmd = "GETK "; cmd += escape(group); cmd += "\n"; QCString reply; command(cmd, &reply); int index = 0, pos; KStringList list; if(!reply.isEmpty()) { // kdDebug(900) << "Found a matching entry: " << reply << endl; while(1) { pos = reply.find('\007', index); if(pos == -1) { if(index == 0) list.append(reply); else list.append(reply.mid(index)); break; } else { list.append(reply.mid(index, pos - index)); } index = pos + 1; } } return list; }
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; }
void KSircIONotify::sirc_receive(QCString str, bool) { if(str.contains("*)*")){ int s1, s2; s1 = str.find("Signon by") + 10; s2 = str.find(" ", s1); if(s1 < 0 || s2 < 0){ kdDebug(5008) << "Nick Notify mesage broken: " << str << endl; return; } QString nick = str.mid(s1, s2 - s1); emit notify_online(nick); } else if(str.contains("*(*")){ int s1, s2; s1 = str.find("Signoff by") + 11; s2 = str.find(" ", s1); if(s1 < 0 || s2 < 0){ kdDebug(5008) << "Nick Notify mesage broken: " << str << endl; return; } QString nick = str.mid(s1, s2 - s1); emit notify_offline(nick); } else{ proc->getWindowList()["!default"]->sirc_receive(str); kdDebug(5008) << "Nick Notifer got " << str << endl; } }
CommentData(const QCString & f, const int l, const QCString & t) : isJavaStyle(false), isQtStyle(false), line(l), fileName(f) { isJavaStyle = t.length()>0 && t.at(0)=='*'; isQtStyle = t.length()>0 && t.at(0)=='!'; shouldIgnore = (!isJavaStyle && !isQtStyle); associateWithPrevious = (t.length()>1 && t.at(1)=='<'); if (associateWithPrevious) { text = t.mid(2); } else { text = t.mid(1); } }
void UmlItem::replace_alias(QCString & s) { int index = 0; while ((index = s.find("@{", index)) != -1) { int index2 = s.find('}', index + 2); if (index2 == -1) return; UmlBaseItem * obj = this; QCString key = s.mid(index + 2, index2 - index - 2); QCString value; for (;;) { if (obj->propertyValue(key, value)) { s.replace(index, index2 - index + 1, value); index += value.length(); break; } else if ((obj = obj->parent()) == 0) { index = index2 + 1; break; } } } }
static QCString convertFileId2Var(const QCString &fileId) { QCString varId = fileId; int i=varId.findRev('/'); if (i>=0) varId = varId.mid(i+1); return substitute(varId,"-","_"); }
void DefinitionImpl::init(const char *df,int dl, const char *n) { defFileName = df; int lastDot = defFileName.findRev('.'); if (lastDot!=-1) { defFileExt = defFileName.mid(lastDot); } defLine = dl; QCString name = n; if (name!="<globalScope>") { //extractNamespaceName(m_name,m_localName,ns); localName=stripScope(n); } else { localName=n; } //printf("m_localName=%s\n",m_localName.data()); brief = 0; details = 0; body = 0; inbodyDocs = 0; sourceRefByDict = 0; sourceRefsDict = 0; sectionDict = 0, outerScope = Doxygen::globalScope; partOfGroups = 0; xrefListItems = 0; hidden = FALSE; isArtificial = FALSE; }
void makeInlineDoc(int endCode) { int len=endCode-iCodeLen; QCString par=inputString.mid(iCodeLen,len); //fprintf(stderr,"\n inline code: \n<%s>",par.data()); gBlock.doc=par; gBlock.inbodyDocs=par; gBlock.section=Entry::VARIABLE_SEC; gBlock.spec=VhdlDocGen::MISCELLANEOUS; gBlock.fileName = yyFileName; gBlock.endBodyLine=yyLineNr-1; gBlock.lang=SrcLangExt_VHDL; Entry *temp=new Entry(gBlock); Entry* compound=getVhdlCompound(); if (compound) { compound->addSubEntry(temp); } else { temp->type="misc"; // global code like library ieee... VhdlParser::current_root->addSubEntry(temp); } strComment.resize(0); gBlock.reset(); }// makeInlineDoc
int KDEsuClient::command(const QCString &cmd, QCString *result) { if(sockfd < 0) return -1; if(send(sockfd, cmd, cmd.length(), 0) != (int)cmd.length()) return -1; char buf[1024]; int nbytes = recv(sockfd, buf, 1023, 0); if(nbytes <= 0) { kdWarning(900) << k_lineinfo << "no reply from daemon\n"; return -1; } buf[nbytes] = '\000'; QCString reply = buf; if(reply.left(2) != "OK") return -1; if(result) *result = reply.mid(3, reply.length() - 4); return 0; }
void HtmlDocVisitor::visit(DocURL *u) { if (m_hide) return; if (u->isEmail()) // mail address { QCString url = u->url(); writeObfuscatedMailAddress(url); uint size=5,i; for (i=0;i<url.length();) { filter(url.mid(i,size)); if (i<url.length()-size) m_t << "<span style=\"display: none;\">.nosp@m.</span>"; i+=size; if (size==5) size=4; else size=5; } m_t << "</a>"; } else // web address { m_t << "<a href=\""; m_t << u->url() << "\">"; filter(u->url()); m_t << "</a>"; } }
void ClangParser::linkInclude(CodeOutputInterface &ol,FileDef *fd, uint &line,uint &column,const char *text) { QCString incName = text; incName = incName.mid(1,incName.length()-2); // strip ".." or <..> FileDef *ifd=0; if (!incName.isEmpty()) { FileName *fn = Doxygen::inputNameDict->find(incName); if (fn) { bool found=false; FileNameIterator fni(*fn); // for each include name for (fni.toFirst();!found && (ifd=fni.current());++fni) { // see if this source file actually includes the file found = fd->isIncluded(ifd->absFilePath()); //printf(" include file %s found=%d\n",ifd->absFilePath().data(),found); } } } if (ifd) { ol.writeCodeLink(ifd->getReference(),ifd->getOutputFileBase(),0,text,ifd->briefDescriptionAsTooltip()); } else { codifyLines(ol,ifd,text,line,column,"preprocessor"); } }
static QCString getExtension() { /* * [.][nuber][rest] * in case of . missing, just ignore it * in case number missing, just place a 3 in front of it */ QCString ext = Config_getString("MAN_EXTENSION"); if (ext.isEmpty()) { ext = "3"; } else { if (ext.at(0)=='.') { if (ext.length()==1) { ext = "3"; } else // strip . { ext = ext.mid(1); } } if (ext.at(0)<'0' || ext.at(0)>'9') { ext.prepend("3"); } } return ext; }
static QCString getListOfBibFiles(const QCString &sep,bool stripExtension) { QCString result; QStrList &citeDataList = Config_getList("CITE_BIB_FILES"); const char *bibdata = citeDataList.first(); while (bibdata) { int i; QCString bibFile = bibdata; if (stripExtension && bibFile.right(4)==".bib") { bibFile = bibFile.left(bibFile.length()-4); } if (stripExtension && (i=bibFile.findRev('/'))!=-1) { bibFile = bibFile.mid(i+1); } if (!bibFile.isEmpty()) { result+=bibFile; bibdata = citeDataList.next(); if (bibdata) { result+=sep; } } else { bibdata = citeDataList.next(); } } return result; }
qCopInfo ButtonUtils::messageToInfo ( const OQCopMessage &c ) { QCString ch = c.channel(); QCString f = c.message(); if ( ch == "ignore" ) return qCopInfo ( qApp->translate ( "ButtonSettings", "<nobr>Ignored</nobr>" )); for ( const predef_qcop *p = predef; p->m_text; p++ ) { if (( ch == p->m_channel ) && ( f == p->m_function )) { return qCopInfo ( qApp->translate ( "ButtonSettings", p->m_text ), Opie::Core::OResource::loadPixmap( p->m_pixmap, Opie::Core::OResource::SmallIcon ) ); } } if ( ch.left ( 16 ) == "QPE/Application/" ) { QString app = ch.mid ( 16 ); const AppLnk *applnk = m_apps->findExec ( app ); if ( applnk ) app = applnk->name(); if (( f == "raise()" ) || ( f == "nextView()" )) return qCopInfo ( qApp->translate ( "ButtonSettings", "<nobr>Show <b>%1</b></nobr>" ).arg ( app ), applnk ? applnk->pixmap() : QPixmap()); else return qCopInfo ( qApp->translate ( "ButtonSettings", "<nobr>Call <b>%1</b>: <i>%2</i></nobr>" ).arg ( app ).arg ( f ), applnk ? applnk->pixmap() : QPixmap()); } else { return qCopInfo ( qApp->translate ( "ButtonSettings", "<nobr>Call <b>%1</b> <i>%2</i></nobr>" ).arg (( ch.left ( 4 ) == "QPE/" ) ? ch.mid ( 4 ) : ch ).arg ( f )); } }
void UmlItem::write_multiplicity(FileOut & out, QCString s, UmlItem * who) { if (!s.isEmpty()) { QCString min; QCString max; int index = s.find(".."); if (index != -1) { min = s.left(index).stripWhiteSpace(); max = s.mid(index+2).stripWhiteSpace(); } else min = max = s.stripWhiteSpace(); out.indent(); out << "<lowerValue xmi:type=\"uml:LiteralString\""; out.id_prefix(who, "MULTIPLICITY_L_"); out << " value=\"" << min << "\"/>\n"; out.indent(); out << "<upperValue xmi:type=\"uml:LiteralString\""; out.id_prefix(who, "MULTIPLICITY_U_"); out << " value=\"" << max << "\"/>\n"; } }
static QCString node2URL(FTVNode *n,bool overruleFile=FALSE,bool srcLink=FALSE) { QCString url = n->file; if (!url.isEmpty() && url.at(0)=='!') // relative URL { // remove leading ! url = url.mid(1); } else if (!url.isEmpty() && url.at(0)=='^') // absolute URL { // skip, keep ^ in the output } else // local file (with optional anchor) { if (overruleFile && n->def && n->def->definitionType()==Definition::TypeFile) { FileDef *fd = (FileDef*)n->def; if (srcLink) { url = fd->getSourceFileBase(); } else { url = fd->getOutputFileBase(); } } url+=Doxygen::htmlFileExtension; if (!n->anchor.isEmpty()) url+="#"+n->anchor; } return url; }
void UmlOperation::write_cpp_java_params(FileOut & out, QCString decl) { int index1 = decl.find("${(}"); if (index1 == -1) return; int index2 = decl.find("${)}", index1 + 4); if (index2 == -1) return; decl = decl.mid(index1 + 4, index2 - index1 - 4); index1 = 0; const QValueList<UmlParameter> p = params(); QCString sparam; QCString kname; QCString ktype; int rank; if ((name() == "unload") && (parent()->name() == "UmlBasePackage")) rank = 123; while (get_param(decl, index1, sparam, kname, ktype, rank)) { if (rank < (int) p.count()) { const UmlParameter & pa = p[rank]; out.indent(); out << "<UML:Parameter name=\"" << pa.name << "\" xmi.id=\"BOUML_op_param_" << ++param_id << "\" kind =\""; switch (pa.dir) { case InputOutputDirection: out << "inout\">\n"; break; case OutputDirection: out << "out\">\n"; break; default: out << "in\">\n"; } UmlTypeSpec t = pa.type; if ((t.type != 0) || !(t.explicit_type = (_lang == Cpp) ? CppSettings::type(t.explicit_type) : JavaSettings::type(t.explicit_type)).isEmpty()) { out.indent(); out << "\t<UML:Parameter.type>\n"; out.indent(); out << "\t\t<UML:DataType"; write_type(out, t, sparam, kname, ktype); out << "/>\n"; out.indent(); out << "\t</UML:Parameter.type>\n"; } out.indent(); out << "</UML:Parameter>\n"; } } }
void KNNntpClient::doPostArticle() { KNLocalArticle *art = static_cast<KNLocalArticle *>(job->data()); sendSignal(TSsendArticle); if(art->messageID(false) != 0) { int rep; if(!sendCommand(QCString("STAT ") + art->messageID(false)->as7BitString(false), rep)) return; if(rep == 223) // 223 n <a> article retrieved - request text separately { #ifndef NDEBUG qDebug("knode: STAT successful, we have probably already sent this article."); #endif return; // the article is already on the server, lets put it silently into the send folder } } if(!sendCommandWCheck("POST", 340)) // 340 send article to be posted. End with <CR-LF>.<CR-LF> return; if(art->messageID(false) == 0) // article has no message ID => search for a ID in the response { QCString s = getCurrentLine(); int start = s.findRev(QRegExp("<[^\\s]*@[^\\s]*>")); if(start != -1) // post response includes a recommended id { int end = s.find('>', start); art->messageID()->from7BitString(s.mid(start, end - start + 1)); art->assemble(); #ifndef NDEBUG qDebug("knode: using the message-id recommended by the server: %s", s.mid(start, end - start + 1).data()); #endif } } if(!sendMsg(art->encodedContent(true))) return; if(!checkNextResponse(240)) // 240 article posted ok return; }
void VerilogDocGen::adjustOpName(QCString & nn) { QRegExp regg("[_a-zA-Z]"); int j=nn.find(regg,0); if (j>0) nn=nn.mid(j,nn.length()); }
static bool matchExcludedSymbols(const char *name) { static QStrList &exclSyms = Config_getList("EXCLUDE_SYMBOLS"); if (exclSyms.count()==0) return FALSE; // nothing specified const char *pat = exclSyms.first(); QCString symName = name; while (pat) { QCString pattern = pat; bool forceStart=FALSE; bool forceEnd=FALSE; if (pattern.at(0)=='^') pattern=pattern.mid(1),forceStart=TRUE; if (pattern.at(pattern.length()-1)=='$') pattern=pattern.left(pattern.length()-1),forceEnd=TRUE; if (pattern.find('*')!=-1) // wildcard mode { QRegExp re(substitute(pattern,"*",".*"),TRUE); int i,pl; i = re.match(symName,0,&pl); //printf(" %d = re.match(%s) pattern=%s\n",i,symName.data(),pattern.data()); if (i!=-1) // wildcard match { int sl=symName.length(); // check if it is a whole word match if ((i==0 || pattern.at(0)=='*' || (!isId(symName.at(i-1)) && !forceStart)) && (i+pl==sl || pattern.at(i+pl)=='*' || (!isId(symName.at(i+pl)) && !forceEnd)) ) { //printf("--> name=%s pattern=%s match at %d\n",symName.data(),pattern.data(),i); return TRUE; } } } else if (!pattern.isEmpty()) // match words { int i = symName.find(pattern); if (i!=-1) // we have a match! { int pl=pattern.length(); int sl=symName.length(); // check if it is a whole word match if ((i==0 || (!isId(symName.at(i-1)) && !forceStart)) && (i+pl==sl || (!isId(symName.at(i+pl)) && !forceEnd)) ) { //printf("--> name=%s pattern=%s match at %d\n",symName.data(),pattern.data(),i); return TRUE; } } } pat = exclSyms.next(); } //printf("--> name=%s: no match\n",name); return FALSE; }
static int findMatchingPart(const QCString &path,const QCString dir) { int si1; int pos1=0,pos2=0; while ((si1=path.find('/',pos1))!=-1) { int si2=dir.find('/',pos2); //printf(" found slash at pos %d in path %d: %s<->%s\n",si1,si2, // path.mid(pos1,si1-pos2).data(),dir.mid(pos2).data()); if (si2==-1 && path.mid(pos1,si1-pos2)==dir.mid(pos2)) // match at end { return dir.length(); } if (si1!=si2 || path.mid(pos1,si1-pos2)!=dir.mid(pos2,si2-pos2)) // no match in middle { return QMAX(pos1-1,0); } pos1=si1+1; pos2=si2+1; } return 0; }
void HtmlDocVisitor::writeObfuscatedMailAddress(const QCString &url) { m_t << "<a href=\"#\" onclick=\"location.href='mai'+'lto:'"; uint i; int size=3; for (i=0;i<url.length();) { m_t << "+'" << url.mid(i,size) << "'"; i+=size; if (size==3) size=2; else size=3; } m_t << "; return false;\">"; }
static QCString getExtension() { QCString ext = Config_getString("MAN_EXTENSION"); if( ext.length() >= 2 && ext.data()[0] == '.') { ext = ext.mid(1, ext.length()-1); } else { ext = "3"; } return ext; }
void FileOut::define_datatypes(bool uml_20, bool primitive_type, bool gen_extension) { const char * pfix = (primitive_type) ? ((uml_20) ? "<ownedMember xmi:type=\"uml:PrimitiveType\"" : "<packagedElement xmi:type=\"uml:PrimitiveType\"") : ((uml_20) ? "<ownedMember xmi:type=\"uml:DataType\"" : "<packagedElement xmi:type=\"uml:DataType\""); QMap<QCString, int>::ConstIterator it; for (it = _datatypes.begin(); it != _datatypes.end(); ++it) { indent(); (*this) << pfix << " xmi:id=\"BOUML_datatype_" << it.data() << "\" name=\""; quote(it.key()); (*this) << "\"/>\n"; } const char * postfix = (uml_20) ? "</ownedMember>\n" : "</packagedElement>\n"; for (it = _modifiedtypes.begin(); it != _modifiedtypes.end(); ++it) { QCString k = it.key(); int index = k.find('_'); indent(); (*this) << pfix << " xmi:id=\"BOUML_basedontype_" << it.data() << "\" name = \""; quote(k.mid(index + 1)); (*this) << '"'; if (gen_extension) { (*this) << ">\n"; indent(); (*this) << "\t<xmi:Extension extender=\"Bouml\">\n"; indent(); (*this) << "\t\t<basedOn \"BOUML_" << k.left(index) << "\"/>\n"; indent(); (*this) << "\t</xmi:Extension>\n"; indent(); (*this) << postfix; } else (*this) << "/>\n"; } }
void KJFilename::timeUpdate(int) { if ( !napp->player()->current() ) // just for safety return; QCString title = QCString( napp->player()->current().title().local8Bit() ); if ( title == mLastTitle ) return; mLastTitle = title; QCString timestring = napp->player()->lengthString().local8Bit(); timestring = timestring.mid(timestring.find('/')+1); prepareString ( title + " (" + timestring + ") "); }
QString getType(const QXmlAttributes & attributes) { const int type_idx(indexOf(attributes, "type")); const int named_type_idx(indexOf(attributes, "named-type")); QCString type; if (named_type_idx >= 0) { type = attributes.value(named_type_idx).utf8(); if (type.left(2)!="::") { type = getCurrentScope(attributes.value(named_type_idx).utf8()); } else { type = type.mid(2); } if (m_namedTypeMap.contains(type)) { if (type_idx >= 0) { const QCString dbus_type(attributes.value(type_idx).utf8()); if (dbus_type != m_namedTypeMap[type]) { DOC_ERROR(QString("Type \"%1\" does not match up with " "previous definition of named type \"%2\" (which was \"%3\"."). arg(dbus_type). arg(type). arg(m_namedTypeMap[type])); } } return type; } DOC_ERROR(QString("Undefined named type \"%1\" used.").arg(type)); } if (type_idx >= 0) { type = attributes.value(type_idx).utf8(); QRegExp reg_exp(QCString("(a?[ybnqiuxdtsogv]|a[{]sv[}])")); if (reg_exp.match(type.data())) { return type; } DOC_ERROR(QString("Unnamed complex D-Bus type \"%1\" found.").arg(type)); } return QString(); }
void Definition::addToMap(const char *name,Definition *d) { bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL"); QCString symbolName = name; int index=computeQualifiedIndex(symbolName); if (!vhdlOpt && index!=-1) symbolName=symbolName.mid(index+2); if (!symbolName.isEmpty()) { //printf("******* adding symbol `%s' (%p)\n",symbolName.data(),d); DefinitionIntf *di=Doxygen::symbolMap->find(symbolName); //printf(" addToMap(%p): looking for symbol %s: %p\n",d,symbolName.data(),di); if (di==0) // new Symbol { //printf(" new symbol!\n"); Doxygen::symbolMap->insert(symbolName,d); } else // existing symbol { //printf(" existing symbol: "); if (di->definitionType()==DefinitionIntf::TypeSymbolList) // already multiple symbols { //printf("adding to exiting list\n"); DefinitionList *dl = (DefinitionList*)di; dl->append(d); } else // going from one to two symbols { Doxygen::symbolMap->take(symbolName); DefinitionList *dl = new DefinitionList; //printf("replacing symbol by list %p with elements %p and %p\n",dl,di,d); dl->append((Definition*)di); dl->append(d); Doxygen::symbolMap->insert(symbolName,dl); } } // auto resize if needed static int sizeIndex=9; if (Doxygen::symbolMap->size()>SDict_primes[sizeIndex]) { Doxygen::symbolMap->resize(SDict_primes[++sizeIndex]); } d->_setSymbolName(symbolName); } }
/** * Client "conn" emits the signal "fun" with "data" as arguments. * * If "excludeSelf" is true, signal is never sent to "conn" itself. */ void DCOPSignals::emitSignal(DCOPConnection *conn, const QCString &_fun, const QByteArray &data, bool excludeSelf) { QCString senderObj; QCString fun = _fun; int i = fun.find('#'); if(i > -1) { senderObj = fun.left(i); fun = fun.mid(i + 1); } DCOPSignalConnectionList *list = connections.find(fun); if(!list) return; for(DCOPSignalConnection *current = list->first(); current; current = list->next()) { bool doSend = false; if(current->senderConn) { if(current->senderConn == conn) doSend = true; } else if(!current->sender.isEmpty()) { if((conn && current->sender == conn->appId) || (current->sender == "DCOPServer")) doSend = true; } else { doSend = true; } if(!current->senderObj.isEmpty() && (current->senderObj != senderObj)) { doSend = false; } if(excludeSelf && (conn == current->recvConn)) doSend = false; if(doSend) { the_server->sendMessage(current->recvConn, conn ? conn->appId : QCString("DCOPServer"), current->recvConn->appId, current->recvObj, current->slot, data); } } }
void LatexDocVisitor::visit(DocCite *cite) { if (m_hide) return; if (!cite->file().isEmpty()) { //startLink(cite->ref(),cite->file(),cite->anchor()); QCString anchor = cite->anchor(); anchor = anchor.mid(CiteConsts::anchorPrefix.length()); // strip prefix m_t << "\\cite{" << anchor << "}"; } else { m_t << "{\\bfseries ["; filter(cite->text()); m_t << "]}"; } }
void HtmlDocVisitor::visit(DocFormula *f) { if (m_hide) return; bool bDisplay = !f->isInline(); if (bDisplay) { forceEndParagraph(f); m_t << "<p class=\"formulaDsp\">" << endl; } if (Config_getBool("USE_MATHJAX")) { QCString text = f->text(); bool closeInline = FALSE; if (!bDisplay && !text.isEmpty() && text.at(0)=='$' && text.at(text.length()-1)=='$') { closeInline=TRUE; text = text.mid(1,text.length()-2); m_t << "\\("; } m_t << convertToHtml(text); if (closeInline) { m_t << "\\)"; } } else { m_t << "<img class=\"formula" << (bDisplay ? "Dsp" : "Inl"); m_t << "\" alt=\""; filterQuotedCdataAttr(f->text()); m_t << "\""; /// @todo cache image dimensions on formula generation and give height/width /// for faster preloading and better rendering of the page m_t << " src=\"" << f->relPath() << f->name() << ".png\"/>"; } if (bDisplay) { m_t << endl << "</p>" << endl; forceStartParagraph(f); } }