QCString VhdlParser::popLabel(QCString & q) { int i=q.findRev("|"); if (i<0) return ""; q = q.left(i); return q; }
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; }
void ManGenerator::startDoxyAnchor(const char *,const char *manName, const char *, const char *name, const char *) { // something to be done? if( !Config_getBool("MAN_LINKS") ) { return; // no } // the name of the link file is derived from the name of the anchor: // - truncate after an (optional) :: QCString baseName = name; int i=baseName.findRev(':'); if (i!=-1) baseName=baseName.right(baseName.length()-i-1); // - remove dangerous characters and append suffix, then add dir prefix QCString fileName=dir+"/"+buildFileName( baseName ); QFile linkfile( fileName ); // - only create file if it doesn't exist already if ( !linkfile.open( IO_ReadOnly ) ) { if ( linkfile.open( IO_WriteOnly ) ) { QTextStream linkstream; linkstream.setDevice(&linkfile); #if QT_VERSION >= 200 linkstream.setEncoding(QTextStream::Latin1); #endif linkstream << ".so man" << getExtension() << "/" << buildFileName( manName ) << endl; } } linkfile.close(); }
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 ManGenerator::startDoxyAnchor(const char *,const char *manName, const char *, const char *name, const char *) { // something to be done? if( !Config_getBool("MAN_LINKS") ) { return; // no } // the name of the link file is derived from the name of the anchor: // - truncate after an (optional) :: QCString baseName = name; int i=baseName.findRev("::"); if (i!=-1) baseName=baseName.right(baseName.length()-i-2); //printf("Converting man link '%s'->'%s'->'%s'\n", // name,baseName.data(),buildFileName(baseName).data()); // - remove dangerous characters and append suffix, then add dir prefix QCString fileName=dir+"/"+buildFileName( baseName ); QFile linkfile( fileName ); // - only create file if it doesn't exist already if ( !linkfile.open( IO_ReadOnly ) ) { if ( linkfile.open( IO_WriteOnly ) ) { FTextStream linkstream; linkstream.setDevice(&linkfile); //linkstream.setEncoding(QTextStream::UnicodeUTF8); linkstream << ".so " << getSubdir() << "/" << buildFileName( manName ) << endl; } } linkfile.close(); }
void buildDirectories() { // for each input file FileNameListIterator fnli(*Doxygen::inputNameList); FileName *fn; for (fnli.toFirst();(fn=fnli.current());++fnli) { FileNameIterator fni(*fn); FileDef *fd; for (;(fd=fni.current());++fni) { //printf("buildDirectories %s\n",fd->name().data()); if (fd->getReference().isEmpty()) { DirDef *dir; if ((dir=Doxygen::directories->find(fd->getPath()))==0) // new directory { dir = DirDef::mergeDirectoryInTree(fd->getPath()); } if (dir && !fd->isDocumentationFile()) dir->addFile(fd); } else { // do something for file imported via tag files. } } } //DirDef *root = new DirDef("root:"); // compute relations between directories => introduce container dirs. DirDef *dir; DirSDict::Iterator sdi(*Doxygen::directories); for (sdi.toFirst();(dir=sdi.current());++sdi) { QCString name = dir->name(); int i=name.findRev('/',name.length()-2); if (i>0) { DirDef *parent = Doxygen::directories->find(name.left(i+1)); //if (parent==0) parent=root; if (parent) { parent->addSubDir(dir); //printf("DirDef::addSubdir(): Adding subdir\n%s to\n%s\n", // dir->displayName().data(), parent->displayName().data()); } } } for (sdi.toFirst();(dir=sdi.current());++sdi) { dir->sort(); } Doxygen::directories->sort(); computeCommonDirPrefix(); }
static QCString stripPath(const QCString &s) { int i=s.findRev('/'); if (i!=-1) { return s.right(s.length()-i-1); } else { return s; } }
void DocbookDocVisitor::writePlantUMLFile(const QCString &baseName, DocVerbatim *s) { QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) { shortName=shortName.right(shortName.length()-i-1); } QCString outDir = Config_getString(DOCBOOK_OUTPUT); generatePlantUMLOutput(baseName,outDir,PUML_BITMAP); visitPreStart(m_t, s->hasCaption(), shortName, s->width(),s->height()); visitCaption(this, s->children()); visitPostEnd(m_t, s->hasCaption()); }
void DocbookDocVisitor::writeDiaFile(const QCString &baseName) { QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) { shortName=shortName.right(shortName.length()-i-1); } QCString outDir = Config_getString("DOCBOOK_OUTPUT"); writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_BITMAP); m_t << " <imagedata"; m_t << " align=\"center\" fileref=\"" << shortName << ".png" << "\">"; m_t << "</imagedata>" << endl; }
void LatexDocVisitor::writeDiaFile(const QCString &baseName, DocVerbatim *s) { QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) { shortName=shortName.right(shortName.length()-i-1); } QCString outDir = Config_getString("LATEX_OUTPUT"); writeDiaGraphFromFile(baseName+".dia",outDir,shortName,DIA_EPS); visitPreStart(m_t, s->hasCaption(), shortName, s->width(), s->height()); visitCaption(this, s->children()); visitPostEnd(m_t, s->hasCaption()); }
void DocbookDocVisitor::writeDotFile(const QCString &baseName, DocVerbatim *s) { QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) { shortName=shortName.right(shortName.length()-i-1); } QCString outDir = Config_getString(DOCBOOK_OUTPUT); writeDotGraphFromFile(baseName+".dot",outDir,shortName,GOF_BITMAP); visitPreStart(m_t, s->hasCaption(), baseName + ".dot", s->width(),s->height()); visitCaption(this, s->children()); visitPostEnd(m_t, s->hasCaption()); }
/*! load filemap and make index. * \param htmlDir of HTML directory generated by htags(1). * \retval TRUE success * \retval FALSE error */ bool Htags::loadFilemap(const QCString &htmlDir) { QCString fileMapName = htmlDir+"/HTML/FILEMAP"; QFileInfo fi(fileMapName); /* * Construct FILEMAP dictionary using QDict. * * In FILEMAP, URL includes 'html' suffix but we cut it off according * to the method of FileDef class. * * FILEMAP format: * <NAME>\t<HREF>.html\n * QDICT: * dict[<NAME>] = <HREF> */ if (fi.exists() && fi.isReadable()) { QFile f(fileMapName); const int maxlen = 8192; QCString line(maxlen+1); line.at(maxlen)='\0'; if (f.open(IO_ReadOnly)) { int len; while ((len=f.readLine(line.rawData(),maxlen))>0) { line.resize(len+1); //printf("Read line: %s",line.data()); int sep = line.find('\t'); if (sep!=-1) { QCString key = line.left(sep).stripWhiteSpace(); QCString value = line.mid(sep+1).stripWhiteSpace(); int ext=value.findRev('.'); if (ext!=-1) value=value.left(ext); // strip extension g_symbolDict.setAutoDelete(TRUE); g_symbolDict.insert(key,new QCString(value)); //printf("Key/Value=(%s,%s)\n",key.data(),value.data()); } } return TRUE; } else { err("file %s cannot be opened\n",fileMapName.data()); } } return FALSE; }
void DocbookDocVisitor::writeMscFile(const QCString &baseName) { QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) { shortName=shortName.right(shortName.length()-i-1); } QCString outDir = Config_getString("DOCBOOK_OUTPUT"); writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_BITMAP); m_t << " <imagedata"; m_t << " width=\"50%\""; m_t << " align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << shortName << ".png" << "\">"; m_t << "</imagedata>" << endl; }
void LatexDocVisitor::writeMscFile(const QCString &baseName) { QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) { shortName=shortName.right(shortName.length()-i-1); } QCString outDir = Config_getString("LATEX_OUTPUT"); writeMscGraphFromFile(baseName+".msc",outDir,shortName,MSC_EPS); m_t << "\n\\begin{DoxyImageNoCaption}" " \\mbox{\\includegraphics"; m_t << "{" << shortName << "}"; m_t << "}\n"; // end mbox m_t << "\\end{DoxyImageNoCaption}\n"; }
bool GroupDef::addClass(const ClassDef *cd) { static bool sortBriefDocs = Config_getBool(SORT_BRIEF_DOCS); if (cd->isHidden()) return FALSE; updateLanguage(cd); QCString qn = cd->name(); if (classSDict->find(qn)==0) { //printf("--- addClass %s sort=%d\n",qn.data(),sortBriefDocs); if (sortBriefDocs) { classSDict->inSort(qn,cd); } else { int i=qn.findRev("::"); if (i==-1) i=qn.find('.'); bool found=FALSE; //printf("i=%d\n",i); if (i!=-1) { // add nested classes (e.g. A::B, A::C) after their parent (A) in // order of insertion QCString scope = qn.left(i); int j=classSDict->findAt(scope); if (j!=-1) { while (j<(int)classSDict->count() && classSDict->at(j)->qualifiedName().left(i)==scope) { //printf("skipping over %s\n",classSDict->at(j)->qualifiedName().data()); j++; } //printf("Found scope at index %d\n",j); classSDict->insertAt(j,qn,cd); found=TRUE; } } if (!found) // no insertion point found -> just append { classSDict->append(qn,cd); } } return TRUE; } return FALSE; }
void DocbookDocVisitor::writeDotFile(const QCString &baseName) { QCString shortName = baseName; int i; if ((i=shortName.findRev('/'))!=-1) { shortName=shortName.right(shortName.length()-i-1); } QCString outDir = Config_getString("DOCBOOK_OUTPUT"); QCString imgExt = Config_getEnum("DOT_IMAGE_FORMAT"); writeDotGraphFromFile(baseName+".dot",outDir,shortName,GOF_BITMAP); m_t << " <imagedata"; //If no width is specified use default value for PDF rendering m_t << " width=\"50%\""; m_t << " align=\"center\" valign=\"middle\" scalefit=\"1\" fileref=\"" << shortName << "." << imgExt << "\">"; m_t << "</imagedata>" << endl; }
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 UmlOperation::set_java(const char * return_form, const char * params, QCString body, bool inlinep) { QCString s = JavaSettings::operationDef(); int index = s.find("${type}"); s.replace(index, 7, return_form); s.insert(s.find("${)}", index), params); if (inlinep) { s.replace(s.findRev("${body}"), 7, body); set_JavaDef(s); } else { set_JavaDef(s); set_JavaBody(body); } }
static QCString getListOfBibFiles(const QCString &sep,bool namesOnly) { QCString result; QStrList &citeDataList = Config_getList("CITE_BIB_FILES"); const char *bibdata = citeDataList.first(); while (bibdata) { int i; QCString bibFile = bibdata; if (namesOnly && bibFile.right(4)==".bib") // strip extension { bibFile = bibFile.left(bibFile.length()-4); } else { if (!namesOnly && bibFile.right(4)!=".bib") bibFile += ".bib"; } if ((i=bibFile.findRev('/'))!=-1) // strip path { bibFile = bibFile.mid(i+1); } if (!bibFile.isEmpty()) { if (namesOnly) // bare names { result+=bibFile; } else // add quotes for paths with spaces { result+="\""+bibFile+"\""; } bibdata = citeDataList.next(); if (bibdata) { result+=sep; } } else { bibdata = citeDataList.next(); } } return result; }
void TooltipManager::addTooltip(Definition *d) { static bool sourceTooltips = Config_getBool(SOURCE_TOOLTIPS); if (!sourceTooltips) return; QCString id = d->getOutputFileBase(); int i=id.findRev('/'); if (i!=-1) { id = id.right(id.length()-i-1); // strip path (for CREATE_SUBDIRS=YES) } id+=escapeId(Doxygen::htmlFileExtension); QCString anc = d->anchor(); if (!anc.isEmpty()) { id+="_"+anc; } if (p->tooltipInfo.find(id)==0) { p->tooltipInfo.insert(id,d); } }
void startCodeBlock(int index) { int ll=strComment.length(); iCodeLen=inputString.findRev(strComment.data())+ll; // fprintf(stderr,"\n startin code..%d %d %d\n",iCodeLen,num_chars,ll); gBlock.reset(); int len=strComment.length(); QCString name=strComment.right(len-index);// name=VhdlDocGen::getIndexWord(name.data(),1); if (!name) gBlock.name="misc"+ VhdlDocGen::getRecordNumber(); else gBlock.name=name; gBlock.startLine=yyLineNr; gBlock.bodyLine=yyLineNr; strComment=strComment.left(index); VhdlDocGen::prepareComment(strComment); gBlock.brief+=strComment; }
int main(int argc, char **argv) { bool readStdin = false; int numOptions = 0; QString user; Session session = DefaultSession; QString sessionName; bool updateUserTime = true; cin_.setEncoding(QTextStream::Locale); // Scan for command-line options first for(int pos = 1; pos <= argc - 1; pos++) { if(strcmp(argv[pos], "--help") == 0) showHelp(0); else if(strcmp(argv[pos], "--pipe") == 0) { readStdin = true; numOptions++; } else if(strcmp(argv[pos], "--user") == 0) { if(pos <= argc - 2) { user = QString::fromLocal8Bit(argv[pos + 1]); numOptions += 2; pos++; } else { cerr_ << "Missing username for '--user' option!" << endl << endl; showHelp(-1); } } else if(strcmp(argv[pos], "--session") == 0) { if(session == AllSessions) { cerr_ << "ERROR: --session cannot be mixed with --all-sessions!" << endl << endl; showHelp(-1); } else if(pos <= argc - 2) { sessionName = QString::fromLocal8Bit(argv[pos + 1]); numOptions += 2; pos++; } else { cerr_ << "Missing session name for '--session' option!" << endl << endl; showHelp(-1); } } else if(strcmp(argv[pos], "--all-users") == 0) { user = "******"; numOptions++; } else if(strcmp(argv[pos], "--list-sessions") == 0) { session = QuerySessions; numOptions++; } else if(strcmp(argv[pos], "--all-sessions") == 0) { if(!sessionName.isEmpty()) { cerr_ << "ERROR: --session cannot be mixed with --all-sessions!" << endl << endl; showHelp(-1); } session = AllSessions; numOptions++; } else if(strcmp(argv[pos], "--no-user-time") == 0) { updateUserTime = false; numOptions++; } else if(argv[pos][0] == '-') { cerr_ << "Unknown command-line option '" << argv[pos] << "'." << endl << endl; showHelp(-1); } else break; // End of options } argc -= numOptions; KStringList args; #ifdef DCOPQUIT if(argc > 1) { QCString prog = argv[numOptions + 1]; if(!prog.isEmpty()) { args.append(prog); // Pass as-is if it ends with a wildcard if(prog[prog.length() - 1] != '*') { // Strip a trailing -<PID> part. int i = prog.findRev('-'); if((i >= 0) && prog.mid(i + 1).toLong()) { prog = prog.left(i); } args.append("qt/" + prog); args.append("quit()"); } } } #else for(int i = numOptions; i < argc + numOptions - 1; i++) args.append(argv[i + 1]); #endif if(readStdin && args.count() < 3) { cerr_ << "--pipe option only supported for function calls!" << endl << endl; showHelp(-1); } if(user == "*" && args.count() < 3 && session != QuerySessions) { cerr_ << "ERROR: The --all-users option is only supported for function calls!" << endl << endl; showHelp(-1); } if(session == QuerySessions && !args.isEmpty()) { cerr_ << "ERROR: The --list-sessions option cannot be used for actual DCOP calls!" << endl << endl; showHelp(-1); } if(session == QuerySessions && user.isEmpty()) { cerr_ << "ERROR: The --list-sessions option can only be used with the --user or" << endl << "--all-users options!" << endl << endl; showHelp(-1); } if(session != DefaultSession && session != QuerySessions && args.count() < 3) { cerr_ << "ERROR: The --session and --all-sessions options are only supported for function" << endl << "calls!" << endl << endl; showHelp(-1); } UserList users; if(user == "*") users = userList(); else if(!user.isEmpty()) users[user] = userList()[user]; int retval = runDCOP(args, users, session, sessionName, readStdin, updateUserTime); return retval; }
/*! Reads a fragment of code from file \a fileName starting at * line \a startLine and ending at line \a endLine (inclusive). The fragment is * stored in \a result. If FALSE is returned the code fragment could not be * found. * * The file is scanned for a opening bracket ('{') from \a startLine onward * The line actually containing the bracket is returned via startLine. * The file is scanned for a closing bracket ('}') from \a endLine backward. * The line actually containing the bracket is returned via endLine. * Note that for VHDL code the bracket search is not done. */ static bool readCodeFragment(const char *fileName, int &startLine,int &endLine,QCString &result) { static bool vhdlOpt = Config_getBool("OPTIMIZE_OUTPUT_VHDL"); static bool filterSourceFiles = Config_getBool("FILTER_SOURCE_FILES"); //printf("readCodeFragment(%s,%d,%d)\n",fileName,startLine,endLine); if (fileName==0 || fileName[0]==0) return FALSE; // not a valid file name QCString filter = getFileFilter(fileName,TRUE); FILE *f=0; bool usePipe = !filter.isEmpty() && filterSourceFiles; if (!usePipe) // no filter given or wanted { f = portable_fopen(fileName,"r"); } else // use filter { QCString cmd=filter+" \""+fileName+"\""; Debug::print(Debug::ExtCmd,0,"Executing popen(`%s`)\n",cmd.data()); f = portable_popen(cmd,"r"); } bool found=vhdlOpt; // for VHDL no bracket search is possible if (f) { int c=0; int col=0; int lineNr=1; // skip until the startLine has reached while (lineNr<startLine && !feof(f)) { while ((c=fgetc(f))!='\n' && c!=EOF) /* skip */; lineNr++; } if (!feof(f)) { // skip until the opening bracket or lonely : is found char cn=0; while (lineNr<=endLine && !feof(f) && !found) { int pc=0; while ((c=fgetc(f))!='{' && c!=':' && c!=EOF) { //printf("parsing char `%c'\n",c); if (c=='\n') { lineNr++,col=0; } else if (c=='\t') { col+=Config_getInt("TAB_SIZE") - (col%Config_getInt("TAB_SIZE")); } else if (pc=='/' && c=='/') // skip single line comment { while ((c=fgetc(f))!='\n' && c!=EOF) pc=c; if (c=='\n') lineNr++,col=0; } else if (pc=='/' && c=='*') // skip C style comment { while (((c=fgetc(f))!='/' || pc!='*') && c!=EOF) { if (c=='\n') lineNr++,col=0; pc=c; } } else { col++; } pc = c; } if (c==':') { cn=fgetc(f); if (cn!=':') found=TRUE; } else if (c=='{') { found=TRUE; } } //printf(" -> readCodeFragment(%s,%d,%d) lineNr=%d\n",fileName,startLine,endLine,lineNr); if (found) { // For code with more than one line, // fill the line with spaces until we are at the right column // so that the opening brace lines up with the closing brace if (endLine!=startLine) { QCString spaces; spaces.fill(' ',col); result+=spaces; } // copy until end of line result+=c; if (c==':') { result+=cn; if (cn=='\n') lineNr++; } startLine=lineNr; const int maxLineLength=4096; char lineStr[maxLineLength]; do { //printf("reading line %d in range %d-%d\n",lineNr,startLine,endLine); int size_read; do { // read up to maxLineLength-1 bytes, the last byte being zero char *p = fgets(lineStr, maxLineLength,f); //printf(" read %s",p); if (p) { size_read=qstrlen(p); } else // nothing read { size_read=-1; lineStr[0]='\0'; } result+=lineStr; } while (size_read == (maxLineLength-1)); lineNr++; } while (lineNr<=endLine && !feof(f)); // strip stuff after closing bracket int newLineIndex = result.findRev('\n'); int braceIndex = result.findRev('}'); if (braceIndex > newLineIndex) { result.truncate(braceIndex+1); } endLine=lineNr-1; } } if (usePipe) { portable_pclose(f); } else { fclose(f); } } result = transcodeCharacterStringToUTF8(result); return found; }
/** In order to create stable, but unique directory names, * we compute the common part of the path shared by all directories. */ static void computeCommonDirPrefix() { QCString path; DirDef *dir; DirSDict::Iterator sdi(*Doxygen::directories); if (Doxygen::directories->count()>0) // we have at least one dir { // start will full path of first dir sdi.toFirst(); dir=sdi.current(); path=dir->name(); int i=path.findRev('/',path.length()-2); path=path.left(i+1); bool done=FALSE; if (i==-1) { path=""; } else { while (!done) { int l = path.length(); int count=0; for (sdi.toFirst();(dir=sdi.current());++sdi) { QCString dirName = dir->name(); if (dirName.length()>path.length()) { if (qstrncmp(dirName,path,l)!=0) // dirName does not start with path { int i=path.findRev('/',l-2); if (i==-1) // no unique prefix -> stop { path=""; done=TRUE; } else // restart with shorter path { path=path.left(i+1); break; } } } else // dir is shorter than path -> take path of dir as new start { path=dir->name(); l=path.length(); int i=path.findRev('/',l-2); if (i==-1) // no unique prefix -> stop { path=""; done=TRUE; } else // restart with shorter path { path=path.left(i+1); } break; } count++; } if (count==Doxygen::directories->count()) // path matches for all directories -> found the common prefix { done=TRUE; } } } } for (sdi.toFirst();(dir=sdi.current());++sdi) { QCString diskName = dir->name().right(dir->name().length()-path.length()); dir->setDiskName(diskName); //printf("set disk name: %s -> %s\n",dir->name().data(),diskName.data()); } }
static CWResult mocify(CWPluginContext context, const QCString &source) { CWDisplayLines(context, line_count++); source.stripWhiteSpace(); CWResult err; bool dotmoc=false; QCString stem = source, ext; int dotpos = stem.findRev('.'); if(dotpos != -1) { ext = stem.right(stem.length() - (dotpos+1)); stem = stem.left(dotpos); if(ext == "cpp") dotmoc = true; } else { //whoa! } QCString dest; if(dotmoc) dest = stem + ".moc"; else dest = "moc_" + stem + ".cpp"; //moc it CWFileSpec destSpec; moc_status mocd = do_moc(context, source, dest, &destSpec, dotmoc); #if 0 QCString derr = "Weird"; switch(mocd) { case moc_success: derr = "Success"; break; case moc_parse_error: derr = "Parser Error"; break; case moc_no_qobject:derr = "No QOBJECT"; break; case moc_not_time: derr = "Not Time"; break; case moc_no_source: derr = "No Source"; break; case moc_general_error: derr = "General Error"; break; } char dmsg[200]; sprintf(dmsg, "\"%s\" %s", source.data(), derr.data()); CWReportMessage(context, NULL, dmsg, NULL, messagetypeError, 0); #endif //handle project if(mocd == moc_no_qobject) { char msg[400]; sprintf(msg, "\"%s\" No relevant classes found. No output generated.", source.data()); CWReportMessage(context, NULL, msg, NULL, messagetypeWarning, 0); } else if ((mocd == moc_success || mocd == moc_not_time) && !dotmoc) { long whichFile; CWNewProjectEntryInfo ei; memset(&ei, '\0', sizeof(ei)); ei.groupPath = "QtGenerated"; err = CWAddProjectEntry(context, &destSpec, true, &ei, &whichFile); if (!CWSUCCESS(err)) { char msg[200]; sprintf(msg, "\"%s\" not added", dest.data()); CWReportMessage(context, NULL, msg, NULL, messagetypeWarning, 0); } if(mocd == moc_success) CWSetModDate(context, &destSpec, NULL, true); } return cwNoErr; }
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); } } }
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; } }