diff options
-rw-r--r-- | src/sqlite3gen.cpp | 417 |
1 files changed, 210 insertions, 207 deletions
diff --git a/src/sqlite3gen.cpp b/src/sqlite3gen.cpp index a3f93ef..c34eae8 100644 --- a/src/sqlite3gen.cpp +++ b/src/sqlite3gen.cpp @@ -45,6 +45,8 @@ //#define DBG_CTX(x) printf x #define DBG_CTX(x) do { } while(0) +static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def); + ////////////////////////////////////////////////////// const char *i_q_includes="INSERT OR REPLACE INTO includes " "( local, id_src, dst ) " @@ -238,8 +240,6 @@ class TextGeneratorSqlite3Impl : public TextGeneratorIntf // the list is filled by linkifyText and consumed by the caller }; -static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def); - static void bindTextParameter(sqlite3_stmt *stmt,const char *name,const char *value, bool _static=TRUE) { @@ -326,88 +326,6 @@ static void stripQualifiers(QCString &typeStr) } } -//////////////////////////////////////////// -static void writeInnerClasses(sqlite3*db,const ClassSDict *cl) -{ - if (!cl) return; - - ClassSDict::Iterator cli(*cl); - ClassDef *cd; - for (cli.toFirst();(cd=cli.current());++cli) - { - if (!cd->isHidden() && cd->name().find('@')==-1) // skip anonymous scopes - { - bindTextParameter(i_s_innerclass,":refid",cd->getOutputFileBase()); - bindIntParameter(i_s_innerclass,":prot",cd->protection()); - bindTextParameter(i_s_innerclass,":name",cd->name()); - if (-1==step(db,i_s_innerclass)) - return; - } - } -} - -static void writeInnerNamespaces(sqlite3 * /*db*/,const NamespaceSDict *nl) -{ -#warning WorkInProgress - if (nl) - { - NamespaceSDict::Iterator nli(*nl); - NamespaceDef *nd; - for (nli.toFirst();(nd=nli.current());++nli) - { - if (!nd->isHidden() && nd->name().find('@')==-1) // skip anonymouse scopes - { -// t << " <innernamespace refid=\"" << nd->getOutputFileBase() -// << "\">" << convertToXML(nd->name()) << "</innernamespace>" << endl; - } - } - } -} - -static void writeTemplateArgumentList(sqlite3* /*db*/, - ArgumentList * /*al*/, - Definition * /*scope*/, - FileDef * /*fileScope*/, - int /*indent*/) -{ -#warning WorkInProgress -} - -static void writeTemplateList(sqlite3*db,ClassDef *cd) -{ - writeTemplateArgumentList(db,cd->templateArguments(),cd,0,4); -} - -static void generateSqlite3Section(sqlite3*db, - Definition *d, - MemberList *ml,const char * /*kind*/,const char * /*header*/=0, - const char * /*documentation*/=0) -{ - if (ml==0) return; - MemberListIterator mli(*ml); - MemberDef *md; - int count=0; - for (mli.toFirst();(md=mli.current());++mli) - { - // namespace members are also inserted in the file scope, but - // to prevent this duplication in the XML output, we filter those here. - if (d->definitionType()!=Definition::TypeFile || md->getNamespaceDef()==0) - { - count++; - } - } - if (count==0) return; // empty list - for (mli.toFirst();(md=mli.current());++mli) - { - // namespace members are also inserted in the file scope, but - // to prevent this duplication in the XML output, we filter those here. - //if (d->definitionType()!=Definition::TypeFile || md->getNamespaceDef()==0) - { - generateSqlite3ForMember(db,md,d); - } - } -} - static int prepareStatement(sqlite3 *db, const char* query, sqlite3_stmt **statement) { int rc; @@ -488,148 +406,60 @@ static int initializeSchema(sqlite3* db) return 0; } -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - -static void generateSqlite3ForNamespace(sqlite3 *db, NamespaceDef *nd) +//////////////////////////////////////////// +static void writeInnerClasses(sqlite3*db,const ClassSDict *cl) { - // + contained class definitions - // + contained namespace definitions - // + member groups - // + normal members - // - brief desc - // - detailed desc - // - location - // - files containing (parts of) the namespace definition - - if (nd->isReference() || nd->isHidden()) return; // skip external references - - // + contained class definitions - writeInnerClasses(db,nd->getClassSDict()); - - // + contained namespace definitions - writeInnerNamespaces(db,nd->getNamespaceSDict()); - - // + member groups - if (nd->getMemberGroupSDict()) - { - MemberGroupSDict::Iterator mgli(*nd->getMemberGroupSDict()); - MemberGroup *mg; - for (;(mg=mgli.current());++mgli) - { - generateSqlite3Section(db,nd,mg->members(),"user-defined",mg->header(), - mg->documentation()); - } - } + if (!cl) return; - // + normal members - QListIterator<MemberList> mli(nd->getMemberLists()); - MemberList *ml; - for (mli.toFirst();(ml=mli.current());++mli) + ClassSDict::Iterator cli(*cl); + ClassDef *cd; + for (cli.toFirst();(cd=cli.current());++cli) { - if ((ml->listType()&MemberListType_declarationLists)!=0) + if (!cd->isHidden() && cd->name().find('@')==-1) // skip anonymous scopes { - generateSqlite3Section(db,nd,ml,"user-defined");//g_xmlSectionMapper.find(ml->listType())); + bindTextParameter(i_s_innerclass,":refid",cd->getOutputFileBase()); + bindIntParameter(i_s_innerclass,":prot",cd->protection()); + bindTextParameter(i_s_innerclass,":name",cd->name()); + if (-1==step(db,i_s_innerclass)) + return; } } } - -static void generateSqlite3ForFile(sqlite3 *db, FileDef *fd) +static void writeInnerNamespaces(sqlite3 * /*db*/,const NamespaceSDict *nl) { - // + includes files - // + includedby files - // - include graph - // - included by graph - // + contained class definitions - // + contained namespace definitions - // + member groups - // + normal members - // - brief desc - // - detailed desc - // - source code - // - location - // - number of lines - - if (fd->isReference()) return; // skip external references - - // + includes files - IncludeInfo *ii; - if (fd->includeFileList()) - { - QListIterator<IncludeInfo> ili(*fd->includeFileList()); - for (ili.toFirst();(ii=ili.current());++ili) - { - int id_file=insertFile(db,fd->absFilePath().data()); - bindIntParameter(i_s_includes,":local",ii->local); - bindIntParameter(i_s_includes,":id_src",id_file); - bindTextParameter(i_s_includes,":dst",ii->includeName.data(),FALSE); - if (-1==step(db,i_s_includes)) - return; - } - } - - // + includedby files - if (fd->includedByFileList()) - { - QListIterator<IncludeInfo> ili(*fd->includedByFileList()); - for (ili.toFirst();(ii=ili.current());++ili) - { - int id_file=insertFile(db,ii->includeName); - bindIntParameter(i_s_includes,":local",ii->local); - bindIntParameter(i_s_includes,":id_src",id_file); - bindTextParameter(i_s_includes,":dst",fd->absFilePath().data(),FALSE); - if (-1==step(db,i_s_includes)) - return; - } - } - - // + contained class definitions - if (fd->getClassSDict()) - { - writeInnerClasses(db,fd->getClassSDict()); - } - // + contained namespace definitions - if (fd->getNamespaceSDict()) - { - writeInnerNamespaces(db,fd->getNamespaceSDict()); - } - - // + member groups - if (fd->getMemberGroupSDict()) - { - MemberGroupSDict::Iterator mgli(*fd->getMemberGroupSDict()); - MemberGroup *mg; - for (;(mg=mgli.current());++mgli) - { - generateSqlite3Section(db,fd,mg->members(),"user-defined",mg->header(), - mg->documentation()); - } - } - - // + normal members - QListIterator<MemberList> mli(fd->getMemberLists()); - MemberList *ml; - for (mli.toFirst();(ml=mli.current());++mli) +#warning WorkInProgress + if (nl) { - if ((ml->listType()&MemberListType_declarationLists)!=0) + NamespaceSDict::Iterator nli(*nl); + NamespaceDef *nd; + for (nli.toFirst();(nd=nli.current());++nli) { - generateSqlite3Section(db,fd,ml,"user-defined");//g_xmlSectionMapper.find(ml->listType())); + if (!nd->isHidden() && nd->name().find('@')==-1) // skip anonymouse scopes + { +// t << " <innernamespace refid=\"" << nd->getOutputFileBase() +// << "\">" << convertToXML(nd->name()) << "</innernamespace>" << endl; + } } } } -static void generateSqlite3ForGroup(sqlite3*db,GroupDef *gd) -{ - db=db; - gd=gd; -} -static void generateSqlite3ForDir(sqlite3 *db,DirDef *dd) + +static void writeTemplateArgumentList(sqlite3* /*db*/, + ArgumentList * /*al*/, + Definition * /*scope*/, + FileDef * /*fileScope*/, + int /*indent*/) { +#warning WorkInProgress } -static void generateSqlite3ForPage(sqlite3 *db,PageDef *pd,bool isExample) + +static void writeTemplateList(sqlite3*db,ClassDef *cd) { + writeTemplateArgumentList(db,cd->templateArguments(),cd,0,4); } +//////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////////// static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def) { // + declaration/definition arg lists @@ -645,6 +475,7 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def) // + template arguments // (templateArguments(), definitionTemplateParameterLists()) // - call graph + msg("=====%s\n",md->name().data()); // enum values are written as part of the enum if (md->memberType()==MemberType_EnumValue) return; @@ -911,6 +742,38 @@ static void generateSqlite3ForMember(sqlite3*db,MemberDef *md,Definition *def) } } +static void generateSqlite3Section(sqlite3*db, + Definition *d, + MemberList *ml,const char * /*kind*/,const char * /*header*/=0, + const char * /*documentation*/=0) +{ + if (ml==0) return; + MemberListIterator mli(*ml); + MemberDef *md; + int count=0; + for (mli.toFirst();(md=mli.current());++mli) + { + msg("I:%s\n",md->name().data()); + // namespace members are also inserted in the file scope, but + // to prevent this duplication in the XML output, we filter those here. + if (d->definitionType()!=Definition::TypeFile || md->getNamespaceDef()==0) + { + count++; + } + } + if (count==0) return; // empty list + for (mli.toFirst();(md=mli.current());++mli) + { + // namespace members are also inserted in the file scope, but + // to prevent this duplication in the XML output, we filter those here. + //if (d->definitionType()!=Definition::TypeFile || md->getNamespaceDef()==0) + { + generateSqlite3ForMember(db,md,d); + } + } +} + + static void generateSqlite3ForClass(sqlite3 *db, ClassDef *cd) { // + list of direct super classes @@ -1050,6 +913,146 @@ static void generateSqlite3ForClass(sqlite3 *db, ClassDef *cd) } } +static void generateSqlite3ForNamespace(sqlite3 *db, NamespaceDef *nd) +{ + // + contained class definitions + // + contained namespace definitions + // + member groups + // + normal members + // - brief desc + // - detailed desc + // - location + // - files containing (parts of) the namespace definition + + if (nd->isReference() || nd->isHidden()) return; // skip external references + + // + contained class definitions + writeInnerClasses(db,nd->getClassSDict()); + + // + contained namespace definitions + writeInnerNamespaces(db,nd->getNamespaceSDict()); + + // + member groups + if (nd->getMemberGroupSDict()) + { + MemberGroupSDict::Iterator mgli(*nd->getMemberGroupSDict()); + MemberGroup *mg; + for (;(mg=mgli.current());++mgli) + { + generateSqlite3Section(db,nd,mg->members(),"user-defined",mg->header(), + mg->documentation()); + } + } + + // + normal members + QListIterator<MemberList> mli(nd->getMemberLists()); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if ((ml->listType()&MemberListType_declarationLists)!=0) + { + generateSqlite3Section(db,nd,ml,"user-defined");//g_xmlSectionMapper.find(ml->listType())); + } + } +} + +static void generateSqlite3ForFile(sqlite3 *db, FileDef *fd) +{ + // + includes files + // + includedby files + // - include graph + // - included by graph + // + contained class definitions + // + contained namespace definitions + // + member groups + // + normal members + // - brief desc + // - detailed desc + // - source code + // - location + // - number of lines + + if (fd->isReference()) return; // skip external references + + // + includes files + IncludeInfo *ii; + if (fd->includeFileList()) + { + QListIterator<IncludeInfo> ili(*fd->includeFileList()); + for (ili.toFirst();(ii=ili.current());++ili) + { + int id_file=insertFile(db,fd->absFilePath().data()); + bindIntParameter(i_s_includes,":local",ii->local); + bindIntParameter(i_s_includes,":id_src",id_file); + bindTextParameter(i_s_includes,":dst",ii->includeName.data(),FALSE); + if (-1==step(db,i_s_includes)) + return; + } + } + + // + includedby files + if (fd->includedByFileList()) + { + QListIterator<IncludeInfo> ili(*fd->includedByFileList()); + for (ili.toFirst();(ii=ili.current());++ili) + { + int id_file=insertFile(db,ii->includeName); + bindIntParameter(i_s_includes,":local",ii->local); + bindIntParameter(i_s_includes,":id_src",id_file); + bindTextParameter(i_s_includes,":dst",fd->absFilePath().data(),FALSE); + if (-1==step(db,i_s_includes)) + return; + } + } + + // + contained class definitions + if (fd->getClassSDict()) + { + writeInnerClasses(db,fd->getClassSDict()); + } + // + contained namespace definitions + if (fd->getNamespaceSDict()) + { + writeInnerNamespaces(db,fd->getNamespaceSDict()); + } + + // + member groups + if (fd->getMemberGroupSDict()) + { + MemberGroupSDict::Iterator mgli(*fd->getMemberGroupSDict()); + MemberGroup *mg; + for (;(mg=mgli.current());++mgli) + { + generateSqlite3Section(db,fd,mg->members(),"user-defined",mg->header(), + mg->documentation()); + } + } + + // + normal members + QListIterator<MemberList> mli(fd->getMemberLists()); + MemberList *ml; + for (mli.toFirst();(ml=mli.current());++mli) + { + if ((ml->listType()&MemberListType_declarationLists)!=0) + { + generateSqlite3Section(db,fd,ml,"user-defined");//g_xmlSectionMapper.find(ml->listType())); + } + } +} + +static void generateSqlite3ForGroup(sqlite3*db,GroupDef *gd) +{ + db=db; + gd=gd; +} + +static void generateSqlite3ForDir(sqlite3 *db,DirDef *dd) +{ +} + +static void generateSqlite3ForPage(sqlite3 *db,PageDef *pd,bool isExample) +{ +} ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// void generateSqlite3() |